Application Development and Automation 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: 
Read only

Create Sales order Using BAPI

Former Member
0 Likes
2,308

Hi all

I have to build RFC Function Module to Create Sales order with Service Order

I am using the following FM

BAPI_SALESORDER_CREATEFROMDAT2

When i Pass Chareterestic value in Function Module Tables: ORDER_CFGS_VALUE

with

CHARC = 'ORDER_QTY'

VALUE = 25

and this charaterestic's is not getting updated in sales order and the rest information of sales order are updated and created. Kindly let me know how to update characterestic values in sales order

Thanks in Advance

Edited by: Senthil Ram Kumar Palanisamy Ganapathi on May 28, 2009 9:56 PM

12 REPLIES 12
Read only

Former Member
0 Likes
1,405

Hi,

check out these transactions BAPI:

VA01 BAPI_SALESORDER_CREATEFROMDAT2

VA02 BAPI_SALESORDER_CHANGE

Thanks,

Krishna..

Read only

Former Member
0 Likes
1,405

I've only used the characteristics on the sales order BAPI for variant configuration. In that case, I also had to set the "instance" in ORDER_CFGS_INST, which ties to the ORDER_CFGS_VALUE table through the INST_ID field.

Try setting up this table as well and setting an instance number, which I believe you can set yourself.

Hope this helps,

Mark

Read only

0 Likes
1,405

Hi Mark

Could u please provide a small Example.

Thanks

Read only

0 Likes
1,405

see the following link EXAMPLE OF BAPI_SALESORDER_CREATEFROMDAT2

http://www.sap-img.com/abap/bapi-salesorder-createfromdat2.htm

Read only

0 Likes
1,405

krupa jani

This Example Dosen't show any characterestic input. I need an Example to create Sales order with characterestic values.

Thanks

Read only

0 Likes
1,405

Could you provide SAP release which you are using. In our integration we are using two different RFCs for order creation for two different releases. I may help you providing code/suitable example.

Sudheer

Read only

Former Member
0 Likes
1,405

Here is a sample of code that sets up the characteristics for an item:

From my understanding the values of the config id and instance id numbers are critical, just that they differ from other items on the same order that also have characteristics.

You will probably need to change the class type from 300 to 001, as 300 is for variant config and 001 is for material characteristics.

Also - you probably don't need to worry about the section related to the BOM, this code is for sales order items with a sales bill of material.

Sorry - I could not get thsi to format as code...

*&---------------------------------------------------------------------*
*&      Form  order_create_vc_set
*&---------------------------------------------------------------------*
*       Set up required information for VC-item with BAPI.
*----------------------------------------------------------------------*
*      -->P_ITEM         Item number of top-level being added.
*      <--P_CONFIG_ID
*      <--P_INSTANCE_ID
*----------------------------------------------------------------------*
form order_create_vc_set  changing p_item        type posnr_va
                                   p_config_id   type cux_cfg_id
                                   p_instance_id type cu_inst_id.

  data: lv_instance_id_hldr type cu_inst_id.

*** Set up VC data.
  move: p_item to gs_order_item-po_itm_no,
        c_true to gs_order_itemx-po_itm_no.

  add 1 to p_config_id.

add 1 to p_instance_id.

  clear gs_order_cfgs_ref.
  move: p_item        to gs_order_cfgs_ref-posex,
        p_config_id   to gs_order_cfgs_ref-config_id,
        p_instance_id to gs_order_cfgs_ref-root_id.
  append gs_order_cfgs_ref to gt_order_cfgs_ref.

  move p_instance_id to lv_instance_id_hldr.

  move: p_config_id           to gs_order_cfgs_inst-config_id,
        p_instance_id         to gs_order_cfgs_inst-inst_id,
        'MARA'                to gs_order_cfgs_inst-obj_type,
        '300'                 to gs_order_cfgs_inst-class_type,
        gs_so_item_in-article to gs_order_cfgs_inst-obj_key.
  append gs_order_cfgs_inst to gt_order_cfgs_inst.

*** Set up components of BOM.
  loop at gt_comp into gs_comp.

    clear: gs_order_cfgs_inst, gs_order_cfgs_part_of.

add 1 to p_instance_id.

move: p_config_id   to gs_order_cfgs_inst-config_id,
          p_instance_id to gs_order_cfgs_inst-inst_id,
          'MARA'        to gs_order_cfgs_inst-obj_type,
          gs_comp-matnr to gs_order_cfgs_inst-obj_key.
    append gs_order_cfgs_inst to gt_order_cfgs_inst.

    move: p_config_id         to gs_order_cfgs_part_of-config_id,
          lv_instance_id_hldr to gs_order_cfgs_part_of-parent_id,
          p_instance_id       to gs_order_cfgs_part_of-inst_id,
          gs_comp-posnr       to gs_order_cfgs_part_of-part_of_no,
          'MARA'              to gs_order_cfgs_part_of-obj_type,
          gs_comp-matnr       to gs_order_cfgs_part_of-obj_key.
    add 10 to p_item.
    append gs_order_cfgs_part_of to gt_order_cfgs_part_of.

endloop.

  loop at gt_config assigning <fs_config> where item = gs_so_item_in-item.

    clear gs_order_cfgs_value.
    move: p_config_id         to gs_order_cfgs_value-config_id,
          lv_instance_id_hldr to gs_order_cfgs_value-inst_id,
          <fs_config>-optn    to gs_order_cfgs_value-charc,
          <fs_config>-value   to gs_order_cfgs_value-value.

    append gs_order_cfgs_value to gt_order_cfgs_value.
  endloop.

endform.                    " order_create_vc_set

Hope this helps,

Mark

Edited by: Mark Schwendinger on Jun 1, 2009 6:15 PM

Edited by: Mark Schwendinger on Jun 1, 2009 6:17 PM

Edited by: Mark Schwendinger on Jun 1, 2009 6:19 PM

Edited by: Mark Schwendinger on Jun 1, 2009 6:21 PM

Edited by: Mark Schwendinger on Jun 1, 2009 6:28 PM

Read only

0 Likes
1,405

Hi

It is not working. Kindly give me an example to create sales order with characterestics.

Thanks

Read only

Former Member
0 Likes
1,405

Resolved Myself

Read only

0 Likes
1,405

Hi Senthil,

Already Rob suggested u that, u need not to say that, u resolved ur self EXPLICITLY........bcoz, all the other REAL threads will go down!!! Hope u will not do the same in the future.

thanq

Read only

0 Likes
1,405

Hi ABAPer

I have reolved the question and dont want to keep the thread open. I marked this thread as answered and need to give some reason for closing the thread since i have already resolved. I dont want people answering for this thread. If you provide solution to handle this and I will take care.

Thanks

Read only

0 Likes
1,405

How did you resolve your problem?