2008 Jan 24 5:08 AM
my internal table out put is like this
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... whenever crd qty> cpd qty
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(not 350,350).
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
points will be reward
my internal table out put is like this
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... whenever crd qty> cpd qty
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(not 350,350).
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
points will be reward
2008 Jan 24 5:20 AM
hi ,
Try following code.
loop at itab where crdqty > cpdqty.
itab-cpdqty = itab-crdqty / 2.
itab-crdqty = itab-cpdqty.
modify itab.
endloop.
use workarea if it is need.
L.Velu
2008 Jan 24 5:25 AM
hi
velu
here i have to split cpdqty only that too not in equal parts say
if cpdqty is 700 it should be divides into 300 & 400.
Regards
Nagesh.Paruchuri
2008 Jan 24 5:30 AM
Hi,
i missed last condition.
loop at itab where crdqty > cpdqty.
wa_tmp1 = itab-crdqty / 2.
wa_tmp2 = wa_tmp1 mod 100.
if wa_tmp2 eq 0.
itab-cpdqty = itab-crdqty / 2.
itab-crdqty = itab-cpdqty.
else.
itab-cpdqty = wa_tmp1 + wa_tmp2.
itab-crdqty = itab-crdqty - itab-cpdqty.
endif.
modify itab.
endloop.
reward me if useful.
L.Velu
2008 Jan 24 5:32 AM
Try Modulus Operation on the Quantity with 100.
If there is remainder apply ROUND Operation.
Then Subtract from Original Qty.
awrd points if useful
Bhupal
2008 Jan 24 5:37 AM
Hi,
Your explanation differs from the result.
your output shows that , divide CRD_QTY and assigning the same value to CPD_QTY.
Check the below:
Input recs:
15/02/2008 300 05/01/2008 500
17/01/2008 700 06/01/2008 600
Output recs for the above:
15/02/08 300 06/01/08 300 (even crdqty < cpdqty in input, result has been changed)
17/01/08 300 06/01/08 300
17/01/08 400 06/01/08 400 (cpdqty is same as crdqty)
What is the logic of dividing 700 into 300 & 400?
2008 Jan 24 5:41 AM
Hi,
Loop at itab in to wa_itab.
if wa_itab-crd_qty > wa_itab-cpd_qty.
wa_itab-crd_qty = wa_itab-crd_qty / 2.
l_diff = wa_itab-crd_qty MOD 100.
if l_diff <> 0.
l_crd_qty1 = wa_itab-crd_qty + 100 - l_diff.
l_crd_qty2 = wa_itab-crd_qty - l_diff.
else.
l_crd_qty1 = l_crd_qty2 = wa_itab-crd_qty.
endif.
wa_itab-crd_qty = l_crd_qty1.
append wa_itab to itab1.
wa_itab-crd_qty = l_crd_qty2.
append wa_itab to itab1.
else.
append wa_itab to itab1.
endif.
endloop.
Check if it can help you,
Thanks
ANUPAM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |