Skip to Content
author's profile photo
Former Member

BAPI_SALESORDER_CREATEFROMDAT2 - Configurating Items

Hi everybody!

Now i'm trying to create an order but configurating some items, i'm testing the BAPI at SE37, when i test the BAPI it gives me the order number but the configuration in the item WHERE i SEND the data is not made, I give YOU the parameters i'm sending , i hope somebody can help me!.

I'm not sure if the OBJ_KEY i'm sending is ok, because i've tried with MARA-CUOBF , item number, and it creates the order but without any configuration in the item i need (number 2), also i have doubt about the CONFIG_ID , INST_ID AND ROOT_ID i'm sending, because i copied them from another topic here in SDN related with Configuratim Items with BAPI.

I'll be very grateful if somebody answer me.

Greetings

Soraya.

<b>ORDER_ITEMS_IN </b>

ITM_NUMBER - 000001

MATERIAL - PC0902400097

TARGET_QTY - 3,000.00

ITM_NUMBER - 000002

MATERIAL - AC0162500005

TARGET_QTY - 35,000.00

ITM_NUMBER - 000003

MATERIAL - ZEE06CC14002

TARGET_QTY - 300

ITM_NUMBER - 000004

MATERIAL - ZCCM12514037

TARGET_QTY - 10,000.00

<b>ORDER_SCHEDULES_IN</b>

ITM_NUMBER - 000001

SCHED_LINE - 0001

REQ_DATE - 26.09.2005

REQ_QTY - 3,000.00

ITM_NUMBER - 000002

SCHED_LINE - 0001

REQ_DATE - 26.09.2005

REQ_QTY - 35,000.00

ITM_NUMBER - 000003

SCHED_LINE - 0001

REQ_DATE - 26.09.2005

REQ_QTY - 300

ITM_NUMBER - 000004

SCHED_LINE - 0001

REQ_DATE - 26.09.2005

REQ_QTY - 10,000.00

<b>ORDER_CFGS_REF </b>

POSEX - 000002

CONFIG_ID - 000001

ROOT_ID - 00000001

<b>ORDER_CFGS_INST </b>

CONFIG_ID - 000001

INST_ID - 00000001

OBJ_TYPE - MARA

CLASS_TYPE - 300

OBJ_KEY - AC0162500005

QUANTITY - 1

<b>ORDER_CFGS_PART_OF</b>

CONFIG_ID - 000001

PARENT_ID - 00000001

INST_ID - 00000001

OBJ_TYPE - MARA

CLASS_TYPE - 300

OBJ_KEY - AC0162500005

<b>ORDER_CFGS_VALUE</b>

CONFIG_ID - 000001

INST_ID - 00000001

CHARC - CVA_USFI

CHARC_TXT - USO FINAL

VALUE - 0000

VALUE_TXT - SIN USO

<b>ORDER_CFGS_REFINST </b>

POSEX - 000002

CONFIG_ID - 000001

INST_ID - 00000001

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    author's profile photo
    Former Member
    Sep 27, 2005 at 07:52 AM

    Hi!

    You can proceed as follows:

    1. Create sales order using VA01 with structure of interest (with configurable material)

    2. Call BAPISDORDER_GETDETAILEDLIST for created sales order and check the structure of interface tables

    3. Fill accordingly interface tables for BAPI_SALESORDER_CREATEFROMDAT2 - they have near the same structure and meaning

    4. Call BAPI_SALESORDER_CREATEFROMDAT2 (don't forget to call BAPI_TRANSACTION_COMMIT afterwards)

    Check you have OSS note 821191 installed on your system - otherwise BAPISDORDER_GETDETAILEDLIST can function inappropriately.

    Regards,

    Maxim.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Sep 28, 2005 at 03:08 AM

    Hi,

    I am attaching the code which i have used for creating SO with configuration data.

    Enter proper input data for header ,partner,item and configuration data .This works properly In 4.7 R/3.

    Just give it a try

    *&----


    *& Report ZKKK_CREATE_SO_WITHCONFIG *

    *& *

    &----


    *& *

    *& *

    &----


    report ZKKK_CREATE_SO_WITHCONFIG .

    tables : mast.

    data : it_header like bapisdhd1.

    data : it_part like bapiparnr occurs 0 with header line,

    it_item like bapisditm occurs 0 with header line,

    it_itemx like bapisditmx occurs 0 with header line,

    it_sched like bapischdl occurs 0 with header line,

    it_schedx like bapischdlx occurs 0 with header line,

    it_ret like bapiret2 occurs 0 with header line,

    inst_tab like comw occurs 0 with header line.

    data: order_cfgs_inst like bapicuins occurs 0 with header line,

    order_cfgs_part_of like bapicuprt occurs 0 with header line,

    order_cfgs_refinst like bapicuref occurs 0 with header line,

    order_cfgs_value like bapicuval occurs 0 with header line,

    order_cfgs_ref like bapicucfg occurs 0 with header line.

    data : instance like marc-cuobj,

    charname like cabn-atnam,

    docno like vbak-vbeln,

    wait_time like bapita-wait.

    data : p_vbeln type vbap-vbeln,

    p_posnr type vbap-posnr,

    p_aennr type aennr,

    p_datuv type sy-datum. "636181

    data: lv_no_restricted_profile type c,

    lv_no_restricted_level type c,

    lv_delay type i,

    lv_waitingtime type i,

    lv_tries type i,

    ls_return like bapireturn,

    lt_instances like standard table of bapicuivb.

    data : v_vbeln like vbak-vbeln,

    v_posnr like vbap-posnr,

    v_matnr like vbap-matnr,

    v_werks like vbap-werks,

    v_text(50).

      • header data

      it_header-doc_type = 'ZVOR'.

      it_header-sales_org = '45'.

      it_header-distr_chan = 'DI'.

      it_header-division = '00'.

      it_header-purch_no_c = 'test'.

      it_header-purch_date = '20050225'.

        • partner data

        it_part-partn_role = 'AG'.

        it_part-partn_numb = 'LU123'.

        append it_part.

        **item data

        it_item-itm_number = '000010'.

        it_item-po_itm_no = '000010'.

        it_item-material = 'GA01202AF03WAS_001'.

        it_item-plant = 'MPK'.

        append it_item.

        it_item-itm_number = '000011'.

        it_item-po_itm_no = '000011'.

        it_item-material = 'SUBITEM_GH'.

        it_item-plant = 'MPK'.

        it_item-hg_lv_item = '10'.

        append it_item.

        *****

        it_itemx-itm_number = '000010'.

        it_itemx-material = 'X'.

        it_itemx-plant = 'X'.

        append it_itemx.

        it_itemx-itm_number = '000011'.

        it_itemx-material = 'X'.

        it_itemx-plant = 'X'.

        append it_itemx.

        it_sched-itm_number = '000010'.

        it_sched-sched_line = '0001'.

        it_sched-req_qty = '1.000'.

        it_sched-req_date = sy-datum.

        append it_sched.

        it_schedx-itm_number = '000010'.

        it_schedx-sched_line = '0001'.

        it_schedx-req_qty = 'X'.

        it_schedx-req_date = sy-datum.

        append it_schedx.

          • configuration data

          clear order_cfgs_refinst.

          refresh order_cfgs_refinst.

          order_cfgs_refinst-posex = '000011'.

          order_cfgs_refinst-config_id = '000011'.

          order_cfgs_refinst-inst_id = '00000001'.

          append order_cfgs_refinst.

          clear order_cfgs_ref.

          refresh order_cfgs_ref.

          order_cfgs_ref-posex = '000011'.

          order_cfgs_ref-config_id = '000011'.

          order_cfgs_ref-root_id = '00000001'.

          append order_cfgs_ref.

          clear order_cfgs_inst.

          refresh order_cfgs_inst.

          order_cfgs_inst-config_id = '000011'.

          order_cfgs_inst-inst_id = '00000001'.

          order_cfgs_inst-obj_type = 'MARA'.

          order_cfgs_inst-class_type = '300'.

          order_cfgs_inst-obj_key = 'SUBITEM_GH'.

          append order_cfgs_inst.

          ******

          clear order_cfgs_value.

          refresh order_cfgs_value.

          order_cfgs_value-config_id = '000011'.

          order_cfgs_value-inst_id = '00000001'.

          order_cfgs_value-charc = 'ACT_TYPE'.

          order_cfgs_value-value = 'B'.

          append order_cfgs_value.

          order_cfgs_value-config_id = '000011'.

          order_cfgs_value-inst_id = '00000001'.

          order_cfgs_value-charc = 'ACT_MODEL'.

          order_cfgs_value-value = 'A'.

          append order_cfgs_value.

          ******

          call function 'BAPI_SALESORDER_CREATEFROMDAT2'

          exporting

          • SALESDOCUMENTIN =

          order_header_in = it_header

          • ORDER_HEADER_INX =

          • SENDER =

          • BINARY_RELATIONSHIPTYPE =

          • INT_NUMBER_ASSIGNMENT =

          • BEHAVE_WHEN_ERROR =

          • LOGIC_SWITCH =

          • TESTRUN =

          • CONVERT = ' '

          importing

          salesdocument = docno

          tables

          return = it_ret

          order_items_in = it_item

          order_items_inx = it_itemx

          order_partners = it_part

          order_schedules_in = it_sched

          order_schedules_inx = it_schedx

          • ORDER_CONDITIONS_IN = IT_COND

          • ORDER_CONDITIONS_INX = IT_CONDX

          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_VK =

          order_cfgs_refinst = order_cfgs_refinst

          • ORDER_CCARD =

          • ORDER_TEXT =

          • ORDER_KEYS =

          • EXTENSIONIN =

          • PARTNERADDRESSES =

          .

          break-point.

          loop at it_ret.

          write:/ it_ret-message.

          endloop.

          wait_time = '1'.

          call function 'BAPI_TRANSACTION_COMMIT'

          exporting

          wait = wait_time.

          • IMPORTING

          • RETURN =

          break-point.

          loop at it_ret.

          endloop.

          Add comment
          10|10000 characters needed characters exceeded

          • Former Member

            Hi Karthik!

            I'm sending exactly the same parameters you sent, but with my data of course, but anyway doesn't configure the item with the characteristic i need, maybe is the version, don't you think?, because we have 4.6B version.

            I'm gonna try with another solution to configure those items when creating a salesorder via BAPI.

            Thanks a lot !

            Regards

            Soraya

        • author's profile photo
          Former Member
          Sep 30, 2005 at 02:05 PM

          Hi Soraya ,

          The 4.6B version has been found to create problems when using the BAPI_SALESORDER_CREATEFROMDAT2 function module,coz i tried the same with 4.6b and it just creates the sales order but doesnot attach the configuration.Also the bapi return doesnot give any error message.Is this the ame prob you are facing or you are getting some other kinda error?

          What i would suggest is that you create a material and attach the configuration (in mrp3 view) and just use the material as item in your sales order.This i think should solve your problem.Please let me know is this works or if you get some other approach.

          Byee

          Add comment
          10|10000 characters needed characters exceeded