‎2008 Jan 24 5:09 AM
crd date crd qty cpd date cpd qty
01/02/2008 1000 03/01/2008 500
15/02/2008 300 05/01/2008 500
17/01/2008 700 06/01/2008 600
06/01/2008 400
In this eg... 1000 of crd qty is splitted into 500,500
and 600 of cpd qty is splitted into 300,300
and 700 of crd qty is splitted into 300,400.
The output should appear as follows:
CRD Date CRD Qty CPD Date CPD Qty
01/02/08 500 03/01/08 500
01/02/08 500 05/01/08 500
15/02/08 300 06/01/08 300
17/01/08 300 06/01/08 300
17/01/08 400 06/01/08 400
The code which i have written is as follows
types: begin of it_final ,
edatu type d," like vbep-edatu,
wmeng like vbep-wmeng,
bmeng like vbep-bmeng,
zedatu_cpd like zcpdcurr-zedatu_cpd,
zwmeng_cpd like zcpdcurr-zwmeng_cpd,
end of it_final.
data:
it_final type standard table of it_final with header line,
wa_final type it_final.
*--
data: begin of it_crd occurs 0,
edatu like vbep-edatu,
wmeng like vbep-wmeng,
end of it_crd.
*--
data: begin of it_csd occurs 0,
edatu like vbep-edatu,
bmeng like vbep-bmeng,
end of it_csd.
*--
data : begin of it_cpd occurs 0,
zedatu_cpd like zcpdcurr-zedatu_cpd,
zwmeng_cpd like zcpdcurr-zwmeng_cpd,
end of it_cpd.
*---Appending the internal tables---
it_crd-edatu = '20081001'.
it_crd-wmeng = '1000'.
append it_crd.
clear it_crd.
it_crd-edatu = '20081201'.
it_crd-wmeng = '300'.
append it_crd.
clear it_crd.
it_crd-edatu = '20081401'.
it_crd-wmeng = '700'.
append it_crd.
clear it_crd.
*----
it_cpd-zedatu_cpd = '20081101'.
it_cpd-zwmeng_cpd = '500'.
append it_cpd.
clear it_cpd.
it_cpd-zedatu_cpd = '20081901'.
it_cpd-zwmeng_cpd = '500'.
append it_cpd.
clear it_cpd.
it_cpd-zedatu_cpd = '20082301'.
it_cpd-zwmeng_cpd = '600'.
append it_cpd.
clear it_cpd.
it_cpd-zedatu_cpd = '20083001'.
it_cpd-zwmeng_cpd = '400'.
append it_cpd.
clear it_cpd.
*----
write:/'CRD ...............'.
loop at it_crd.
write:/ it_crd-edatu,it_crd-wmeng.
endloop.
skip 2.
write: /'CPD ...............'.
loop at it_cpd.
write:/ it_cpd-zedatu_cpd,it_cpd-zwmeng_cpd.
endloop.
data: v_temp_g type p,
v_temp_l type p.
loop at it_crd.
loop at it_cpd.
if it_cpd-zwmeng_cpd lt it_crd-wmeng.
v_temp_g = it_crd-wmeng - it_cpd-zwmeng_cpd.
modify table it_cpd.
delete table it_cpd .
it_crd-wmeng = v_temp_g .
clear v_temp_g.
elseif it_cpd-zwmeng_cpd gt it_crd-wmeng.
v_temp_g = it_cpd-zwmeng_cpd - it_crd-wmeng.
delete table it_cpd.
it_cpd-zwmeng_cpd = v_temp_g.
modify table it_cpd.
clear v_temp_g.
exit.
elseif it_cpd-zwmeng_cpd eq it_crd-wmeng or
it_crd-wmeng eq it_cpd-zwmeng_cpd .
delete table it_cpd.
delete table it_cpd.
clear v_temp_g.
exit.
endif.
endloop.
endloop.
Now actually the problem is that when the cpd qty is greater, what ever difference qty we are getting we are not able to compare with the next crd qty . it is getting exit from inner and outerloop.
pls help with suitable code...
‎2009 Nov 09 8:47 AM