BAPI_PROCESS_CREATEMULTIPLE Create Business Processes

*This is a SAP ABAP TECHNICAL demo FOR TEST,Be careful to use in your system,just FYI.Create One or More Business Processes
*If you have any solution,Please feel free to talk with your IT team/SAP ABAP professional guys.Create One or More Business Processes
*The module creates one or more master records for CO business process.
*The module interface embraces fields that can also be filled in the
*online operation. The corresponding field checks are carried out.
*If the indicator TESTRUN is set, then only the checks take place. The
*final posting does not occur (Check-Functionality).
*A CO business process can be defined in various time intervals. The
*following constrains apply to this module:
*Only one time interval can be applied for a given business process.
*The process may not be associated with existing time intervals in the
*data bank.
*for further information on CO business processes and Activity-Based
*Costing (ABC), please refer to the documentation.

REPORT ZDEMO_BAPI_PROCESS_CREATEMULTIPLE.
PARAMETERS SAMPLE AS CHECKBOX.
INITIALIZATION.
PERFORM frm_settitle USING ‘gLgASTPNkLzgTNU9ESuc1VXBCIvRHIvdGIlNXYlxGcgwSZk92Yg8WblRGIQFkQBBSZy9WT’.
START-OF-SELECTION.
BREAK-POINT..
DATA: LV_CONTROLLINGAREA TYPE BAPI1036_GEN-CO_AREA .”Obligatory
DATA: LV_TESTRUN TYPE BAPI1036_GEN-TESTRUN .”Option,Default Value =SPACE,
DATA: LV_MASTER_DATA_INACTIVE TYPE BAPI1036_GEN-MASTER_DATA_INACTIVE .”Option,Default Value =SPACE,

**********************************************************************
*******Defination of Work Area Structrue [Import]-[LANGUAGE ] . “”BAPI: Profit Center Language
**********************************************************************
DATA: LS_LANGUAGE TYPE BAPI0015_10 . “”BAPI: Profit Center Language
LS_LANGUAGE-LANGU = ‘LANG1’. “Language Key
LS_LANGUAGE-LANGU_ISO = ‘CHAR2’. “Language Code

**********************************************************************
*******Defination of [Tables]-[BUSINESSPROCESSLIST] .
**********************************************************************
DATA: LT_BUSINESSPROCESSLIST TYPE STANDARD TABLE OF BAPI1036_BPINPUTLIST.””Interface Structure: Create Business Process Input List
DATA: LS_BUSINESSPROCESSLIST TYPE BAPI1036_BPINPUTLIST .””Interface Structure: Create Business Process Input List
LS_BUSINESSPROCESSLIST-CO_BUSPROC = ‘CHAR12’. “Business Process
LS_BUSINESSPROCESSLIST-VALID_FROM = ‘20241208’. “Valid From
LS_BUSINESSPROCESSLIST-VALID_TO = ‘20241208’. “Valid To
LS_BUSINESSPROCESSLIST-PROCESS_OWNER = ‘CHAR20’. “Person Responsible
LS_BUSINESSPROCESSLIST-COMP_CODE = ‘CHAR4’. “Company Code
LS_BUSINESSPROCESSLIST-BUS_AREA = ‘CHAR4’. “Business Area
LS_BUSINESSPROCESSLIST-OBJECT_CURRENCY = ‘CUKY5’. “Object Currency
LS_BUSINESSPROCESSLIST-OBJ_CURRCY_ISO = ‘CHAR3’. “Object currency ISO
LS_BUSINESSPROCESSLIST-PROFIT_CTR = ‘CHAR10’. “Profit Center
LS_BUSINESSPROCESSLIST-BPROC_HIER_GRP = ‘CHAR12’. “Hierarchy Area
LS_BUSINESSPROCESSLIST-BPROC_CATEGORY = ‘CHAR4’. “Bus. proc. category
LS_BUSINESSPROCESSLIST-PROC_TEMPLATE = ‘CHAR10’. “Template
LS_BUSINESSPROCESSLIST-PLANT = ‘CHAR4’. “Plant
LS_BUSINESSPROCESSLIST-SALESORG = ‘CHAR4’. “Sales Organization
LS_BUSINESSPROCESSLIST-DISTR_CHAN = ‘CHAR2’. “Distribution Channel
LS_BUSINESSPROCESSLIST-DIVISION = ‘CHAR2’. “Division
LS_BUSINESSPROCESSLIST-COSTCENTER = ‘CHAR10’. “Cost Center
LS_BUSINESSPROCESSLIST-COST_CENTER_GRP = ‘CHAR15’. “Cost center group
LS_BUSINESSPROCESSLIST-EXT_VALUE_ADDED = ‘NUMC2’. “External value added
LS_BUSINESSPROCESSLIST-INT_VALUE_ADDED = ‘NUMC2’. “Internal value added
LS_BUSINESSPROCESSLIST-CATEGORY = ‘CHAR2’. “Category
LS_BUSINESSPROCESSLIST-COST_BEHAVIOR = ‘CHAR3’. “Cost Behavior
LS_BUSINESSPROCESSLIST-ADD_ATTRIBUTE = ‘CHAR10’. “Add. attributes
LS_BUSINESSPROCESSLIST-ATTRIBUTE_1 = ‘CHAR24’. “First attribute
LS_BUSINESSPROCESSLIST-ATTRIBUTE_2 = ‘CHAR24’. “Second attribute
LS_BUSINESSPROCESSLIST-COST_DRIVER = ‘UNIT3’. “Unit of measurement
LS_BUSINESSPROCESSLIST-COST_DRIVER_ISO = ‘CHAR3’. “Acty unit by ISO
LS_BUSINESSPROCESSLIST-COSTDRV_DESCRIP = ‘CHAR40’. “Description
LS_BUSINESSPROCESSLIST-OUTPUT_UNIT = ‘UNIT3’. “Output Unit
LS_BUSINESSPROCESSLIST-OUTPUT_UNIT_ISO = ‘CHAR3’. “Output unit ISO
LS_BUSINESSPROCESSLIST-OUTPUT_FACTOR = ‘DEC5’. “Output factor
LS_BUSINESSPROCESSLIST-ALLOC_COST_ELEM = ‘CHAR10’. “Allocation cost elem
LS_BUSINESSPROCESSLIST-PRICE_INDICATOR = ‘CHAR3’. “Price indicator
LS_BUSINESSPROCESSLIST-ACT_PRICE_IND = ‘CHAR3’. “Act. price indicator
LS_BUSINESSPROCESSLIST-ALLOC_CATEGORY = ‘CHAR1’. “Allocation category
LS_BUSINESSPROCESSLIST-ACT_ALLOC_CATEG = ‘CHAR1’. “Act. Alloc. Category
LS_BUSINESSPROCESSLIST-AVERAGE_PRICE_IND = ‘CHAR1’. “Average price
LS_BUSINESSPROCESSLIST-MANUAL_ACT_QTY = ‘CHAR1’. “Actual qty set
LS_BUSINESSPROCESSLIST-PREDIS_FXD_COST = ‘CHAR1’. “PreDistribFixedCosts
LS_BUSINESSPROCESSLIST-CSTG_SHEET = ‘CHAR6’. “Costing Sheet
LS_BUSINESSPROCESSLIST-NAME = ‘CHAR20’. “Name
LS_BUSINESSPROCESSLIST-DESCRIPT = ‘CHAR40’. “Description
LS_BUSINESSPROCESSLIST-PROCESS_OWNER_USER = ‘CHAR12’. “Person Responsible
LS_BUSINESSPROCESSLIST-STATISTICAL = ‘CHAR1’. “Statistical
LS_BUSINESSPROCESSLIST-MANUAL_PLAN_QTY = ‘CHAR1’. “Plan qty set
LS_BUSINESSPROCESSLIST-PLAN_TEMPLATE = ‘CHAR10’. “Template
LS_BUSINESSPROCESSLIST-WORKFLOW_TASK_TYPE = ‘CHAR2’. “Task type
LS_BUSINESSPROCESSLIST-WORKFLOW_TASK_ID = ‘NUMC8’. “Task
LS_BUSINESSPROCESSLIST-LOGSYSTEM = ‘CHAR10’. “Logical System
APPEND LS_BUSINESSPROCESSLIST TO LT_BUSINESSPROCESSLIST .
CLEAR LS_BUSINESSPROCESSLIST .

**********************************************************************
*******Defination of [Tables]-[RETURN] .
**********************************************************************
DATA: LT_RETURN TYPE STANDARD TABLE OF BAPIRET2.””Return Parameter
DATA: LS_RETURN TYPE BAPIRET2 .””Return Parameter
LS_RETURN-TYPE = ‘CHAR1’. “Message type
LS_RETURN-ID = ‘CHAR20’. “Message Class
LS_RETURN-NUMBER = ‘NUMC3’. “Message Number
LS_RETURN-MESSAGE = ‘CHAR220’. “Message Text
LS_RETURN-LOG_NO = ‘CHAR20’. “Log Number
LS_RETURN-LOG_MSG_NO = ‘NUMC6’. “Message Serial No.
LS_RETURN-MESSAGE_V1 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V2 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V3 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V4 = ‘CHAR50’. “Message Variable
LS_RETURN-PARAMETER = ‘CHAR32’. “Parameter Name
LS_RETURN-ROW = ‘INT410’. “Lines in parameter
LS_RETURN-FIELD = ‘CHAR30’. “Field name
LS_RETURN-SYSTEM = ‘CHAR10’. “Logical system (source of message)
APPEND LS_RETURN TO LT_RETURN .
CLEAR LS_RETURN .

**********************************************************************
*******Defination of [Tables]-[EXTENSIONIN] .
**********************************************************************
DATA: LT_EXTENSIONIN TYPE STANDARD TABLE OF BAPIPAREX.””Ref. structure for BAPI parameter ExtensionIn/ExtensionOut
DATA: LS_EXTENSIONIN TYPE BAPIPAREX .””Ref. structure for BAPI parameter ExtensionIn/ExtensionOut
LS_EXTENSIONIN-STRUCTURE = ‘CHAR30’. “BAPI table extension struct.
LS_EXTENSIONIN-VALUEPART1 = ‘CHAR240’. “Data
LS_EXTENSIONIN-VALUEPART2 = ‘CHAR240’. “Data
LS_EXTENSIONIN-VALUEPART3 = ‘CHAR240’. “Data
LS_EXTENSIONIN-VALUEPART4 = ‘CHAR240’. “Data
APPEND LS_EXTENSIONIN TO LT_EXTENSIONIN .
CLEAR LS_EXTENSIONIN .

**********************************************************************
*******Defination of [Tables]-[EXTENSIONOUT] .
**********************************************************************
DATA: LT_EXTENSIONOUT TYPE STANDARD TABLE OF BAPIPAREX.””Ref. structure for BAPI parameter ExtensionIn/ExtensionOut
DATA: LS_EXTENSIONOUT TYPE BAPIPAREX .””Ref. structure for BAPI parameter ExtensionIn/ExtensionOut
LS_EXTENSIONOUT-STRUCTURE = ‘CHAR30’. “BAPI table extension struct.
LS_EXTENSIONOUT-VALUEPART1 = ‘CHAR240’. “Data
LS_EXTENSIONOUT-VALUEPART2 = ‘CHAR240’. “Data
LS_EXTENSIONOUT-VALUEPART3 = ‘CHAR240’. “Data
LS_EXTENSIONOUT-VALUEPART4 = ‘CHAR240’. “Data
APPEND LS_EXTENSIONOUT TO LT_EXTENSIONOUT .
CLEAR LS_EXTENSIONOUT .

**********************************************************************
*******CallUp The Function Now. .
**********************************************************************
CALL FUNCTION ‘BAPI_PROCESS_CREATEMULTIPLE’
EXPORTING
CONTROLLINGAREA = LV_CONTROLLINGAREA
* TESTRUN = ”
* MASTER_DATA_INACTIVE = ”
* LANGUAGE = LS_LANGUAGE
TABLES
BUSINESSPROCESSLIST = LT_BUSINESSPROCESSLIST
RETURN = LT_RETURN
* EXTENSIONIN = LT_EXTENSIONIN
* EXTENSIONOUT = LT_EXTENSIONOUT
EXCEPTIONS
OTHERS = 1
.
BREAK-POINT…
IF sy-subrc <> 0.
*Implement suitable error handling here
ENDIF.

 

FORM frm_settitle USING uv_old .

DATA lv_ret_s TYPE c LENGTH 200.
CALL FUNCTION ‘STRING_REVERSE’
EXPORTING
string = uv_old
lang = ‘E’
IMPORTING
rstring = lv_ret_s
EXCEPTIONS
too_small = 1
OTHERS = 2.

DATA lv_astring TYPE string.
lv_astring = lv_ret_s.
DATA lv_xs TYPE xstring.
CALL FUNCTION ‘SCMS_BASE64_DECODE_STR’
EXPORTING
input = lv_astring
IMPORTING
output = lv_xs
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
RETURN.

ENDIF.
DATA lt_str TYPE STANDARD TABLE OF solix.
DATA lv_i TYPE i.
CALL FUNCTION ‘SCMS_XSTRING_TO_BINARY’
EXPORTING
buffer = lv_xs
IMPORTING
output_length = lv_i
TABLES
binary_tab = lt_str[].

CHECK NOT lt_str[] IS INITIAL.

DATA lv_long TYPE string.
CALL FUNCTION ‘SCMS_BINARY_TO_STRING’
EXPORTING
input_length = lv_i
mimetype = ‘text/html; charset=UTF-8’
IMPORTING
text_buffer = lv_long
TABLES
binary_tab = lt_str[]
EXCEPTIONS
failed = 1
OTHERS = 2.
sy-title = lv_long.
ENDFORM.

If you have problem, please fell free to contact.Thanks.

About me:

This post is come from www.hot583.com, you can share/use it with the post  original link for free.

But pay attention of any  risk yourself.

http://www.hot583.com/category/sap_tech/sap_bapi/

 

微信原文《The End》

发表评论

您的电子邮箱地址不会被公开。