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

Condition value routine getting value zero at header level.

former_member150968
Participant
0 Likes
474

Hi Gurus,

I am trying to create one condition value routine in which I am passing xkwert = ( wa_vbap-cmpre * komp-mglme ) / 1000.

The condition works fine at item level where I get condition value as desired but at the header level, where it should show sum for all line items, it is showing 0. When I debugged, I found that somewhere in standard program, where it sums for line item, it is changing to negative and that is why it is getting zero but I was not able to correct it.

I am writing the code as follows.

DATA: wa_tab TYPE c LENGTH 1000,

I_VBAP TYPE STANDARD TABLE OF VBAP,

lv_komv like xkomv,

WA_VBAP TYPE VBAP.

FIELD-SYMBOLS <f1> TYPE ANY TABLE.

UNASSIGN <f1>.

wa_tab = '(SAPMV50A)XVBAP[]'.

ASSIGN (wa_tab) TO <f1>.

IF sy-subrc = 0.

i_vbap[] = <f1>.

ENDIF.

READ TABLE i_vbap INTO wa_vbap WITH KEY posnr = komp-kposn.

IF sy-subrc = 0.

xkwert = ( wa_vbap-cmpre * komp-mglme ) / 1000.

CLEAR wa_vbap.

ENDIF.

CLEAR: I_VBAP,

lv_komv.

What should I do? please help.

Regards,

Manish

1 REPLY 1
Read only

former_member150968
Participant
0 Likes
405

I found the solution.

If xkwert is initial.

xkwert = gkomv-xkwert.

endif.

Regards,

Manish