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_SALESORDER_CREATEFROMDAT2 Conditions problema

Former Member
0 Likes
1,409

Hi all!, I'm using BAPI_SALESORDER_CREATEFROMDAT2 in release 4.6C and I'm having problems with conditions, when the condition is krech = 'A'.

I select the data from table KONV at internal table t_konv and send the following to BAPI:

t_bapicond-conbaseval = t_konv-kawrt.

t_bapicond-cond_value = t_konv-kbetr / 10.

t_bapicond-condvalue = t_konv-kwert.

t_bapicond-calctypcon = t_konv-krech.

t_bapicond-currency = t_konv-waers.

t_bapicond-itm_number = t_bapiitemin-itm_number.

t_bapicond-cond_count = t_konv-zaehk.

t_bapicond-cond_unit = t_konv-kmein.

t_bapicond-cond_p_unt = t_konv-kpein.

When I go to VA03 with the new sales order, the Condition value is not the one I sent, is incorrect, it seems like the BAPI calculates the Condition value in a diferent way than transaction VA01.

I only have the problem with percentage conditions, type 'A'.

Can anybody help me with my problem? I could not find information in OSS.

Thanks!

Hi all!, I'm using BAPI_SALESORDER_CREATEFROMDAT2 in release 4.6C and I'm having problems with conditions, when the condition is krech = 'A'.

I select the data from table KONV at internal table t_konv and send the following to BAPI:

t_bapicond-conbaseval = t_konv-kawrt.

t_bapicond-cond_value = t_konv-kbetr / 10.

t_bapicond-condvalue = t_konv-kwert.

t_bapicond-calctypcon = t_konv-krech.

t_bapicond-currency = t_konv-waers.

t_bapicond-itm_number = t_bapiitemin-itm_number.

t_bapicond-cond_count = t_konv-zaehk.

t_bapicond-cond_unit = t_konv-kmein.

t_bapicond-cond_p_unt = t_konv-kpein.

When I go to VA03 with the new sales order, the Condition value is not the one I sent, is incorrect, it seems like the BAPI calculates the Condition value in a diferent way than transaction VA01.

I only have the problem with percentage conditions, type 'A'.

Can anybody help me with my problem? I could not find information in OSS.

Thanks!

3 REPLIES 3
Read only

Former Member
0 Likes
839

Hi,

I think you need to pass the entire condition value instead of dividing by 10.

Instead of:

t_bapicond-cond_value = t_konv-kbetr / 10.

Use:

t_bapicond-cond_value = t_konv-kbetr.

Within include program L2032FXX, form move_condition_out, there is some special code for krech = 'A' that divides condition value by 10 for you. Here is the standard code:


if www_ex_konvkom-krech = 'A'.     "prozentual ?
  bapi_ex_konvkom-cond_value = www_ex_konvkom-kbetr / 10.
endif.

If that does not work for you, then take a look in include program L2032FXX, form move_condition_out to see some additional special handling for krech = 'A' that may or may not end up affecting your condition value results.


 case www_ex_konvkom-krech.
    when 'A' or 'H' or 'I'.
      bapi_ex_konvkom-conbaseval =
          www_ex_konvkom-kawrt.

      if not www_ex_konvkom-kawrt is initial and
         not da_waer is initial.
        clear bapi_ex_konvkom-conbaseval.
        call function 'BAPI_CURRENCY_CONV_TO_EXTERN_9'
          exporting
            currency        = da_waer
            amount_internal = www_ex_konvkom-kawrt
          importing
            amount_external = bapi_ex_konvkom-conbaseval.
        endif.
    when others.
      bapi_ex_konvkom-conbaseval =
      www_ex_konvkom-kawrt / 10.
  endcase.

Regards,

James Gaddis

Read only

marcelogb
Participant
0 Likes
839

Hi Silvia,

Try this:

1) Set correctly your currency field. Be sure it has value (in your case t_konv-waers), if doesn't get it other way.

t_bapicond-currency = t_konv-waers.

2) Set cacltypcon to retain proper type:

t_bapicond-CALCTYPCON

3) Remember to check the update fields at the extended structure:

wa_order_CONDITIONS_inx-COND_VALUE = 'X'.

wa_order_CONDITIONS_inx-CURRENCY = 'X'.

wa_order_CONDITIONS_inx-COND_UNIT = 'X'.

wa_order_CONDITIONS_inx-COND_P_UNT = 'X'.

Please let us know if it works!

Regards,

John

Read only

Former Member
0 Likes
839

Before passing into BAPI, add the code

order_conditions_in-cond_value = order_conditions_in-cond_value / 10.

Regards

Vinod