* Begin of insert - TIN2841 - def#8785
CHECK sy-uname eq 'TIN2841'.
TYPES : begin of ty_crmtpop,
YYSALES_ORG TYPE char4,
YYSLA TYPE char2,
END OF ty_crmtpop.
TYPES : begin of ty_crmtpopx,
YYSALES_ORG TYPE char1,
YYSLA TYPE char1,
END OF ty_crmtpopx.
data: lwa_crmtpop TYPE ty_CRMTPOP,
lwa_crmtpopx TYPE ty_crmtpopx,
lwa_ship TYPE bad_shipping_mess.
FIELD-SYMBOLS:
CONSTANTS: lv_ref_kind TYPE char8 VALUE 'REF_KIND'.
ASSIGN COMPONENT 'SHIPPING' OF STRUCTURE IT_BUS_TRANS_MSG to
IF sy-subrc = 0 AND
READ TABLE
= 'A'.
ENDIF.
ASSIGN COMPONENT 'ORGMAN' OF STRUCTURE IT_BUS_TRANS_MSG to
* READ TABLE IT_BUS_TRANS_MSG-ORGMAN ASSIGNING
IF sy-subrc eq 0 and
READ TABLE
'A'.
ENDIF.
ASSIGN COMPONENT 'SALES_ORG_RESP' of STRUCTURE
ASSIGN COMPONENT 'SHIP_COND' of STRUCTURE
CALL METHOD CL_CRM_ORGMAN_SERVICES=>MAP_HROBJECT_TO_R3_SALES_ORG
EXPORTING
HROBJECT =
* DBREAD =
IMPORTING
VKORG = lwa_crmtpop-YYSALES_ORG
EXCEPTIONS
NO_AUTHORIZATION = 1
NOT_FOUND = 2
others = 3.
IF SY-SUBRC <> 0.
CLEAR lwa_crmtpop-YYSALES_ORG.
ENDIF.
lwa_crmtpop-YYSLA =
CLEAR l_bapiparex.
l_bapiparex-structure = 'BAPI_CRMTPOP_HDR'. "lv_bapi_structure.
MOVE lwa_crmtpop TO l_bapiparex-valuepart1.
INSERT l_bapiparex INTO TABLE ct_bapiparex.
CLEAR l_bapiparex.
MOVE-CORRESPONDING
lwa_crmtpopx-yysales_org = 'X'.
lwa_crmtpopx-yysla = 'X'.
l_bapiparex-structure = 'BAPI_CRMTPOP_HDRX'. "lv_bapi_structure.
MOVE lwa_crmtpopx TO l_bapiparex-valuepart1.
INSERT l_bapiparex INTO TABLE ct_bapiparex.
* end of insert - TIN2841 - def#8785