cancel
Showing results for 
Search instead for 
Did you mean: 

SD > BF > Pricing - TKOMV internal table has no value first time

Former Member
0 Kudos

Summary

1. Created new condition record ZPMF

2. Added new Requirement Routine 996

*DATA : lt_komfkko LIKE komv    OCCURS 1000 WITH HEADER LINE.
data :  xkomv    TYPE TABLE OF komv,
          wa_xkomv LIKE LINE OF xkomv.
data :  wa_amt_pi01  type kbetr, "kwert.
          wa_amt_ypi1  type kbetr, "kwert
          wa_amt_zpml  type kbetr, "kwert
*          wa_amt_zpmf  type kbetr,
          wa_amt_both  type kbetr, "kwert
          wa_rec_exist type i.

clear : wa_rec_exist.
loop at tkomv into wa_xkomv where kschl eq 'PI01' or kschl eq 'YPI1' or kschl eq 'ZPML'. "'ZPML'.

  wa_rec_exist = wa_rec_exist + 1.

  if wa_xkomv-kschl eq 'PI01'.
      wa_amt_pi01 = wa_xkomv-kbetr. "kwert.
  elseif wa_xkomv-kschl eq 'YPI1'.
      wa_amt_ypi1 = wa_xkomv-kbetr. "kwert.
  elseif wa_xkomv-kschl eq 'ZPML'.
      wa_amt_zpml = wa_xkomv-kbetr. "kwert.
*      wa_amt_zpmf = wa_xkomv-kbetr. "kwert.
  endif.

endloop.

if wa_rec_exist ne '0'.  "record exist
*  sy-subrc = 0.
  wa_amt_both = wa_amt_pi01 + wa_amt_ypi1.

  if wa_amt_zpml le wa_amt_both.
    sy-subrc = 4.
  elseif wa_amt_zpml gt wa_amt_both.
    sy-subrc = 0.
*    WAIT UP TO 2 SECONDS.
  endif.

else.  "record not exist.
  sy-subrc = 4.
endif.

ENDFORM.
FORM KOBEV_996.
sy-subrc = 0.

*}  INSERT
ENDFORM.

Basically what is says in 996 is

If PI01 + YP1 = A

if ZPML > A

then ZPMF will be active in SO

If ZPML <= A

then ZPMF inactive

Problem

When Line Item 10 is entered, the ZPMF does not exist

In pricing analysis is says "message saying condition record exists (removed manually)."

Unless we press the update price button and choose B, then you will see ZPMF there

But if we enter item 20, the ZPMF will be there without need to press the update button

It seems like inside routine 996,

After enter 1st line item then enter, it will trigger to 996 routine but for the first time no value in TKOMV internal table

After complete the 996, the table gets values, that is why after the Price Update for LIne 10 condition record is picked up and for Line 20 condition is picked up even without price update.

Question

What other table to use besides TKOMV?

How to make TKOMV pick up value at the 1st check itself.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

yes tried

moazzam_ali
Active Contributor
0 Kudos

Dear

Have you tried in TKOMP and TKOMK?

Thank$

Former Member
0 Kudos

Does TKOMV cantain any condition data?

Regards

Waza

Former Member
0 Kudos

the table was empty

Former Member
0 Kudos

I also find the VOFM routines need "break-points".  Are you sure that it is not just going into "header" first and then the second loop is into the "item".

For example:-

FORM KOBED_995.
FORM KOBEV_995.

Regards

Waza

Former Member
0 Kudos

995 is totally different requirement routine.

I have made condition type ZPMF to tie with routine 996 only.

Former Member
0 Kudos

form Kobed is called on item level, form Kobev is called on header level.

Does this help!!

Regards


Waza

Former Member
0 Kudos

based on the debug screen (attached) it is reading Item Level KOBED.

What changes should I be doing here?