Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Create Sales Order using BAPI with Variant configurations

Former Member
0 Kudos
259

Hi All,

I need to create a sales order using BAPI BAPI_SALESORDER_CREATEFROMDAT2 with Varaint confiugartions. I will get Header ITEM and variant configuration items in the flat file. Kindly help me in this regard.

One more thing, is there any way to findout all the Varaint classifications for a particular Material?

I have done the below coding. Sales order is getting created but variant configurations are not populating.

*...Configuration: Reference Data

DATA: gt_order_cfgs_ref TYPE TABLE OF bapicucfg,

wa_order_cfgs_ref TYPE bapicucfg.

*...Configuration: Instances

DATA: gt_order_cfgs_inst TYPE TABLE OF bapicuins,

wa_order_cfgs_inst TYPE bapicuins.

*...Configuration: Part-of Specifications

DATA: gt_order_cfgs_part_of TYPE TABLE OF bapicuprt,

wa_order_cfgs_part_of TYPE bapicuprt .

*...Configuration: Characteristic Values

DATA: gt_order_cfgs_value TYPE TABLE OF bapicuval,

wa_order_cfgs_value TYPE bapicuval.

*...Configuration: BLOB Internal Data (SCE)

DATA: gt_order_cfgs_blob TYPE TABLE OF bapicublb ,

wa_order_cfgs_blob TYPE bapicublb.

*...Configuration: Variant Condition Key

DATA: gt_order_cfgs_vk TYPE TABLE OF bapicuvk,

wa_order_cfgs_vk TYPE bapicuvk.

*...Configuration: Reference Item / Instance

DATA: gt_order_cfgs_refinst TYPE TABLE OF bapicuref,

wa_order_cfgs_refinst TYPE bapicuref.

*...Configuration: Reference Data

wa_order_cfgs_ref-posex = '10'.

wa_order_cfgs_ref-config_id = '1'.

wa_order_cfgs_ref-root_id = '1'.

wa_order_cfgs_ref-SCE = '1'.

wa_order_cfgs_ref-CBASE_ID_TYPE = 'G'.

wa_order_cfgs_ref-CONSISTENT = 'T'.

wa_order_cfgs_ref-COMPLETE = 'T'.

APPEND wa_order_cfgs_ref TO gt_order_cfgs_ref.

*..2nd item

wa_order_cfgs_ref-posex = '20'.

wa_order_cfgs_ref-config_id = '2'.

wa_order_cfgs_ref-root_id = '1'.

wa_order_cfgs_ref-SCE = '1'.

wa_order_cfgs_ref-CBASE_ID_TYPE = 'G'.

wa_order_cfgs_ref-CONSISTENT = 'T'.

wa_order_cfgs_ref-COMPLETE = 'T'.

APPEND wa_order_cfgs_ref TO gt_order_cfgs_ref.

*...Configuration: Instances

wa_order_cfgs_inst-config_id = '1'.

wa_order_cfgs_inst-inst_id = '1'.

wa_order_cfgs_inst-obj_type = 'MARA'.

wa_order_cfgs_inst-class_type = '300'.

wa_order_cfgs_inst-obj_key = '2021B'.

wa_order_cfgs_inst-quantity = 1.

wa_order_cfgs_inst-PERSIST_ID_TYPE = 'G'.

wa_order_cfgs_inst-CONSISTENT = 'T'.

wa_order_cfgs_inst-COMPLETE = 'T'.

APPEND wa_order_cfgs_inst TO gt_order_cfgs_inst.

*..2nd item

wa_order_cfgs_inst-config_id = '2'.

wa_order_cfgs_inst-inst_id = '1'.

wa_order_cfgs_inst-obj_type = 'MARA'.

wa_order_cfgs_inst-class_type = '300'.

wa_order_cfgs_inst-obj_key = '2021B'.

wa_order_cfgs_inst-quantity = 1.

wa_order_cfgs_inst-PERSIST_ID_TYPE = 'G'.

wa_order_cfgs_inst-CONSISTENT = 'T'.

wa_order_cfgs_inst-COMPLETE = 'T'.

APPEND wa_order_cfgs_inst TO gt_order_cfgs_inst.

*...Configuration: Characteristic Values

wa_order_cfgs_value-config_id = '1'.

wa_order_cfgs_value-inst_id = '1'.

wa_order_cfgs_value-charc = 'BASIC_MACHINE'.

wa_order_cfgs_value-value = 'L28'.

wa_order_cfgs_value-VALCODE = '1'.

APPEND wa_order_cfgs_value TO gt_order_cfgs_value.

wa_order_cfgs_value-config_id = '1'.

wa_order_cfgs_value-inst_id = '1'.

wa_order_cfgs_value-charc = 'BUCKET'.

wa_order_cfgs_value-value = 'PL1001'.

wa_order_cfgs_value-VALCODE = '1'.

APPEND wa_order_cfgs_value TO gt_order_cfgs_value.

*..2nd item

wa_order_cfgs_value-config_id = '2'.

wa_order_cfgs_value-inst_id = '1'.

wa_order_cfgs_value-charc = 'BUCKET_FOC'.

wa_order_cfgs_value-value = '023OP0049'.

wa_order_cfgs_value-VALCODE = '1'.

APPEND wa_order_cfgs_value TO gt_order_cfgs_value.

wa_order_cfgs_value-config_id = '2'.

wa_order_cfgs_value-inst_id = '1'.

wa_order_cfgs_value-charc = 'BUCKET_HOE'.

wa_order_cfgs_value-value = '028MS0004'.

wa_order_cfgs_value-VALCODE = '1'.

APPEND wa_order_cfgs_value TO gt_order_cfgs_value.

  • wa_order_cfgs_value-config_id = '2'.

  • wa_order_cfgs_value-inst_id = '1'.

  • wa_order_cfgs_value-charc = 'TYRE_PRESSURE_GAUGE'.

  • wa_order_cfgs_value-value = '81004402'.

  • APPEND wa_order_cfgs_value TO gt_order_cfgs_value.

*...Configuration: Reference Item / Instance

wa_order_cfgs_refinst-posex = '10'.

wa_order_cfgs_refinst-config_id = '1'.

wa_order_cfgs_refinst-inst_id = '1'.

APPEND wa_order_cfgs_refinst TO gt_order_cfgs_refinst.

*..2nd item

wa_order_cfgs_refinst-posex = '20'.

wa_order_cfgs_refinst-config_id = '2'.

wa_order_cfgs_refinst-inst_id = '1'.

APPEND wa_order_cfgs_refinst TO gt_order_cfgs_refinst.

Regards,

Rajesh

1 REPLY 1

Former Member
0 Kudos
85

Hi all,

Please help me in solving the issue.

Rajesh