Skip to Content
0
Former Member
Jul 23, 2008 at 07:55 AM

BAPI_SALESORDER_CREATEFROMDAT2???

169 Views

Hi all,

I am using BAPI BAPI_SALESORDER_CREATEFROMDAT2 to creat sales order. It is working fine but I am not able to maintain sales order item configuration using tables ORDER_CFGS_REF, ORDER_CFGS_INST, ORDER_CFGS_PART_OF, ORDER_CFGS_VALUE. but these valde are not geting saved.

Please help me to work this thing out. Please check my code :-

&----


*& Report ZTEST3

*&

&----


*&

*&

&----


REPORT ZTEST3.

data: numb type p decimals 3,

numb1 type p decimals 3 value '1000.000'.

DATA : BEGIN OF order_header_in OCCURS 0.

INCLUDE STRUCTURE BAPISDHD1.

DATA : END OF order_header_in.

DATA : SALESDOCUMENT type bapivbeln-vbeln.

DATA : BEGIN OF RETURN OCCURS 0.

INCLUDE STRUCTURE BAPIRET2.

DATA : END OF RETURN.

DATA : BEGIN OF order_partners OCCURS 0.

INCLUDE STRUCTURE BAPIPARNR.

DATA : END OF order_partners.

DATA : BEGIN OF ORDER_HEADER_INX OCCURS 0.

INCLUDE STRUCTURE BAPISDHD1X.

DATA : END OF ORDER_HEADER_INX.

data : begin of ORDER_ITEMS_IN occurs 0.

INCLUDE STRUCTURE BAPISDITM.

data : end of ORDER_ITEMS_IN.

data : begin of ORDER_ITEMS_INX occurs 0.

INCLUDE STRUCTURE BAPISDITMX.

data : end of ORDER_ITEMS_INX.

data : begin of ORDER_CONDITIONS_IN occurs 0.

INCLUDE STRUCTURE BAPICOND.

data : end of ORDER_CONDITIONS_IN.

data : begin of ORDER_SCHEDULES_IN occurs 0.

INCLUDE STRUCTURE BAPISCHDL.

data : end of ORDER_SCHEDULES_IN.

data : begin of ORDER_CFGS_VALUE occurs 0.

INCLUDE STRUCTURE BAPICUVAL.

data : end of ORDER_CFGS_VALUE.

data : begin of ORDER_CFGS_REF occurs 0.

INCLUDE STRUCTURE BAPICUCFG.

data : end of ORDER_CFGS_REF.

data : begin of ORDER_CFGS_INST occurs 0.

INCLUDE STRUCTURE BAPICUINS.

data : end of ORDER_CFGS_INST.

data : begin of ORDER_CFGS_PART_OF occurs 0.

INCLUDE STRUCTURE BAPICUPRT.

data : end of ORDER_CFGS_PART_OF.

ORDER_CFGS_PART_OF-CONFIG_ID = '000010'.

ORDER_CFGS_PART_OF-PARENT_ID = '000010'.

ORDER_CFGS_PART_OF-INST_ID = '00000001'.

ORDER_CFGS_PART_OF-CLASS_TYPE = '300'.

ORDER_CFGS_PART_OF-OBJ_TYPE = 'MARA'.

ORDER_CFGS_PART_OF-OBJ_KEY = '000000000000000001'.

APPEND ORDER_CFGS_PART_OF.

ORDER_CFGS_INST-CONFIG_ID = '000010'.

ORDER_CFGS_INST-INST_ID = '00000001'.

ORDER_CFGS_INST-OBJ_TYPE = 'MARA'.

ORDER_CFGS_INST-CLASS_TYPE = '300'.

ORDER_CFGS_INST-OBJ_KEY = '000000000000000001'.

ORDER_CFGS_INST-QUANTITY = 1.

*ORDER_CFGS_INST-QUANTITY_UNIT = 'UN'.

*ORDER_CFGS_INST-COMPLETE = 'T'.

*ORDER_CFGS_INST-CONSISTENT = 'T'.

*ORDER_CFGS_INST-PERSIST_ID_TYPE = 'G'.

APPEND ORDER_CFGS_INST.

order_cfgs_ref-posex = '000010'.

order_cfgs_ref-config_id = '000010'.

order_cfgs_ref-root_id = '000010'.

APPEND order_cfgs_ref.

order_cfgs_value-config_id = '000010'.

order_cfgs_value-inst_id = '000010'.

ORDER_CFGS_VALUE-CHARC = 'VC_CORE'.

ORDER_CFGS_VALUE-VALUE = '22'.

append ORDER_CFGS_VALUE.

order_cfgs_value-config_id = '000010'.

order_cfgs_value-inst_id = '000010'.

ORDER_CFGS_VALUE-CHARC = 'VC_DIAMETER_INCH'.

ORDER_CFGS_VALUE-VALUE = '24'.

append ORDER_CFGS_VALUE.

ORDER_SCHEDULES_IN-ITM_NUMBER = '000010'.

ORDER_SCHEDULES_IN-REQ_QTY = '7.000'.

ORDER_SCHEDULES_IN-DLV_DATE = sy-datum.

append ORDER_SCHEDULES_IN.

order_header_in-DOC_TYPE = 'ZCAL'.

order_header_in-SALES_ORG = '1000'.

order_header_in-DISTR_CHAN = '01'.

order_header_in-DIVISION = '01'.

order_header_in-REQ_DATE_H = SY-DATUM.

order_header_in-REF_DOC = '0000100281'.

*order_header_in-REF_DOC_L = '0000100281'.

order_header_in-REFDOC_CAT = 'C'.

order_header_in-SALES_OFF = 'NO1'.

APPEND order_header_in.

order_partners-PARTN_ROLE = 'AG'.

order_partners-partn_numb = 'TEST'.

*order_partners-partn_numb = 'TEST'.

APPEND order_partners.

ORDER_ITEMS_IN-material = '000000000010100400'.

*ORDER_ITEMS_IN-po_itm_no = '000010'.

ORDER_ITEMS_IN-ITM_NUMBER = '000010'.

ORDER_ITEMS_IN-target_qty = '7.000'.

ORDER_ITEMS_IN-TARGET_QU = 'TO'.

ORDER_ITEMS_IN-T_UNIT_ISO = 'TO'.

ORDER_ITEMS_IN-plant = '1000'.

ORDER_ITEMS_IN-STORE_LOC = '0001'.

ORDER_ITEMS_IN-REF_DOC = '0000100281'.

ORDER_ITEMS_IN-REF_DOC_IT = '000001'.

ORDER_ITEMS_IN-REF_DOC_IT = 'C'.

ORDER_ITEMS_IN-RNDDLV_QTY = '7.000'.

ORDER_ITEMS_IN-ROUTE = 'TESTNO'.

APPEND ORDER_ITEMS_IN.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

EXPORTING

order_header_in = order_header_in

ORDER_HEADER_INX = ORDER_HEADER_INX

IMPORTING

SALESDOCUMENT = SALESDOCUMENT

TABLES

RETURN = RETURN

ORDER_ITEMS_IN = ORDER_ITEMS_IN

ORDER_ITEMS_INX = ORDER_ITEMS_INX

order_partners = order_partners

ORDER_SCHEDULES_IN = ORDER_SCHEDULES_IN

  • ORDER_SCHEDULES_INX = ORDER_SCHEDULES_INX

ORDER_CONDITIONS_IN = ORDER_CONDITIONS_IN

  • ORDER_CONDITIONS_INX = ORDER_CONDITIONS_INX

ORDER_CFGS_REF = ORDER_CFGS_REF

ORDER_CFGS_INST = ORDER_CFGS_INST

ORDER_CFGS_PART_OF = ORDER_CFGS_PART_OF

ORDER_CFGS_VALUE = ORDER_CFGS_VALUE

  • ORDER_CFGS_BLOB = ORDER_CFGS_BLOB

  • ORDER_CFGS_VK = ORDER_CFGS_VK

  • ORDER_CFGS_REFINST = ORDER_CFGS_REFINST

  • ORDER_CCARD = ORDER_CCARD

  • ORDER_TEXT = ORDER_TEXT

  • ORDER_KEYS = ORDER_KEYS

  • EXTENSIONIN = EXTENSIONIN

  • PARTNERADDRESSES = PARTNERADDRESSES

  • NFMETALLITMS = NFMETALLITMS

.

COMMIT WORK AND WAIT.

BREAK-POINT.