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 how to set condition type value as zero (0).

marcelogb
Participant
0 Likes
5,180

Hi gurus!

After reading a lot of posts about similar questions to this one I haveN'T finally got it. The resume is that everytime I try to set a value zero condition type from this BAPI, the condition type is determinated again! so i can't give it a zero value.

My problem is as follows:

 *1) I have a condition type on a Procedure ZABC and these are its specifications:*

_Access seq._
none

_Control DATA 1_ 
Cond. Class: A
Calculate Type: B
Cond. Category: ' '
Orunding Rule: ' '
StrucCond: ' '

{quote}  _Group condition_ {quote} 
none here

_Changes which can be made_
Manual entries: 'C'
All checks checked but "Header condition"

_Master Data_
none

_Scales_
none

_Control data 2_
just checked Currency Conv.: 'X'

_Text determination_
none

*2) Procedure specifications for this condition type:*
Manual: ' '
Required: 'X'
Stadistic: 'X'
Sutot: '6'
Requirement: yes, it uses a formula
CalType: yes, it uses a formula
BasType: yes, it uses a formula


*3) I use BAPI_SALESORDER_CREATEFROMDAT2 to create a sales order and in some cases I need to set this condition type value as zero. *
My item_condition_in table seems like this:
       clear wa_order_CONDITIONS_in.
        wa_order_CONDITIONS_in-itm_number = va_posicion.

        MOVE it_bapisdcond_O-COND_VALUE TO
        wa_order_CONDITIONS_in-COND_VALUE.

        MOVE it_bapisdcond_O-CONDVALUE TO
        wa_order_CONDITIONS_in-CONDVALUE.

        MOVE it_bapisdcond_O-COND_ST_NO
        TO wa_order_CONDITIONS_in-COND_ST_NO.

        MOVE it_bapisdcond_O-COND_COUNT
        TO wa_order_CONDITIONS_in-COND_COUNT.

        MOVE it_bapisdcond_O-APPLICATIO
        TO wa_order_CONDITIONS_in-APPLICATIO.

        MOVE it_bapisdcond_O-COND_TYPE
        TO wa_order_CONDITIONS_in-COND_TYPE.

        MOVE it_bapisdcond_O-CONPRICDAT
        TO wa_order_CONDITIONS_in-CONPRICDAT.

        MOVE it_bapisdcond_O-CALCTYPCON
        TO wa_order_CONDITIONS_in-CALCTYPCON.

        CLEAR wa_order_CONDITIONS_in-CONBASEVAL.

        MOVE it_bapisdcond_O-CURREN_ISO
        TO wa_order_CONDITIONS_in-CURRENISO.

        MOVE it_bapisdcond_O-CURRENCY
        TO wa_order_CONDITIONS_in-CURRENCY.

        MOVE it_bapisdcond_O-COND_P_UNT
        TO wa_order_CONDITIONS_in-COND_P_UNT.

        MOVE it_bapisdcond_O-COND_D_UNT
        TO wa_order_CONDITIONS_in-cond_unit.
        append wa_order_CONDITIONS_in to order_CONDITIONS_in.

        clear wa_order_CONDITIONS_inx.
        wa_order_CONDITIONS_inx-itm_number = va_posicion.
        wa_order_CONDITIONS_inx-COND_TYPE  = it_bapisdcond_O-cond_type.
        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'.
        wa_order_CONDITIONS_inx-updateflag  = 'U'.
        append wa_order_CONDITIONS_inx to order_CONDITIONS_inx.

Of course the cond_value, condvalue and conbaseval are set to zero.. other than this I have tested filling different vars on the order_conditions_in structure and in the inx one. Like updateflag as 'I' instead of 'U'. Filling fields like currency, cond_p_unt, conbaseval or not filling them... But the condition type is always REDETERMINED!

IS it able to set a zero value condition type from this BAPI when the condition type is formula calculated (base and value)?

Any advise will be appreciated!

Thanks in advance.

Edited by: John Smith on Apr 12, 2010 12:22 PM

Edited by: John Smith on Apr 12, 2010 12:23 PM

Edited by: John Smith on Apr 12, 2010 12:24 PM

Mmm I don´t think so. Why then can I change its value from VA02? I can set it as zero and it updates the prices. I don't know why I can't do the same from BAPI...

Thanks in advance,

John

10 REPLIES 10
Read only

Former Member
0 Likes
2,173

You can pass the pricing condition from BAPI only when the pricing conditions are maintained as "Manual". Otherwise, irrespective of the values passed though BAPI, pricing conditions&its values will be redetermined as per the pricing procedure.

Regards

Vinod

Read only

0 Likes
2,173

Mmm I don´t think so. Why then can I change its value from VA02? I can set it as zero and it updates the prices. I don't know why I can't do the same from BAPI...

Thanks in advance,

John

Read only

0 Likes
2,173

Try this piece of code

wa_conditions_in-itm_number = wa_konv-kposn.
      wa_conditions_in-cond_st_no = wa_konv-stunr.
      wa_conditions_in-cond_count = wa_konv-zaehk.
      wa_conditions_in-cond_type  = wa_konv-kschl.
      wa_conditions_in-cond_value = wa_konv-kbetr.

      append wa_conditions_in to it_conditions_in.
      clear : wa_conditions_in.

      wa_conditions_inx-updateflag = 'U'.
      wa_conditions_inx-itm_number = wa_konv-kposn.
      wa_conditions_inx-cond_st_no = wa_konv-stunr.
      wa_conditions_inx-cond_count = wa_konv-zaehk.
      wa_conditions_inx-cond_type  = wa_konv-kschl.
      wa_conditions_inx-cond_value = 'X'.

Regards

Vinod

Read only

0 Likes
2,173

That's how I have it. I have also tried to delete ("D") it or insert ("I") it but I got the same result. It recalculates it again instead of setting my new value...

I have tried to change the procedure config for this condition type ZABC, I have tried checking obligatory, unchecking it, checking manual and unchecking it...

Just remember is a condition type with formula in calculation and in base.

Please help!

Thanks in advance

Edited by: John Smith on Apr 13, 2010 1:17 PM

Read only

0 Likes
2,173

Have you tried by changing the update flag?

wa_conditions_inx-updateflag = 'I'.

Regards

Vinod

Read only

0 Likes
2,173

Sure, as I told in my last post, I have also tried "I" and "D" since I have to set its value to zero, I tried to delete it but same thing occurs... system calculates it again!

If you need any kind of additional info just ask

Help will be much appreciated.

Thanks.

Read only

0 Likes
2,173

Hi John,

I had simulated your scenario, which worked properly for me. Check the following..

1) Confirm whether the pricing condition you are updating is manual,

2) Is there any pricing routine attached to this pricing condition (Check the pricing procedure), if yes check the coding in VOFM

Regards

Vinod

Read only

0 Likes
2,173

Well, as I told before, the condition type has two routines, one for value and another for base. Although I check CONDVALUE, COND_VALUE and CONBASEVAL to set value zero and the option "Changes which can be made" is set to C (Manual changes have priority), it always recalculate the value with the calculation routine instead of set my value. I have also tried to set any other value diferent from zero and is always the same, It recalculates the value with the routine.

My last try was setting the condition type like manual in the procedure but even in manual, it recalculates its value based on the calculation routine.

Thanks for your effort and help,

John

Read only

0 Likes
2,173

Can you remove the calculcation routine and check the BAPI? If it works, then it is due the calculation routine.

Regards

Vinod

Edited by: Vinod Kumar on Apr 14, 2010 3:42 PM

Read only

0 Likes
2,173

Hi, thanks for your help. I really think is not possible to change its value since the condition type has a calculation routine.

By the way what I finally did was use the KBETR (import) since I didn't need it for anything (it was always zero) and modify my calculation routine like this:

-> If I want to overwrite the value depending on some sales position conditions I just set the value (KWERT) from the KBETR that I manually filled in my report. If the condition isn't satisfied it just work as usual.

I hope I was clear enough, anyway ask if you need any support on my solution.

Thanks for all Vinod, effort is always appreciated.