Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

add the internal table fields

Hi

Following is my final internal table values

A/c  Ord.No  m/c cost mfg cost std cost raw cost  other  total
121  12-test  100.00    0.00        0.00       50.00    50.00 200.00
121  12-test    50.00    50.00     -10 .00     50.00   50.00 190.00
121   34-test  100.00     0.00       0.00       50.00   50.00 150.00
121   34-test    25.00     0.00       0.00       25.00   25.00  75.00

I want to change my output to (I want to add the costs using Ord. No field)
A/c  Ord.No  m/c cost mfg cost std cost raw cost  other  total
121  12-test  150.00    50.00    -10 .00   100.00   100.00  390.00
121  34-test   125.00     0.00       0.00      75.00    75.00  225.00

Please help me.

Tags:
Former Member
replied

Hi

Use AT END OF statement as in below code.

LOOP at itab.
  
  lwa_temp-acoount = itab-account.
  lwa_temp-ord_no = itab-ord_no.
  ADD itab-mc_cost TO lv_mc_cost. " Do the same for all fields
  
  AT END OF ORD_NO.
    lwa_temp-mc_cost = lv_mc_cost " Do the same for all fields
    APPEND lwa_temp TO lt_temp.
  ENDAT.
  
ENDLOOP.

" Now lt_temp will have final vaues

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question