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: 

Configure Materials using BAPI

thomasalexander_ritter
Active Contributor
0 Kudos

Hi,

I am trying to create a quotation in our system using the BAPI: BAPI_QUOTATION_CREATEFROMDATA2. Everything works fine when I use materials which don't have to be configured. Unfortunately I have only materials which need a configuration. So I took a look at the function module documentation but it is not very helpful. It just states that I have to fill the tables QUOTATION_CFGS_REF, QUOTATION_CFGS_INST, QUOTATION_CFGS_PART_OF and QUOTATION_CFGS_VALUE. I did some testing but wasn't able to get it working. The quotation gets created but without my item and the BAPI doesn't return any error messages. Does anybody know how I have to fill these tables? Example code would be great.

At the moment I fill the tables like this:

wa_item-itm_number = 10.

wa_item-material = 'MYMATERIAL'.

wa_item-SALES_UNIT = 'ST'.

wa_item-inst_id = 1.

wa_item-config_id = 1.

insert wa_item into table tab_items.

wa_items_sched-itm_number = 10.

wa_items_sched-req_qty = 1.

insert wa_items_sched into table tab_items_sched.

wa_quote_ref-posex = 10.

wa_quote_ref-root_id = 1.

wa_quote_ref-config_id = 1.

insert wa_quote_ref into table tab_quote_ref.

wa_quote_inst-inst_id = 1.

wa_quote_inst-config_id = 1.

wa_quote_inst-obj_type = 'MARA'.

wa_quote_inst-class_type = 300.

wa_quote_inst-obj_key = 'MYMATERIAL'.

wa_quote_inst-quantity = 1.

insert wa_quote_inst into table tab_quote_inst.

wa_quote_value-config_id = 1.

wa_quote_value-inst_id = 1.

wa_quote_value-charc = 'XXXXX'.

wa_quote_value-value = 10.

wa_quote_value-author = 7.

insert wa_quote_value into table tab_quote_value.

call function 'BAPI_QUOTATION_CREATEFROMDATA2'

EXPORTING

quotation_HEADER_IN = t_order_header_in

IMPORTING

SALESDOCUMENT = quotationnumber

TABLES

QUOTATION_ITEMS_IN = tab_items

QUOTATION_SCHEDULES_IN = tab_items_sched

QUOTATION_PARTNERS = tab_order_partnr

QUOTATION_CFGS_REF = tab_quote_ref

QUOTATION_CFGS_INST = tab_quote_inst

QUOTATION_CFGS_PART_OF = tab_quote_partof

QUOTATION_CFGS_VALUE = tab_quote_value

return = return.

regards

Thomas

1 ACCEPTED SOLUTION

Former Member
0 Kudos

I copied your code into my system and made a few changes and got it to work. You are right, you don't need the 'x' structures. The main thing that made it work, was removing inst_id and config from wa_item. Here is the code.


  data: tab_items_inx type table of BAPISDITMX,
        wa_items_inx type BAPISDITMX.

  data: tab_schedules_inx type table of BAPISCHDLX,
        wa_schedules_inx type BAPISCHDLX.

  data: t_quote_header_in type BAPISDHD1.

  data: tab_items type table of BAPISDITM,
        wa_item type BAPISDITM.

  data: tab_items_sched type table of BAPISCHDL,
        wa_items_sched type BAPISCHDL.

  data: tab_quote_ref type table of BAPICUCFG,
        wa_quote_ref like line of tab_quote_ref.

  data: tab_quote_refinst type table of BAPICUREF,
        wa_quote_refinst type BAPICUREF.

  data: tab_quote_inst type table of BAPICUINS,
        wa_quote_inst like line of tab_quote_inst.

  data: tab_quote_partof type table of BAPICUPRT,
        wa_quote_partof like line of tab_quote_partof.

  data: tab_quote_value type table of BAPICUVAL,
        wa_quote_value like line of tab_quote_value.

  data: wa_quote_partnr type BAPIPARNR,
        tab_quote_partnr type table of BAPIPARNR.

  data return type table of BAPIRET2.

  data: conf_id type char6 value '000010',
        inst_id type char8 value '00000001',
        salesordernumber type vbeln.

  t_quote_header_in-sales_org = '1000'.
  t_quote_header_in-division = '00'.
  t_quote_header_in-distr_chan = '05'.
  t_quote_header_in-purch_date = sy-datum.
  t_quote_header_in-doc_type = 'AG'.
*  t_quote_header_in-po_method = 'ES'.
  t_quote_header_in-purch_no_c = '123456'.

*Fill partner
  wa_quote_partnr-partn_role = 'AG'.
  wa_quote_partnr-partn_numb = '0001004109'.
  insert wa_quote_partnr into table tab_quote_partnr.

  wa_quote_partnr-partn_role = 'WE'.
  wa_quote_partnr-partn_numb = '0001004109'.
  insert wa_quote_partnr into table tab_quote_partnr.
*Fill items
  wa_item-itm_number = '000010'.
  wa_item-material = 'M5-8'.
  wa_item-SALES_UNIT = 'EA'.
*  wa_item-inst_id = inst_id.
*  wa_item-config_id = conf_id.
  wa_item-PO_ITM_NO = '000010'.
  wa_item-target_qty = 1.
  insert wa_item into table tab_items.

  wa_items_sched-itm_number = '000010'.
  wa_items_sched-req_qty = 1.
  wa_items_sched-sched_line = 1.
  insert wa_items_sched into table tab_items_sched.

*CREATE configuration
  wa_quote_ref-posex = '000010'.
  wa_quote_ref-root_id = inst_id.
  wa_quote_ref-config_id = conf_id.
  insert wa_quote_ref into table tab_quote_ref.
*Refinst
  wa_quote_refinst-posex = '000010'.
  wa_quote_refinst-config_id = conf_id.
  wa_quote_refinst-inst_id = inst_id.
  insert wa_quote_refinst into table tab_quote_refinst.

  wa_quote_inst-inst_id = inst_id.
  wa_quote_inst-config_id = conf_id.
  wa_quote_inst-obj_type = 'MARA'.
  wa_quote_inst-class_type = 300.
  wa_quote_inst-obj_key = '000000000060003030'.
  wa_quote_inst-quantity = 1.
  insert wa_quote_inst into table tab_quote_inst.

*Attribute values
  wa_quote_value-config_id = conf_id.
  wa_quote_value-inst_id = inst_id.
  wa_quote_value-charc = 'DOOR_STYLE'.
  wa_quote_value-value = 'V024SMAP'.
  insert wa_quote_value into table tab_quote_value.

  wa_quote_value-config_id = conf_id.
  wa_quote_value-inst_id = inst_id.
  wa_quote_value-charc = 'FINISH'.
  wa_quote_value-value = 'CDR'.
  insert wa_quote_value into table tab_quote_value.

*  wa_items_inx-itm_number = 'X'.
*  wa_items_inx-material = 'X'.
*  wa_items_inx-SALES_UNIT = 'X'.
*  wa_items_inx-inst_id = 'X'.
*  wa_items_inx-config_id = 'X'.
*  wa_items_inx-PO_ITM_NO = 'X'.
*  insert wa_items_inx into table tab_items_inx.
*
*  wa_schedules_inx-itm_number = 'X'.
*  wa_schedules_inx-sched_line = 'X'.
*  wa_schedules_inx-req_qty    = 'X'.
*  insert wa_schedules_inx into table tab_schedules_inx.

*Call BAPI
  call function 'BAPI_QUOTATION_CREATEFROMDATA2'
    EXPORTING
      quotation_HEADER_IN     = t_quote_header_in
      BEHAVE_WHEN_ERROR       = 'P'
    IMPORTING
      SALESDOCUMENT           = salesordernumber
    TABLES
      QUOTATION_ITEMS_IN      = tab_items
      QUOTATION_SCHEDULES_IN  = tab_items_sched
*      quotation_items_inx     = tab_items_inx
*      quotation_schedules_inx = tab_schedules_inx
      QUOTATION_PARTNERS      = tab_quote_partnr
      QUOTATION_CFGS_REF      = tab_quote_ref
      QUOTATION_CFGS_REFINST  = tab_quote_refinst
      QUOTATION_CFGS_INST     = tab_quote_inst
*      QUOTATION_CFGS_PART_OF  = tab_quote_partof
      QUOTATION_CFGS_VALUE    = tab_quote_value
      return                  = return.
*commit
  if salesordernumber ne ''.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
  else.
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
  endif.

Hope it works for you,

Brian

11 REPLIES 11

Former Member
0 Kudos

Hi Thomas,

I have done this once before, but unfortunately don't have the details to hand.

As I recall there is no real documentation for how to complete the BAPI, but you can refer to the help on Variant Configuration for how to fill in the Idoc. The segment and field names correspond pretty much exactly to the table and field names for the BAPI. Thus you can pretty much figure out how to fill it.

Its still a little confusing, but with trial and error you should be able to get it going.

To find the documentation, go to: <b><u>http://help.sap.com/saphelp_47x200/helpdata/en/92/58d455417011d189ec0000e81ddfac/frameset.htm</u></b> and then click on the subject <b>"EDI for KMATs (Information on Creating Your Own)"</b>.

Hope that helps,

Brad

Former Member
0 Kudos

You need to at least fill in the following structures:

quotation_items_in

quotation_items_inx

quotation_schedules_in

quotation_schedules_inx

quotation_cfgs_ref

quotation_cfgs_inst

quotation_cfgs_value

quotation_cfgs_refinst

For each field in quotation_items_in that you put a value, you need to put a value of 'X' in the same field name in the structure quotation_items_inx. The same goes for quotation_schedules_in and quotation_schedules_inx. Below is an example of how I have done this.


quotation_items_in-itm_number = 1.
quotation_items_in-po_itm_no = 1.
quotation_items_in-material = 'MYMATERIAL'.
quotation_items_in-target_qty = 2.
APPEND quotation_items_in.

quotation_items_inx-itm_number = 'X'.
quotation_items_inx-po_itm_no = 'X'.
quotation_items_inx-material = 'X'.
quotation_items_inx-target_qty = 'X'.
APPEND quotation_items_inx.

quotation_schedules_in-itm_number = 1.
quotation_schedules_in-sched_line = 1.
quotation_schedules_in-req_qty    = 2.
APPEND quotation_schedules_in.

quotation_schedules_inx-itm_number = 'X'.
quotation_schedules_inx-sched_line = 'X'.
quotation_schedules_inx-req_qty    = 'X'.
APPEND quotation_schedules_inx.

quotation_cfgs_ref-posex      = 1.
quotation_cfgs_ref-config_id  = 1.
quotation_cfgs_ref-root_id    = 1.
APPEND quotation_cfgs_ref.

quotation_cfgs_refinst-posex     = 1.
quotation_cfgs_refinst-config_id = 1.
quotation_cfgs_refinst-inst_id   = 1.
APPEND quotation_cfgs_refinst.

quotation_cfgs_inst-config_id  = 1.
quotation_cfgs_inst-inst_id    = 1.
quotation_cfgs_inst-obj_type   = 'MARA'.
quotation_cfgs_inst-class_type = '300'.
quotation_cfgs_inst-obj_key    = material_number.
APPEND quotation_cfgs_inst.

bapicuval-config_id = 1.
bapicuval-inst_id   = 1.
bapicuval-charc     = 'XXXXX'.
bapicuval-value     = 10.
APPEND bapicuval.

The key to making it work is the 2 'x' structures and all the fields with a value of 1. The fields with a value of 1 tie it all together. For line item 2, they would have a value of 2 and so on.

Brian

thomasalexander_ritter
Active Contributor
0 Kudos

Hi,

thanks for the replies. I took a look at the edi documentation and it was helpful. I have a better understanding about the logical structure of a configuration, now. Unfortunately I still cannot get it working. I also tried the code which Brad posted but it didn't help either.

Another thing I did was creating an sales order with a configurable material then using ALE to create a corresponding IDoc because the IDoc uses nearly the same structure as the bapi. But after filling the tables in the same way the IDoc does it didn't work, again.

Is there anything which can tell me what goes wrong? Like I posted before the bapi return values tell me everything is fine. I red that you can switch on some kind of trace function when you process an IDoc with a configurable material in foreground but it seems that is not possible when using the bapi.

regards

Thomas

Former Member
0 Kudos

Are you filling the following structures:

quotation_items_inx

quotation_schedules_inx

In your original post, you weren't filling these structures in. You have to use these 2 structures. Look at my previous post.

I don't know if it would make a difference or not, but I set fields posex, root_id, config_id, and inst_id the same as the item number.

Brian

0 Kudos

Hi,

sorry it seems that mixed up the names. Of course, I wanted to write: <i>I also tried the code which Brian posted but it didn't help either</i>. So yes, I added and filled these structures and it didn't fix my problem.

But one question why should I fill these structures? When I used the bapi without configurable materials everything was fine and I didn't fill the structures in that test situation. So why do I have to fill these structures when I use configurable materials?

regards

Thomas

Former Member
0 Kudos

I'm not sure why you were able to create the quote without the x structures before. All the documentation I have read before said that these structures were necessary. Maybe you could post your code for the bapi again since you have made changes to it. Are you geting any messages back in the Return structure?

Brian

0 Kudos

Hi Brian,

I am familiar with these x structures but normally I only use them for bapis which update stuff and not for bapis which create stuff. Anyway I added these structures and the problem still exists.

Like I said before the messages in the return structure are telling me that everything went fine on the header and on the item level

I guess that the bapi is not able to report logical errors which are in the configuration.

Here is the code I am currently trying to fix:


 data: tab_items_inx type table of BAPISDITMX,
        wa_items_inx type BAPISDITMX.

  data: tab_schedules_inx type table of BAPISCHDLX,
        wa_schedules_inx type BAPISCHDLX.

  data: t_quote_header_in type BAPISDHD1.

  data: tab_items type table of BAPISDITM,
        wa_item type BAPISDITM.

  data: tab_items_sched type table of BAPISCHDL,
        wa_items_sched type BAPISCHDL.

  data: tab_quote_ref type table of BAPICUCFG,
        wa_quote_ref like line of tab_quote_ref.

  data: tab_quote_refinst type table of BAPICUREF,
        wa_quote_refinst type BAPICUREF.

  data: tab_quote_inst type table of BAPICUINS,
        wa_quote_inst like line of tab_quote_inst.

  data: tab_quote_partof type table of BAPICUPRT,
        wa_quote_partof like line of tab_quote_partof.

  data: tab_quote_value type table of BAPICUVAL,
        wa_quote_value like line of tab_quote_value.

  data: wa_quote_partnr type BAPIPARNR,
        tab_quote_partnr type table of BAPIPARNR.

  data return type table of BAPIRET2.

  data: conf_id type char6 value '000010',
        inst_id type char8 value '00000001',
        salesordernumber type vbeln.

  t_quote_header_in-sales_org = '0001'.
  t_quote_header_in-division = 99.
  t_quote_header_in-distr_chan = '01'.
  t_quote_header_in-purch_date = sy-datum.
  t_quote_header_in-doc_type = 'AG'.
  t_quote_header_in-po_method = 'ES'.
  t_quote_header_in-purch_no_c = '123456'.

*Fill partner
  wa_quote_partnr-partn_role = 'AG'.
  wa_quote_partnr-partn_numb = '0000123456'.
  insert wa_quote_partnr into table tab_quote_partnr.

  wa_quote_partnr-partn_role = 'WE'.
  wa_quote_partnr-partn_numb = '0000123456'.
  insert wa_quote_partnr into table tab_quote_partnr.
*Fill items
  wa_item-itm_number = '000010'.
  wa_item-material = '<MATERIAL>'.
  wa_item-SALES_UNIT = 'ST'.
  wa_item-inst_id = inst_id.
  wa_item-config_id = conf_id.
  wa_item-PO_ITM_NO = '000010'.
  insert wa_item into table tab_items.

  wa_items_sched-itm_number = '000010'.
  wa_items_sched-req_qty = 1.
  wa_items_sched-sched_line = 1.
  insert wa_items_sched into table tab_items_sched.

*CREATE configuration
  wa_quote_ref-posex = '000010'.
  wa_quote_ref-root_id = inst_id.
  wa_quote_ref-config_id = conf_id.
  insert wa_quote_ref into table tab_quote_ref.
*Refinst
  wa_quote_refinst-posex = '000010'.
  wa_quote_refinst-config_id = conf_id.
  wa_quote_refinst-inst_id = inst_id.
  insert wa_quote_refinst into table tab_quote_refinst.

  wa_quote_inst-inst_id = inst_id.
  wa_quote_inst-config_id = conf_id.
  wa_quote_inst-obj_type = 'MARA'.
  wa_quote_inst-class_type = 300.
  wa_quote_inst-obj_key = '<MATERIAL>'.
  wa_quote_inst-quantity = 1.
  insert wa_quote_inst into table tab_quote_inst.

*Attribute values
  wa_quote_value-config_id = conf_id.
  wa_quote_value-inst_id = inst_id.
  wa_quote_value-charc = 'XXXX'.
  wa_quote_value-value = '15'.
  insert wa_quote_value into table tab_quote_value.

  wa_quote_value-config_id = conf_id.
  wa_quote_value-inst_id = inst_id.
  wa_quote_value-charc = 'XXXX'.
  wa_quote_value-value = 'ED'.
  insert wa_quote_value into table tab_quote_value.

  wa_quote_value-config_id = conf_id.
  wa_quote_value-inst_id = inst_id.
  wa_quote_value-charc = 'XXXX'.
  wa_quote_value-value = 'LCE'.
  insert wa_quote_value into table tab_quote_value.

  wa_quote_value-config_id = '000010'.
  wa_quote_value-inst_id = inst_id.
  wa_quote_value-charc = 'XXXX'.
  wa_quote_value-value = 5.
  insert wa_quote_value into table tab_quote_value.

  wa_items_inx-itm_number = 'X'.
  wa_items_inx-material = 'X'.
  wa_items_inx-SALES_UNIT = 'X'.
  wa_items_inx-inst_id = 'X'.
  wa_items_inx-config_id = 'X'.
  wa_items_inx-PO_ITM_NO = 'X'.
  insert wa_items_inx into table tab_items_inx.

  wa_schedules_inx-itm_number = 'X'.
  wa_schedules_inx-sched_line = 'X'.
  wa_schedules_inx-req_qty    = 'X'.
  insert wa_schedules_inx into table tab_schedules_inx.

*Call BAPI
  call function 'BAPI_QUOTATION_CREATEFROMDATA2'
    EXPORTING
      quotation_HEADER_IN     = t_quote_header_in
      BEHAVE_WHEN_ERROR       = 'P'
    IMPORTING
      SALESDOCUMENT           = salesordernumber
    TABLES
      QUOTATION_ITEMS_IN      = tab_items
      QUOTATION_SCHEDULES_IN  = tab_items_sched
      quotation_items_inx     = tab_items_inx
      quotation_schedules_inx = tab_schedules_inx
      QUOTATION_PARTNERS      = tab_quote_partnr
      QUOTATION_CFGS_REF      = tab_quote_ref
      QUOTATION_CFGS_REFINST  = tab_quote_refinst
      QUOTATION_CFGS_INST     = tab_quote_inst
      QUOTATION_CFGS_PART_OF  = tab_quote_partof
      QUOTATION_CFGS_VALUE    = tab_quote_value
      return                  = return.
*commit
  if salesordernumber ne ''.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
  else.
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
  endif.

regards

Thomas

Former Member
0 Kudos

I copied your code into my system and made a few changes and got it to work. You are right, you don't need the 'x' structures. The main thing that made it work, was removing inst_id and config from wa_item. Here is the code.


  data: tab_items_inx type table of BAPISDITMX,
        wa_items_inx type BAPISDITMX.

  data: tab_schedules_inx type table of BAPISCHDLX,
        wa_schedules_inx type BAPISCHDLX.

  data: t_quote_header_in type BAPISDHD1.

  data: tab_items type table of BAPISDITM,
        wa_item type BAPISDITM.

  data: tab_items_sched type table of BAPISCHDL,
        wa_items_sched type BAPISCHDL.

  data: tab_quote_ref type table of BAPICUCFG,
        wa_quote_ref like line of tab_quote_ref.

  data: tab_quote_refinst type table of BAPICUREF,
        wa_quote_refinst type BAPICUREF.

  data: tab_quote_inst type table of BAPICUINS,
        wa_quote_inst like line of tab_quote_inst.

  data: tab_quote_partof type table of BAPICUPRT,
        wa_quote_partof like line of tab_quote_partof.

  data: tab_quote_value type table of BAPICUVAL,
        wa_quote_value like line of tab_quote_value.

  data: wa_quote_partnr type BAPIPARNR,
        tab_quote_partnr type table of BAPIPARNR.

  data return type table of BAPIRET2.

  data: conf_id type char6 value '000010',
        inst_id type char8 value '00000001',
        salesordernumber type vbeln.

  t_quote_header_in-sales_org = '1000'.
  t_quote_header_in-division = '00'.
  t_quote_header_in-distr_chan = '05'.
  t_quote_header_in-purch_date = sy-datum.
  t_quote_header_in-doc_type = 'AG'.
*  t_quote_header_in-po_method = 'ES'.
  t_quote_header_in-purch_no_c = '123456'.

*Fill partner
  wa_quote_partnr-partn_role = 'AG'.
  wa_quote_partnr-partn_numb = '0001004109'.
  insert wa_quote_partnr into table tab_quote_partnr.

  wa_quote_partnr-partn_role = 'WE'.
  wa_quote_partnr-partn_numb = '0001004109'.
  insert wa_quote_partnr into table tab_quote_partnr.
*Fill items
  wa_item-itm_number = '000010'.
  wa_item-material = 'M5-8'.
  wa_item-SALES_UNIT = 'EA'.
*  wa_item-inst_id = inst_id.
*  wa_item-config_id = conf_id.
  wa_item-PO_ITM_NO = '000010'.
  wa_item-target_qty = 1.
  insert wa_item into table tab_items.

  wa_items_sched-itm_number = '000010'.
  wa_items_sched-req_qty = 1.
  wa_items_sched-sched_line = 1.
  insert wa_items_sched into table tab_items_sched.

*CREATE configuration
  wa_quote_ref-posex = '000010'.
  wa_quote_ref-root_id = inst_id.
  wa_quote_ref-config_id = conf_id.
  insert wa_quote_ref into table tab_quote_ref.
*Refinst
  wa_quote_refinst-posex = '000010'.
  wa_quote_refinst-config_id = conf_id.
  wa_quote_refinst-inst_id = inst_id.
  insert wa_quote_refinst into table tab_quote_refinst.

  wa_quote_inst-inst_id = inst_id.
  wa_quote_inst-config_id = conf_id.
  wa_quote_inst-obj_type = 'MARA'.
  wa_quote_inst-class_type = 300.
  wa_quote_inst-obj_key = '000000000060003030'.
  wa_quote_inst-quantity = 1.
  insert wa_quote_inst into table tab_quote_inst.

*Attribute values
  wa_quote_value-config_id = conf_id.
  wa_quote_value-inst_id = inst_id.
  wa_quote_value-charc = 'DOOR_STYLE'.
  wa_quote_value-value = 'V024SMAP'.
  insert wa_quote_value into table tab_quote_value.

  wa_quote_value-config_id = conf_id.
  wa_quote_value-inst_id = inst_id.
  wa_quote_value-charc = 'FINISH'.
  wa_quote_value-value = 'CDR'.
  insert wa_quote_value into table tab_quote_value.

*  wa_items_inx-itm_number = 'X'.
*  wa_items_inx-material = 'X'.
*  wa_items_inx-SALES_UNIT = 'X'.
*  wa_items_inx-inst_id = 'X'.
*  wa_items_inx-config_id = 'X'.
*  wa_items_inx-PO_ITM_NO = 'X'.
*  insert wa_items_inx into table tab_items_inx.
*
*  wa_schedules_inx-itm_number = 'X'.
*  wa_schedules_inx-sched_line = 'X'.
*  wa_schedules_inx-req_qty    = 'X'.
*  insert wa_schedules_inx into table tab_schedules_inx.

*Call BAPI
  call function 'BAPI_QUOTATION_CREATEFROMDATA2'
    EXPORTING
      quotation_HEADER_IN     = t_quote_header_in
      BEHAVE_WHEN_ERROR       = 'P'
    IMPORTING
      SALESDOCUMENT           = salesordernumber
    TABLES
      QUOTATION_ITEMS_IN      = tab_items
      QUOTATION_SCHEDULES_IN  = tab_items_sched
*      quotation_items_inx     = tab_items_inx
*      quotation_schedules_inx = tab_schedules_inx
      QUOTATION_PARTNERS      = tab_quote_partnr
      QUOTATION_CFGS_REF      = tab_quote_ref
      QUOTATION_CFGS_REFINST  = tab_quote_refinst
      QUOTATION_CFGS_INST     = tab_quote_inst
*      QUOTATION_CFGS_PART_OF  = tab_quote_partof
      QUOTATION_CFGS_VALUE    = tab_quote_value
      return                  = return.
*commit
  if salesordernumber ne ''.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
  else.
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
  endif.

Hope it works for you,

Brian

0 Kudos

Hi Brian,

after adding the changes you did I finally got an error message regarding the configuration

After correcting a wrong characteristic name it worked. So thanks a lot you made my day 😃

regards

Thomas

Former Member
0 Kudos

Hi Thomas,

I've another problem with this BAPI.

I use fm BAPI_QUOTATION_CREATEFROMDATA2 to create a quotation from a program. I have problems with schedules line: if i pass to bapi a value for quantity greater then material availibility in va22 (for quotation just created) I see 0 in bmeng under tab of schedulations. When I try with a value less then availability in va22 bmeng has the same value of wmeng.

For Schedule lines these are the structures that I use to call BAPI:

QUOTATION_SCHEDULES_IN- ITM_NUMBER = '000010'

QUOTATION_SCHEDULES_IN-SCHED_LINE = '0001'

QUOTATION_SCHEDULES_IN-REQ_QTY= same qty of QUOTATION_ITEMS_IN-TARGET_QTY

QUOTATION_SCHEDULES_INX-ITM_NUMBER = '000010'

QUOTATION_SCHEDULES_INX-SCHED_LINE = '0001'

QUOTATION_SCHEDULES_INX-UPDATEFLAG = 'X'

QUOTATION_SCHEDULES_INX-REQ_QTY = 'X'

Have you got any idea???

Thanks in advance!!!

0 Kudos

Dear Federica,

I am trying to create a sales order quotation and order using bapi. I am able to create them . Here i passed the minimum data to create them like header ,item,partner data.

I tried to pass the data from the variant tables. Here all our materials are configurable. By seeing your mail i ma posting this question .

I tried to create by using the logic given by Brian (from the above code ).

Can you share your ideas with me if you worked on this .

Regards,

madhu.