*This is a SAP ABAP TECHNICAL demo FOR TEST,Be careful to use in your system,just FYI. BAPI for creating a delivery network
*If you have any solution,Please feel free to talk with your IT team/SAP ABAP professional guys. BAPI for creating a delivery network
REPORT ZDEMO_BAPI_DELIVERY_NETWORK_CREATE.
PARAMETERS SAMPLE AS CHECKBOX.
INITIALIZATION.
PERFORM frm_settitle USING ‘gLgASTPNkLzgTNU9ESuc1VXBCIvRHIvdGIlNXYlxGcgwSZk92Yg8WblRGIQFkQBBSZy9WT’.
START-OF-SELECTION.
BREAK-POINT..
**********************************************************************
*******Defination of Work Area Structrue [Import]-[BAPIOIUDNHEADER ] . “”BAPI: Delivery Network – Header
**********************************************************************
DATA: LS_BAPIOIUDNHEADER TYPE BAPI_OIU_DN . “”BAPI: Delivery Network – Header
LS_BAPIOIUDNHEADER-DN_NO = ‘CHAR20’. “Delivery Network
LS_BAPIOIUDNHEADER-DN_DE = ‘CHAR35’. “Delivery Network Name
LS_BAPIOIUDNHEADER-DN_GRP = ‘CHAR4’. “DN Number Group
LS_BAPIOIUDNHEADER-TYPE_CD = ‘CHAR1’. “Delivery Network Typ
LS_BAPIOIUDNHEADER-DN_SET = ‘CHAR15’. “Delivery Network Grp
**********************************************************************
*******Defination of Work Area Structrue [Import]-[BAPIOIUDN1DETAIL ] . “”BAPI: Delivery Network – Detail
**********************************************************************
DATA: LS_BAPIOIUDN1DETAIL TYPE BAPI_OIU_DN_1 . “”BAPI: Delivery Network – Detail
LS_BAPIOIUDN1DETAIL-CNTRY_CD = ‘CHAR3’. “Country/Region
LS_BAPIOIUDN1DETAIL-PRI_GEO_LOC = ‘CHAR2’. “Prim Geo Location
LS_BAPIOIUDN1DETAIL-SEC_GEO_LOC = ‘CHAR3’. “Sec Geo Location
LS_BAPIOIUDN1DETAIL-TOL_PC = ‘NUMC3’. “Allocation Tolerance
LS_BAPIOIUDN1DETAIL-COMP_CODE = ‘CHAR4’. “Company Code
LS_BAPIOIUDN1DETAIL-VENTURE = ‘CHAR6’. “Joint venture
LS_BAPIOIUDN1DETAIL-GPLT_DN_NO = ‘CHAR20’. “Chaining Network
DATA: LV_TEST_RUN TYPE BOOLEAN .”Option,Default Value =ABAP_FALSE,”Boolean Variable (X = True, – = False, Space = Unknown)
**********************************************************************
*******Defination of Work Area Structrue [Export]-[BAPIOIUDNHEADERE ] . “”BAPI: Delivery Network – Header
**********************************************************************
DATA: LS_BAPIOIUDNHEADERE TYPE BAPI_OIU_DN . “”BAPI: Delivery Network – Header
**********************************************************************
*******Defination of Work Area Structrue [Export]-[BAPIOIUDN1DETAILE ] . “”BAPI: Delivery Network – Detail
**********************************************************************
DATA: LS_BAPIOIUDN1DETAILE TYPE BAPI_OIU_DN_1 . “”BAPI: Delivery Network – Detail
**********************************************************************
*******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 .
**********************************************************************
*******CallUp The Function Now. .
**********************************************************************
CALL FUNCTION ‘BAPI_DELIVERY_NETWORK_CREATE’
EXPORTING
BAPIOIUDNHEADER = LS_BAPIOIUDNHEADER
BAPIOIUDN1DETAIL = LS_BAPIOIUDN1DETAIL
* TEST_RUN = ‘ABAP_FALSE’
IMPORTING
BAPIOIUDNHEADERE = LS_BAPIOIUDNHEADERE
BAPIOIUDN1DETAILE = LS_BAPIOIUDN1DETAILE
TABLES
RETURN = LT_RETURN
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.
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.
微信原文《The End》