2009 Jan 29 7:41 AM
Hi ,
I have selected values from LIKPand LIPS by inner join and prepared one internal table ( which is suppose to be display in output also).
The table output comes as below :
VBELN POS LFART VKORG WADAT_IST WADAT MATNR VTWEG PRODH Total Line
80000093 10 ZLF 2000 0 20080609 GO1525 10 30
80000093 20 ZLF 2000 0 20080609 GO1525CTA 10 30
80000093 20 ZLF 2000 0 20080609 GO1525 10 90
Now we need to calculate Total line that a delivery which has similar product( prodh) it needs to add it
like in this case the output should be
VBELN POS LFART VKORG WADAT_IST WADAT MATNR VTWEG PRODH Total Line
80000093 10 ZLF 2000 0 20080609 GO1525 10 30 2
80000093 20 ZLF 2000 0 20080609 GO1525CTA 10 30 2
80000093 20 ZLF 2000 0 20080609 GO1525 10 90 1
Can you suggest how to calcuate the Total line value , how to do the comparison .
2009 Jan 29 9:26 AM
Hi
Sort the table by product.
Now rows having same product no will be adjacent to each other.
Now use AT...ENDAT stmt and SUM. Store these values .
Now you can use these values n update that many rows with that val.
For eg:
after sorting your data
prod
30
30
90
sum[] = 2 1.
so for first two rows set total line as 2. Do this using a temp var n decrementing.
Hope this helps
Regards,
Jayanthi.K
Hi
Sort the table by product.
Now rows having same product no will be adjacent to each other.
Now use AT...ENDAT stmt and SUM. Store these values .
Now you can use these values n update that many rows with that val.
For eg:
after sorting your data
prod
30
30
90
sum[] = 2 1.
so for first two rows set total line as 2. Do this using a temp var n decrementing.
Hope this helps
Regards,
Jayanthi.K
2009 Jan 29 7:51 AM
HI Anindita,
Instead of using append use collect statement while loding output table.
hope it help you.
regards,
LOkesh
2009 Jan 29 9:02 AM
This is not working.
Let me know some other way
Basically VBELN PRODH TOTAL LINES are important for total lines calculation
a 30 2
a 90 1
a 30 2
How do I compare the next row to the previous row in the internal table . Need some logic for that
2009 Jan 29 9:15 AM
Hello Anindita,
Plz change the structure of your internal table:
VBELN PRODH POS LFART VKORG WADAT_IST WADAT MATNR VTWEG Total Line
80000093 30 10 ZLF 2000 0 20080609 GO1525 10
80000093 30 20 ZLF 2000 0 20080609 GO1525CTA 10
80000093 90 20 ZLF 2000 0 20080609 GO1525 10
If this is possible then try the code below:
LOOP AT ITAB INTO WA.
V_CNT = V_CNT + 1.
AT END OF PRODH.
WA-TOTAL = V_CNT.
MODIFY ITAB FROM WA TRANSPORTING TOTAL
WHERE VBELN = WA-VBELN
AND PRODH = WA-PRODH.
CLEAR V_CNT.
ENDAT.
ENDLOOP.
Hope this helps.
BR,
Suhas
2009 Jan 29 9:26 AM
Hi
Sort the table by product.
Now rows having same product no will be adjacent to each other.
Now use AT...ENDAT stmt and SUM. Store these values .
Now you can use these values n update that many rows with that val.
For eg:
after sorting your data
prod
30
30
90
sum[] = 2 1.
so for first two rows set total line as 2. Do this using a temp var n decrementing.
Hope this helps
Regards,
Jayanthi.K
2009 Jan 29 10:14 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |