Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 

Introduction:


In this blog post auto creation of sales order in SAP ECC for third party e-commerce portals, which has been tagged as combi products.

Requirement:


All the E-commerce sales to be captured using flat files, Industry doesn't want to have sales bom for combo products.

Abstract:


Reading Flat files downloaded from e-comm site to be read and stored in internal table, all the Customer Material code (ASIN/FSN code) are maintained in Customer Info Record for respective material, the shipping charges and trade discount for both Combi Material and FG material are calculated using BAPI_SALESORDER_SIMULATE and for sales order creation using BAPI_SALESORDER_CREATEFROMDAT2.

Once all customer material Code in customer info for material has been maintained.

Approach:


To handle this there are two different ways one is creating a production order for combi product and bringing final combo's to Sales order --> OBD --> PGI --> Invoice --> Accounting entry post.

As per requirement this option has been selected by business people stating that exploring the BOM of combos and creating a sales order based on BOM.



Since all e-comm sales being captured to an one time customer, customer number has been given in selection screen.
  CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
capid = 'XXXX'
datuv = sy-datum
mktls = 'X'
mehrs = 'X'
mmory = '1'
mtnrv = wa_knmt-matnr
werks = 'XXXX'
TABLES
stb = it_mast
matcat = it_matcat
EXCEPTIONS
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
OTHERS = 8.


Simulation :

CALL FUNCTION 'BAPI_SALESORDER_SIMULATE'
EXPORTING
order_header_in = order_header_in_s
IMPORTING
salesdocument = salesdocument_s
return = return_s
TABLES
order_items_in = order_items_in_s[]
order_partners = order_partners_s[]
order_schedule_in = order_schedule_in_s[]
order_items_out = order_items_out_s[]
order_schedule_ex = order_schedule_ex_s[]
order_condition_ex = order_condition_ex_s[].

 

before the simulation physical inventory check is enabled through a submit program.
  CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
* SALESDOCUMENTIN =
order_header_in = order_header_in
order_header_inx = wa_header_chk
* SENDER =
* BINARY_RELATIONSHIPTYPE =
* INT_NUMBER_ASSIGNMENT =
* BEHAVE_WHEN_ERROR =
* LOGIC_SWITCH =
* testrun = 'X'
convert = 'X'
IMPORTING
salesdocument = salesdocument
TABLES
return = return[]
order_items_in = order_items_in[]
order_items_inx = it_item_chk[]
order_partners = order_partners[]
order_schedules_in = order_schedules_in[]
order_schedules_inx = it_sch_chk[]
order_conditions_in = order_bapicond[]
* ORDER_CONDITIONS_INX =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CFGS_BLOB =
* ORDER_CFGS_VK =
* ORDER_CFGS_REFINST =
* ORDER_CCARD =
* ORDER_TEXT =
* order_keys = order_keys
* EXTENSIONIN =
* PARTNERADDRESSES =

 

Conclusion :


By this integration time taken for end user to punch records came down and made the system error free.