Application Development 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: 

Shipment Stage

Former Member
0 Kudos

Dear All,

"Determine the proportion of the stage distance to the total shipment distance.

To calculate the proportion, determine the distance for each stage (VTTS-DISTZ) and add all the distance for all stages. Then for each stage, divide the stage distance to the total distance to get the proportion".

Will you please let me know to do this calculation?

Thanks in Advance,

Ranjan

8 REPLIES 8

Former Member
0 Kudos

data: begin of itab occurs 0,

distz like vtts-distz,

prop like vtts-distz,

end of itab.

data: gv_distz like vtts-distz,

lv_distz like vtts-distz.

select distz into lv_distz from vtts.

gv_distz = gv_distz + lv_distz .

itab-distz = lv_distz .

append itab.

clear:lv_distz .

endselect.

loop at itab.

itab-prop = gv_distz / itab-distz .

modify itab.

endloop.

former_member181962
Active Contributor
0 Kudos

select TKNUM

TSNUM

DISTZ

into table itab

where tknum in s_tknum.

loop at itab.

clear v_distz.

loop at itab where tknum = itab-tknum.

v_ditsz = v_distz + itab-distz.

endloop.

itab_new-tknum = itab-tknum.

itab_new-tsnum = itab-tsnum.

itab_new-avg_distz = itab-distz / v_distz.

append itab_new.

clear itab_new.

endloop.

Regards,

Ravi

0 Kudos

Dear Ravi and Kishan,

Thanks for your replies. Will you please let me know how to find out the number of the stages in the table? Means pls. let me know the field.

Thanks,

Ranjan

0 Kudos

Hi KCR,

do this way:

loop at itab.

at new tknum.

clear v_count.

loop at itab where tknum = itab-tknum.

v_count = v_count + 1.

endloop.

write: v_count 'Is the number of stages for the shipment' itab-tknum.

endat.

endloop.

Regards,

Ravi

P.s: Please reward helpful posts

0 Kudos

Hi KCR,

It is TSNUM field in VTTS table.

Thanks & Regards,

YJR.

0 Kudos

Dear Ravi,

Thanks for the reply. There won't be any selection screen.

So, shall I keep the sql statement like this?

select TKNUM

TSNUM

DISTZ

into table itab.

Also, will you kindly provide me the whole code?

Thanks so much,

Ranjan

0 Kudos

We need to write the above code after the below condition

If VFKP-KOSTY = ‘A’ (the shipment cost item is at header level), then...

Thanks

Ranjan

0 Kudos

Dear Ravi,

Will you please let me know how to go ahead with my issue.

Thanks,

KCR