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

BAPI_SALESDOCU_CREATEFROMDATA1 Conditions Duplicates

Former Member
0 Likes
1,298

Hello, I have a little problem when, I create a Sales Order with BAPI_SALESDOCU_CREATEFROMDATA1, It seems that some of the conditions are automatically completed (Material position), and if I set data into the BAPI structure "sales_conditions_in", the condition is duplicated. for example:

Z901 Price for PUB 60.000,00 UYU 1 PCE

Z901 Price for PUB 250,00 USD 2 PCE

Valid Price 250,00 USD 2 PCE 7.500,00

Gross total 250,00 USD 2 PCE

ZK05 Discount 2,000- % 150,00-

ZK05 Discount 0,300- % 22,50-

Sum Discount / Surch 0,75- USD 2 PCE Net value 1 249,25 USD 2 PCE Rebate basis 249,25 USD 2 PCE

ZK07 Descuento 7,500- % 560,81-

But, this is only visual, because the condition passed by structure its the one that the VA01 use. (The prices are modified Through the structure condition, not sap proposal).

I want to despise the sap standard and take just the one from the structure, anyone know how to do this? I already tried to set some fields to Update on Group but it doesnt work.

Here is my code for the creation:

      • Header data

gw_headerbapi-doc_type = p_header-doc_type.

gw_headerbapix-doc_type = gc_cross.

gw_headerbapi-sales_org = p_header-sales_org.

gw_headerbapix-sales_org = gc_cross.

gw_headerbapi-distr_chan = p_header-distr_chan.

gw_headerbapix-distr_chan = gc_cross.

gw_headerbapi-division = p_header-division.

gw_headerbapix-division = gc_cross.

gw_headerbapi-doc_date = p_header-doc_date.

gw_headerbapix-doc_date = gc_cross.

gw_headerbapi-sales_off = p_header-sales_off.

gw_headerbapix-sales_off = gc_cross.

gw_headerbapi-currency = p_header-currency.

gw_headerbapix-currency = gc_cross.

gw_headerbapi-cust_group = p_header-cust_group.

gw_headerbapix-cust_group = gc_cross.

gw_headerbapi-price_list = p_header-price_list.

gw_headerbapix-price_list = gc_cross.

gw_headerbapi-pmnttrms = p_header-pmnttrms.

gw_headerbapix-pmnttrms = gc_cross.

gw_headerbapi-purch_no_c = p_header-sorder_num.

gw_headerbapix-purch_no_c = gc_cross.

gw_headerbapix-updateflag = 'U' .

      • Fill Conditions

gt_conditions_inbapi-itm_number = p_items-itm_number.

gt_conditions_inbapi-cond_type = p_items-cond_type.

gt_conditions_inbapi-cond_value = p_items-cond_value.

gt_conditions_inbapi-currency = p_items-currency.

gt_conditions_inbapi-cond_p_unt = p_items-cond_p_unt.

gt_conditions_inbapi-cond_unit = p_items-cond_unit.

gt_conditions_inbapi-cond_updat = gc_cross.

gt_conditions_inbapi-groupcond = gc_cross.

APPEND gt_conditions_inbapi.

CLEAR gt_conditions_inbapi.

      • Fill schedule lines

gt_schedules_inbapi-itm_number = p_items-itm_number.

gt_schedules_inbapi-sched_line = '0001'.

gt_schedules_inbapi-req_qty = p_items-req_qty.

APPEND gt_schedules_inbapi.

CLEAR gt_schedules_inbapi.

      • Fill schedule line flags

gt_schedules_inbapix-itm_number = p_items-itm_number.

gt_schedules_inbapix-sched_line = '0001'.

gt_schedules_inbapix-updateflag = gc_cross.

gt_schedules_inbapix-req_qty = gc_cross.

APPEND gt_schedules_inbapix.

CLEAR gt_schedules_inbapix.

      • Item data

gt_itembapix-updateflag = gc_update .

gt_itembapi-itm_number = p_items-itm_number.

gt_itembapix-itm_number = gc_cross.

gt_itembapi-material = p_items-material.

gt_itembapix-material = gc_cross.

gt_itembapi-plant = p_items-plant.

gt_itembapix-plant = gc_cross.

gt_itembapi-target_qty = p_items-target_qty.

gt_itembapix-target_qty = gc_cross.

gt_itembapi-target_qu = p_items-target_qu.

gt_itembapix-target_qu = gc_cross.

gt_itembapi-item_categ = p_items-item_categ.

gt_itembapix-item_categ = gc_cross.

APPEND gt_itembapi.

CLEAR gt_itembapi.

APPEND gt_itembapix.

CLEAR gt_itembapix.

      • Partner data

gt_partnerbapi-partn_role = p_partner-partn_role_so.

gt_partnerbapi-partn_numb = p_partner-partn_numb_so.

APPEND gt_partnerbapi.

gt_partnerbapi-partn_role = p_partner-partn_role_sh.

gt_partnerbapi-partn_numb = p_partner-partn_numb_sh.

APPEND gt_partnerbapi.

      • Call the BAPI

CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'

EXPORTING

sales_header_in = gw_headerbapi

sales_header_inx = gw_headerbapix

IMPORTING

salesdocument_ex = lv_vbeln

TABLES

return = gt_returnbapi

sales_items_in = gt_itembapi

sales_items_inx = gt_itembapix

sales_schedules_in = gt_schedules_inbapi

sales_schedules_inx = gt_schedules_inbapix

sales_conditions_in = gt_conditions_inbapi

sales_partners = gt_partnerbapi.

Thanks

Cristian Rodriguez

3 REPLIES 3
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
715

I'm not quite sure I fully understand what you mean, but I don't think that you'll be able to get rid of (as much as you "despise" them) of mandatory / default / standard conditions. Most likely they could be simply overridden by another, manual, condition thorugh BAPI. You might want to check with your functional SD specialist on the proper procedure.

E.g. if there is an automatic mandatory condition for a regular price and a condition to do a manual "price override", you don't need to touch the mandatory condition but simply add the "override" one. It will disable the regular price, as long as it's configured that way.

Read only

0 Likes
715

(as much as you "despise" them)

😄 I laughed for quite a few mins Jelena,

thats some wonderful humor in the forum !!

Read only

0 Likes
715

Perhaps my english wasn't to good, what I really mean to say was, that i dont want the two positions. The BAPI condition its what I need, and with BAPI_SALESDOCU_CREATEFROMDATA1, I couldnt get it.