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

SD Pricing Routine - Amount not getting modified

SachinS
Explorer
0 Likes
7,174

Hi Folks,

Working on Condition value routine for SD pricing..

Able to modify the Condition Value (XKWERT) in Pricing Elements in Sales order

Unable to modify the Amount (XKOMV-KBETR) which should be = Condition Value / Qty.

In this case Amount should be (274 / 2) = 137 instead of 170.

Kindly refer attached doc for relevant screenshots.

Thanks !!!

Hi Folks,

Working on Condition value routine for SD pricing..

Able to modify the Condition Value (XKWERT) in Pricing Elements in Sales order

Unable to modify the Amount (XKOMV-KBETR) which should be = Condition Value / Qty.

In this case Amount should be (274 / 2) = 137 instead of 170.

Kindly refer attached doc for relevant screenshots.

Thanks !!!

12 REPLIES 12
Read only

Former Member
0 Likes
6,209

Hi,

Modify the Modify statement as below and try:

MODIFY XKOMV FROM LV_KOMV TRANSPORTING KBETR. This should work!

Read only

0 Likes
6,209

Hi ,

Its still not modifying XKOMV.

is there any global fields for modifying kbetr like we have for kwert (xkwert) ??

Thanks !!

Read only

0 Likes
6,209

Hi,

MODIFY XKOMV FROM LV_KOMV INDEX <number of the current run>TRANSPORTING KBETR. Please do an F1 on this to find the correct syntax. This should work!

Read only

Former Member
0 Likes
6,209

The reason why its not modifying is because its unable to indentify the field and for which row the modification is required as XKOMV is a table. Hence you need to include INDEX and TRANSPORTING.

Hope this helps!

Read only

Former Member
0 Likes
6,209

Hi bAbA,

How ur code will update the value of XKOMV from lv_komv.

U have to use INDEX in the time of update the value of XKOMV.

If u give me the details of XKOMV value Than I will give the code to update the value of XKOMV.

if XKOMV is table than READ the table XKOMV and than pass ur value and than update the table XKOMV using index.It will work definitely.

Thanks

Tarak

Read only

Former Member
0 Likes
6,209

Hi,

I am sure you have already read XKOMV into LV_KOMV above right?

So just modify the existing statement to

MODIFY XKOMV FROM LV_KOMV INDEX <number of the current run>TRANSPORTING KBETR.

You can store the current row number while reading XKOMV into LV_KOMV above and then use that INDEX below in the MODIFY statement.

This will surely work!

Read only

SachinS
Explorer
0 Likes
6,209

Hi Guys,

I am not looping XKOMV but IT_PRICE table..

Kindly refer below screens...

Thanks !!

Read only

Former Member
0 Likes
6,209

Hi

If you are not looping at XKOMV and XKOMV is a table, how will it know KBETR of which row should be updated? Please paste your code here and maybe we can help you.

Read only

0 Likes
6,209

Hi,

Below is the code where we are not looping XKOMV.

------------------------------------

FORM FRM_KONDI_WERT_901.

*{   INSERT         DEVK900128                                        1

*

   data : lv_komv type KOMV_INDEX." komv.


   data : it_price type STANDARD TABLE OF ZSD_PRICE_MASTER,

          wa_price type ZSD_PRICE_MASTER.


   data : budat type budat,

          AMT TYPE ZSD_PRICE_MASTER-FRESH_RATE_FROM,

          AMT1 TYPE ZSD_PRICE_MASTER-FRESH_RATE_FROM,

          lv_MGLME type i.

   BUDAT = komp-KURSK_DAT.      "'20130227'.

*  AMT = '150'.

   read table xkomv into lv_komv with key kschl = 'PR00'

                                          KPOSN = KOMP-AUPOS.

   if sy-subrc eq 0.


     clear : amt .

     amt = lv_komv-KBETR.

     select mandt VALID_FROM VALID_TO FRESH_RATE_FROM FREASH_RATE_TO SST SEC SEC_D

         PG SV_MERCI SV_NON_MERCI from ZSD_PRICE_MASTER into table it_price

                                                              where VALID_FROM <= budat and VALID_TO >= budat

                                                                AND FRESH_RATE_FROM <= AMT AND FREASH_RATE_TO > AMT.

    

     case : KOMP-KONDM.


       when : 01.


       when : 02.

         loop at it_price into wa_price.

            amt1 = wa_price-sst.

            lv_komv-KBETR = amt1.

            lv_komv-KBETR = lv_komv-KBETR / 1000.

            xkwert = lv_komv-kbetr . "wa_price-sst.

            lv_MGLME = KOMP-MGLME  / 1000.

            lv_komv-kbetr = xkwert / lv_MGLME.

            MODIFY XKOMV FROM LV_KOMV TRANSPORTING KBETR.

         endloop.


       when : 03.

       when : 04.

       when : 05.


      ENDCASE.


     exit.


    else.

   endif.

*}   INSERT

ENDFORM.

------------------------------------

Thanks !!

Read only

Former Member
0 Likes
6,209

Hi,

In the read statement above,

read table xkomv into lv_komv with key kschl = 'PR00' 

                                          KPOSN = KOMP-AUPOS.

if sy-subrc eq 0.

move the row number into a variable LV_INDEX.

For the row number, you may check STUNR or you will have to move SY-TABIX.

LV_INDEX = SY-TABIX or LV_KOMV-STUNR. Please check this.

Use this LV_INDEX in the MODIFY statement

MODIFY XKOMV FROM LV_KOMV INDEX LV_INDEX TRANSPORTING KBETR.

This will surely work!

Read only

0 Likes
6,209


Hi,

The problem is not in Modify as i am able to modify the value in XKMOV table but once it comes out of the routine it again comes to the original value.

Thanks !!

Read only

0 Likes
6,209

Hi Baba,

The problem is that you are using a condition value formula to modify the base.

You need to use a condition base value formula to modify kbetr

Regards