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: 

BAPI_QUOTATION_CREATEFROMDATA2 : Multiple line for same Characteristics

Former Member
0 Kudos

Hi ALL,

Hi Thomas,

I am using BAPI "BAPI_QUOTATION_CREATEFROMDATA2" to create quotation.I have one question on Configuration part.

I am able to update configuration but I need MULTIPLE line for the same CHARECTERISTICS.

Below is the code.

Please notice the record of table " i_quotation_cfgs_value". I want to show TWO record for Char 'Z_COIL_THICKNESS' with value 0.2 and 0.3.Do I need to increment Instance ID or Confid ID or do I need fill table QUOTATION_CFGS_PART_OF.Please help.


CONSTANTS:
conf_id TYPE char6 VALUE '000010',
      inst_id TYPE char8 VALUE '00000001'.

w_quotation_schedules_in-req_qty = '5'.
w_quotation_schedules_in-itm_number = '000010'.
w_quotation_schedules_in-sched_line = 1.
APPEND w_quotation_schedules_in TO i_quotation_schedules_in.
CLEAR w_quotation_schedules_in.

w_quotation_cfgs_ref-posex = '000010'.
w_quotation_cfgs_ref-root_id = inst_id.
w_quotation_cfgs_ref-config_id = conf_id.
APPEND w_quotation_cfgs_ref TO i_quotation_cfgs_ref.

w_quotation_cfgs_refinst-posex = '000010'.
w_quotation_cfgs_refinst-config_id = conf_id.
w_quotation_cfgs_refinst-inst_id = inst_id.
APPEND w_quotation_cfgs_refinst TO i_quotation_cfgs_refinst.

w_quotation_cfgs_value-config_id = conf_id .
w_quotation_cfgs_value-inst_id = inst_id .
w_quotation_cfgs_value-charc = 'Z_COIL_THICKNESS'.
w_quotation_cfgs_value-value = '0.2'.
APPEND w_quotation_cfgs_value TO i_quotation_cfgs_value.
CLEAR w_quotation_cfgs_value.

w_quotation_cfgs_value-config_id = conf_id .
w_quotation_cfgs_value-inst_id = inst_id .
w_quotation_cfgs_value-charc = 'Z_COIL_THICKNESS'.
w_quotation_cfgs_value-value = '0.3'.
APPEND w_quotation_cfgs_value TO i_quotation_cfgs_value.
CLEAR w_quotation_cfgs_value.

Code Formatted by: Alvaro Tejada Galindo on Jan 5, 2010 10:26 AM

6 REPLIES 6

former_member583013
Active Contributor
0 Kudos

I think you should increment INST_ID, so you could overcome the duplicated key problem.

Greetings,

Blag.

0 Kudos

Actually I have already checked with incrementing INST_ID in all the three table "i_quotation_cfgs_ref,i_quotation_cfgs_refinst

i_quotation_cfgs_value" .Its not working.Below is the code.Do I need pass table QUOTATION_CFGS_PART_OF or any other field in any other table ?

w_quotation_schedules_in-req_qty = '5'.

w_quotation_schedules_in-itm_number = '000010'.

w_quotation_schedules_in-sched_line = 1.

APPEND w_quotation_schedules_in TO i_quotation_schedules_in.

CLEAR w_quotation_schedules_in.

w_quotation_cfgs_ref-posex = '000010'.

w_quotation_cfgs_ref-root_id = '00000001'.

w_quotation_cfgs_ref-config_id = conf_id.

APPEND w_quotation_cfgs_ref TO i_quotation_cfgs_ref.

w_quotation_cfgs_ref-posex = '000010'.

w_quotation_cfgs_ref-root_id = '00000002'.

w_quotation_cfgs_ref-config_id = conf_id.

APPEND w_quotation_cfgs_ref TO i_quotation_cfgs_ref.

w_quotation_cfgs_refinst-posex = '000010'.

w_quotation_cfgs_refinst-config_id = conf_id.

w_quotation_cfgs_refinst-inst_id = '00000001'.

APPEND w_quotation_cfgs_refinst TO i_quotation_cfgs_refinst.

w_quotation_cfgs_refinst-posex = '000010'.

w_quotation_cfgs_refinst-config_id = conf_id.

w_quotation_cfgs_refinst-inst_id = '00000002'.

APPEND w_quotation_cfgs_refinst TO i_quotation_cfgs_refinst.

w_quotation_cfgs_value-config_id = conf_id .

w_quotation_cfgs_value-inst_id = '00000001' .

w_quotation_cfgs_value-charc = 'Z_COIL_THICKNESS'.

w_quotation_cfgs_value-value = '0.2'.

APPEND w_quotation_cfgs_value TO i_quotation_cfgs_value.

CLEAR w_quotation_cfgs_value.

w_quotation_cfgs_value-config_id = conf_id .

w_quotation_cfgs_value-inst_id = '00000002' .

w_quotation_cfgs_value-charc = 'Z_COIL_THICKNESS'.

w_quotation_cfgs_value-value = '0.3'.

madhu_vadlamani
Active Contributor
0 Kudos

Dear Rk,

I am trying to create sales order quotation using bapi. I am able to create it . But our materials are configurable . i am to send the characteristics from bapi . By seeing this post i am asking you. i wrote a program using bapi_quotation_createfromdata2. If you want to see i will keep my code here.Can you share your ideas with me on this .

Regards,

Madhu.

0 Kudos

Hi Madhu,

Pass below four table.

i_quotation_cfgs_ref

i_quotation_cfgs_refinst

i_quotation_cfgs_inst

i_quotation_cfgs_value

"config_id" should be same as Item number.

To define the connection between the sales order item and the configuration you must pass match this-->(ORDER_ITEMS_IN-PO_ITM_NO = ORDER_CFGS_REF-POSEX)

Let me know if you need any other info

Code :

-


CONSTANTS:

lc_conf_id TYPE char6 VALUE '000010',

lc_inst_id TYPE char8 VALUE '00000001',

lc_item_no TYPE cu_posex VALUE '000010',

w_quotation_cfgs_ref-posex = lc_item_no. "'000010'.

w_quotation_cfgs_ref-root_id = lc_inst_id.

w_quotation_cfgs_ref-config_id = lc_conf_id.

APPEND w_quotation_cfgs_ref TO i_quotation_cfgs_ref.

CLEAR w_quotation_cfgs_ref.

w_quotation_cfgs_refinst-posex = lc_item_no. "'000010'.

w_quotation_cfgs_refinst-config_id = lc_conf_id.

w_quotation_cfgs_refinst-inst_id = lc_inst_id.

APPEND w_quotation_cfgs_refinst TO i_quotation_cfgs_refinst.

w_quotation_cfgs_inst-inst_id = lc_inst_id.

w_quotation_cfgs_inst-config_id = lc_conf_id.

w_quotation_cfgs_inst-obj_type = 'MARA'. "wa_zrvs_mat_char_h-obtab

w_quotation_cfgs_inst-class_type = 300. "wa_zrvs_mat_char_h-klart.

w_quotation_cfgs_inst-obj_key = "Material number"

w_quotation_cfgs_inst-quantity = 1.

APPEND w_quotation_cfgs_inst TO i_quotation_cfgs_inst.

CLEAR w_quotation_cfgs_inst.

w_quotation_cfgs_value-config_id = lc_conf_id .

w_quotation_cfgs_value-inst_id = lc_inst_id .

w_quotation_cfgs_value-charc = wa_zrva_tdccodes-zzcharcteristics.

w_quotation_cfgs_value-value = wa_zrva_tdccodes-zvalue.

w_quotation_cfgs_value-valcode = 1.

APPEND w_quotation_cfgs_value TO i_quotation_cfgs_value.

CLEAR w_quotation_cfgs_value.

w_quotation_items_in-po_itm_no = lc_item_no. "'000010'."Imp for config

w_quotation_items_in-itm_number = lc_item_no. "'000010'.

APPEND w_quotation_items_in TO i_quotation_items_in.

CLEAR w_quotation_items_in.

Roshan

-


0 Kudos

Dear Rk,

How are you . A long back you helped me to use BAPI_QUOTATION_CREATEFROMDATA2. Here i have a small requirement . I want to create quotation and order using bapi . I am thinking to keep in va21 and va01 screens .

At the time of creation of sales order and quotation i want to enter the person name who created it from the external system . That value should come and sit in the screen Zfield .

I have seen some extension parameters in that bapi . can i use that . I hope you will share your ideas with me .

Regards,

Madhu.

Former Member
0 Kudos

Hi,

I am trying to create quotation from BAPI_QUOTATION_CREATEFROMDATA2 which contains some configuration. There are some configurations which are stored as an XML format.

How could i pass the values to BAPI so that i could avoid xml file generation.

Regards,

Preetesh