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 Fill Configuration Data in BAPI BAPI_SALESORDER_CREATEFROMDAT2

Former Member
0 Kudos
3,584

I have a Variant Configurable material named X.

The structure of this VC material is

Material X has charatcertics CH1 and CH2.

CH1 has values VAL11 and VAL12

CH2 has values VAL21 and VAL22

Again VAL11 , VAL12, VAL21 and VAL22 are individual materials for this BOM X.

Now I need to generate a Sales Order for this material using BAPI_SALESORDER_CREATEFROMDAT2. How should I fill the configuration data for this material in the following tables

ORDER_CFGS_REF

ORDER_CFGS_INST

ORDER_CFGS_VALUE

Do I also need to fill the following tables for this VC material X?

ORDER_CFGS_PART_OF

ORDER_CFGS_BLOB

ORDER_CFGS_VK

ORDER_CFGS_REFINST

I donu2019t know for this configurable material X what all configuration tables of the BAPI BAPI_SALESORDER_CREATEFROMDAT2 and how I should I fill , I mean with what values?

I am stuck with this information. I tried filling the tables with data that i know but it does not work...i am not sure how to fill the configuration details in this BAPI for this VC material X.

Some one please suggest? Any help will be highly apreciated.

Regards,

Jessica.sam

Edited by: jessica sam on Jan 9, 2009 12:45 AM

Edited by: jessica sam on Jan 9, 2009 2:13 AM

Edited by: jessica sam on Jan 9, 2009 3:46 PM

7 REPLIES 7

former_member181995
Active Contributor
0 Kudos
652

Check Function module VELO11_CUOR_EXECUTE code at line 682/705/706/708, here in same FM all the configuration tables has been filled. Just see the coding; you might get help from there.

0 Kudos
652

Thanks Amit,

I will check the function module..Any idea why this function module is used? because i am not seeing any documentation and i dont know how to execute it..i mean with what input values...

Regards,

Jessica.

0 Kudos
652

Jassica,

I really dont know whats the purpose of that FM though i'm not login into SAP.But I only suggest that so you can take help from FM,and atleast have an idea how to fill these tables.

Have a nice weekend.

Cheers,

Amit.

0 Kudos
652

you would need miimum of 3 segments to pass variant config data using this bapi

ORDER_CFGS_REF for each configurable item

POSEX = ITEM #

CONFIG_id , root_id - Start with 1 and increment it for each configurable line item

ORDER_CFGS_INST

CONFIG_ID - from above

INST_ID - Start with 1 and increment it for each configurable line item

OBJ_TYPE = "MARA'

CLASS_TYPE = '300'

OBJ_KEY = material #

ORDER_CFGS_VALUE

CONFIG_ID for the item, INST_ID for the item

charc for characteristic value

VALUE for characteristic value

0 Kudos
652

Hi MXG and Amit,

I created a sales order manually from VA01 using configurable material and read the values of all configuration tables to be filled from BAPISDORDER_GETDETAILEDLIST. With the help of this data i got an idea how to fill the tables of BAPI BAPI_SALESORDER_CREATEFROMDAT2. But still i am able to create a sales order but the configuration data that i give is not getting populated in the sales order.

Where am i missing. please some body suggest. I am unable to debug and searched the forums

for this information but dint find solution for my problem. some body please tell me where am i missing?

Any help would be highly appreciated

Here is my code.


*************  Populate order header details, WA_ORDER_HEADER_IN *****************

    wa_order_header_in-doc_type    = wa_header-auart.    "Document Type
    wa_order_header_in-purch_no_c  = wa_header-bstkd.  "PO Numer 
    wa_order_header_in-sales_org   = wa_header-vkorg.    "Sales Organization
    wa_order_header_in-distr_chan  = wa_header-vtweg.   "Dristibution Channel
    wa_order_header_in-division    = wa_header-spart.      "Division
    wa_order_header_in-req_date_h  = wa_header-vdatu.   "Required Date
   
************* Populate order header flags,WA_ORDER_HEADER_INX
*    wa_order_header_inx-updateflag  = c_init.
    wa_order_header_inx-sales_org   = 'U'.
    wa_order_header_inx-distr_chan  = 'U'.
    wa_order_header_inx-division    = 'U'.
    wa_order_header_inx-purch_no_c  = 'U'.
    wa_order_header_inx-req_date_h  = 'U'.
   
******************** Populate Order item details and flags*****************
    LOOP AT i_item INTO wa_item.

      l_posnr = l_posnr + 10.
      l_posex = l_posex + 10.

      wa_order_items_in-po_itm_no = wa_cfg_cfg-posex.

      wa_order_items_in-po_itm_no = WA_CFG_REFINST-POSEX.

      wa_order_items_in-itm_number = l_posnr.                         "Item Number
      wa_order_items_in-po_itm_no  = l_posex.                         "POSEX required entry during configuration
      wa_order_items_in-material   = wa_item-matnr.                  "Populate material number
      APPEND wa_order_items_in TO i_order_items_in.
      CLEAR wa_order_items_in.

      wa_order_items_inx-itm_number = l_posnr.                      "Item Number
*      wa_order_items_inx-po_itm_no  = l_posex.                "POSEX required entry during configuration
      wa_order_items_inx-po_itm_no  = 'X'.
      wa_order_items_inx-material   = 'U'.                          "Populate material update flag
      APPEND wa_order_items_inx TO i_order_items_inx.
      CLEAR wa_order_items_inx.

      wa_order_schedules_in-itm_number = l_posnr.
      wa_order_schedules_in-req_qty    = wa_item-kwmeng.               "Populate quantity
      WA_ORDER_SCHEDULES_IN-SCHED_LINE =  '1'.
      APPEND wa_order_schedules_in TO i_order_schedules_in.
      CLEAR wa_order_schedules_in.

      wa_order_schedules_inx-itm_number = 'U'.
      wa_order_schedules_inx-req_qty = 'U'.                         "Populate quantity flag
      WA_ORDER_SCHEDULES_IN-SCHED_LINE  =  'U'.
      APPEND wa_order_schedules_inx TO i_order_schedules_inx.
      CLEAR wa_order_schedules_inx.

********* Filling ORDER_CFGS_REFINST of type BAPICUREF with work area WA_CFG_REFINST
 WA_CFG_REFINST-POSEX = l_posnr.
 WA_CFG_REFINST-CONFIG_ID = '000001'.
 WA_CFG_REFINST-INST_ID = '00000001'.
 APPEND  WA_CFG_REFINST TO  I_CFG_REFINST.
 CLEAR  WA_CFG_REFINST.

*********Filling ORDER_CFGS_REF  of type BAPICUCFG with work area wa_cfg_cfg
      wa_cfg_cfg-posex = l_posnr.
      wa_cfg_cfg-config_id = '000001'.
      wa_cfg_cfg-root_id = '00000001'.
      wa_cfg_cfg-COMPLETE = 'T'.
      wa_cfg_cfg-CONSISTENT = 'T'.
      APPEND wa_cfg_cfg TO i_cfg_cfg.
      CLEAR wa_cfg_cfg.

***ORDER_CFGS_INST  of type BAPICUINS with work area wa_cfg_inst
      wa_cfg_inst-config_id     =  '000001'.                              "External configuration ID (temporary)
      wa_cfg_inst-inst_id       =  '00000001'.                              "Instance number in the configuration
      wa_cfg_inst-obj_type      =  'MARA'.                           "Object type
      wa_cfg_inst-class_type    =  '300'.                            "Class type
       wa_cfg_inst-obj_key       =  wa_item-matnr.         " Object key
        wa_cfg_inst-quantity      = wa_item-kwmeng.     "Instance Quantity
      wa_cfg_inst-QUANTITY_UNIT = 'OZ'.
      wa_cfg_inst-COMPLETE = 'T'.
      wa_cfg_inst-CONSISTENT = 'T'.
      APPEND wa_cfg_inst TO i_cfg_inst.
      CLEAR wa_cfg_inst.

*********ORDER_CFGS_VALUE  of type BAPICUVAL with work area wa_cfg_val
*** for CHARCTERISTIC1
      CLEAR wa_cfg_val.
      wa_cfg_val-config_id = '000001'.                             "External configuration ID (temporary)
      wa_cfg_val-inst_id = '00000001'.                              "Instance number in the configuration
      wa_cfg_val-charc = 'CHARCTERISTIC1'.                  "Characteristic Name
      wa_cfg_val-value = 'VALUE1'.                                  "Characteristic Value
      wa_cfg_val-VALCODE = '1'.                                     "Value Type: Interval Limits - Single Values
      APPEND wa_cfg_val TO i_cfg_val.
      CLEAR wa_cfg_val.

*** for CHARCTERISTIC2
      wa_cfg_val-config_id = '000001'.                          "External configuration ID (temporary)
      wa_cfg_val-inst_id = '00000001'.                          "Instance number in the configuration
      wa_cfg_val-charc = 'CHARCTERISTIC2'.               "Characteristic Name
      wa_cfg_val-value = 'VALUE2'.                              "Characteristic Value
      wa_cfg_val-VALCODE = '1'.                                  "Value Type: Interval Limits - Single Values
      APPEND wa_cfg_val TO i_cfg_val.
       CLEAR wa_cfg_val.
      
      CLEAR wa_item.
    ENDLOOP.

******************************** Populate partner details********************************

    wa_order_partners-partn_role = 'AG'.
    wa_order_partners-partn_numb = wa_header-zkunnr.

    APPEND wa_order_partners TO i_order_partners.
    CLEAR wa_order_partners.


********Create a sales order using BAPI_SALESORDER_CREATEFROMDAT2***********

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
  EXPORTING
    ORDER_HEADER_IN               = WA_ORDER_HEADER_IN
    ORDER_HEADER_INX              = WA_ORDER_HEADER_INX
  IMPORTING
    SALESDOCUMENT                 = L_SALES
  TABLES
    RETURN                        = I_RETURN
    ORDER_ITEMS_IN                = I_ORDER_ITEMS_IN
    ORDER_ITEMS_INX               = I_ORDER_ITEMS_INX
    ORDER_PARTNERS                = I_ORDER_PARTNERS
    ORDER_SCHEDULES_IN            = I_ORDER_SCHEDULES_IN
    ORDER_SCHEDULES_INX           = I_ORDER_SCHEDULES_INX
    ORDER_CFGS_REF                = I_CFG_CFG
    ORDER_CFGS_INST               = I_CFG_INST
    ORDER_CFGS_VALUE              = I_CFG_VAL
*    ORDER_CFGS_VK                 = I_CFG_VK
    ORDER_CFGS_REFINST            = I_CFG_REFINST.

*   Commit BAPI
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Regards,

Jessica.sam

Edited by: jessica sam on Apr 3, 2009 1:21 PM

Former Member
0 Kudos
652

Thanks to all for valuable suggestion

0 Kudos
652

Hi jessica

how are you.

were you able to resolve your issue.?

can you please help me out as im also stuck in same thing

I have following characteristics maintain

LENGTH

REELSIZE

DENSITY

CORE_DIA

USAGE

HEAT_SEAL

SURF_TREAT

WET_TENSION

unable to update the order item with following details.

Regards

Saad Khatib