Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Characteristics Value Upload through BAPI_SALESORDER_CREATEFROMDAT2

Hi All,

I am trying to upload Sales Order for Variant Item. I am not able to save its characteristic though I am passing all required detail.

Below is my Sample Code through which I am uploading. Sales Order is getting generated but no characteristics value is going ...

&----


*& Report ZTEST_CREATE_VC_ORDER

*&

&----


*&

*&

&----


REPORT ztest_create_vc_order.

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_items_in-itm_number = '000010'.

order_items_in-material = 'MA11M433G'.

order_items_in-plant = '2010'.

order_items_in-target_qty = '1.000'.

order_items_in-po_itm_no = 'Test'.

order_items_inx-itm_number = '000010'.

order_items_inx-material = 'X'.

order_items_inx-plant = 'X'.

order_items_inx-target_qty = 'X'.

order_items_inx-po_itm_no = 'X'.

APPEND order_items_in.

order_partners-partn_role = 'AG'.

order_partners-partn_numb = '0000100000'.

APPEND order_partners.

order_header_in-doc_type = 'ZOMF'.

order_header_in-purch_no_c = 'TEST'.

order_header_in-sales_org = '1000'.

order_header_in-distr_chan = '10'.

order_header_in-division = '10'.

order_header_in-req_date_h = sy-datum.

order_header_in-incoterms1 = 'EXW'.

order_header_in-incoterms2 = 'Tushar Abhyakar XXX'.

order_header_in-pmnttrms = '0000'.

APPEND order_header_in.

order_header_inx-doc_type = 'X'.

order_header_inx-sales_org = 'X'.

order_header_inx-distr_chan = 'X'.

order_header_inx-division = 'X'.

order_header_inx-purch_no_c = 'X'.

order_header_inx-req_date_h = 'X'.

order_header_inx-incoterms1 = 'X'.

order_header_inx-incoterms2 = 'X'.

order_header_inx-pmnttrms = 'X'.

APPEND order_header_inx.

order_cfgs_part_of-config_id = '000001'.

order_cfgs_part_of-parent_id = '00000001'.

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 = '000001'.

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.

APPEND order_cfgs_inst.

order_cfgs_ref-posex = '000010'.

order_cfgs_ref-config_id = '000001'.

order_cfgs_ref-root_id = '00000001'.

APPEND order_cfgs_ref.

order_cfgs_value-config_id = '000001'.

order_cfgs_value-inst_id = '00000001'.

order_cfgs_value-charc = 'MOTOTYPE'.

order_cfgs_value-value = 'A'.

APPEND order_cfgs_value.

order_schedules_in-itm_number = '000010'.

order_schedules_in-req_qty = '1.000'.

order_schedules_in-dlv_date = sy-datum.

APPEND order_schedules_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_conditions_in = order_conditions_in

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.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Thanks in Advance.

Rgds

Bhavin Shah

Not what you were looking for? View more on this topic or Ask a question