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.

Regards,

Dep

Former Member
replied

Hi.,

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>. 

enddo.

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

<fs_total> = lv_total.

endloop.

hope this helps u.,

Thanks & Regards,

Kiran

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