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

query about the Selection condition.

Former Member
0 Likes
561

Hi to all ,

Please can u give me the code for this logic.

i am not getting any out put with my logic .

Go to VBRK with VBRK-VBELN = ITAN1-VBELN and get from field KNUMV the condition record number. Then for each ITAB1-POSNR of this ITAB1-VBELN go to KONV with:

KONV-KNUMV = VBRK-KNUMV

KONV-KPOSN = ITAB1-POSNR

KONV-KSCHL = the condition selected from /GIL/ZGTYPCODE_V for this Sales org and FUNCTION = 'WICREV'

get from field KBETR the condition rate from KPEIN the pricing unit and from KUMZA and KUMNE the conversion factors.

Calculate then the selling price per 1000 PUs as follows:

(KBETR / KPEIN) x 1000 x (KUMNE/KUMZA)

Update with the calculated value ITAB1-KBETR for the the related line of ITAB1

thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
521

Hi

Rough logic for the code:

declare the internal table for condition types i_kschl , i_price

and the i_vbrk with the necessary fields.

select kschl into table i_kschl

from /GIL/ZGTYPCODE_V where vkorg = <value> and FUNCTION = 'WICREV'.

if not itan1[] is initial.

select avbeln aknumv b~posnr into table i_vbrk

from vbrk as a join vbrp as b on avbeln = bvbeln

for all entries in itan1

where vbeln = itan1-vbeln.

endif.

if not i_vbrk{} is initial.

select knumv kposn kbetr KPEIN KUMZA KUMNE from

konv into table i_price

for all entries in i_vbrk

where knumv = i_vbrk-knumv and

kposn = i_vbrk-posnr.

endif.

loop at itan1.

Read the internal tables i_price and update the prices value into the corresponding field with the formula

(KBETR / KPEIN) x 1000 x (KUMNE/KUMZA)

Modify the itan1 index sy-tabix transporting <field>.

endloop.

Reward points if useful

Regards

Anji

2 REPLIES 2
Read only

Former Member
0 Likes
521

Post your code, and the output you wanted, i can give you the corrected code.

Read only

Former Member
0 Likes
522

Hi

Rough logic for the code:

declare the internal table for condition types i_kschl , i_price

and the i_vbrk with the necessary fields.

select kschl into table i_kschl

from /GIL/ZGTYPCODE_V where vkorg = <value> and FUNCTION = 'WICREV'.

if not itan1[] is initial.

select avbeln aknumv b~posnr into table i_vbrk

from vbrk as a join vbrp as b on avbeln = bvbeln

for all entries in itan1

where vbeln = itan1-vbeln.

endif.

if not i_vbrk{} is initial.

select knumv kposn kbetr KPEIN KUMZA KUMNE from

konv into table i_price

for all entries in i_vbrk

where knumv = i_vbrk-knumv and

kposn = i_vbrk-posnr.

endif.

loop at itan1.

Read the internal tables i_price and update the prices value into the corresponding field with the formula

(KBETR / KPEIN) x 1000 x (KUMNE/KUMZA)

Modify the itan1 index sy-tabix transporting <field>.

endloop.

Reward points if useful

Regards

Anji