Skip to Content

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

Adding Specific columns of dynamic internal table row into another column

Hi Gurus,

I need to add few columns of a dynamic internal table row into another column:

Article description hy01 hy02 total
101      panza         10     12      22
102      masht         12     12     24

dynamic internal table is created and columns hy01 hy02.... can increase

How to add the the values in hy01 hy 02... into total.



Former Member


You declare your Filedcatalog like f1 f2 f3 ... dynamically by adding 1 and concatinating f.

get the count of fields. let say 3.

n = cont . " number of fields or columns

loop at itab into wa.
do n times.                              " here n = 3.

do the same here.. concatenate f and 1 in to *field*.

assign component  *field*  <field symbol WA> to <fs>
lv_total = lv_total + <fs>. 


assign component Total of <field symbol WA> to <fs_total>

<fs_total> = lv_total.


hope this helps u.,

Thanks & Regards,


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