cancel
Showing results for 
Search instead for 
Did you mean: 

Loop fields in an internal table

0 Kudos

Dear experts,

I have a scenario where I have an internal table (created in an end routine) c of felds that are both characteristics and key figures. I would like to do is to modify this table so that I keep the value of the charactersitics but I set the value of all the key figures to 0. How can I acomplish this and what is the best way? Is there for example a way to loop all the fields in the work area when I am looping though the internal table and then dependant on the data type, set the key figues = 0?

Thanks!

-Cathrin

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Ok, thanks.

-Cathrin

0 Kudos

Ok, that was what I have done but would like to try to avoid this since there are quite a lot of key fiigures and every time anyone does adds/changes a key figure, this will have to be modifided as well.

I think I have found a function module to determine the data type of a field, DDIF_FIELDINFO_GET. Please confirm that is not possible to loop the fields in a work area.

Thanks,

Christina

Former Member
0 Kudos

Hi There,

No, looping of fields is not possible. You can only loop on internal tables.

Regards,

Hemant Khemani

Former Member
0 Kudos

Hi Cathrin,

It will not be possible to set the key figures to zero based on data type.

You will have to set each key figure in the loop.

Example:

LOOP ITAB INTO WA_ITAB.
    WA_ITAB-KEYFIGURE1 = 0.
    WA_ITAB-KEYFIGURE2 = 0.
    MODIFY ITAB FROM WA_ITAB.
ENDLOOP.

Regards,

Hemant Khemani