Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

generic loop

Former Member
0 Likes
1,087

Hello,

I would like to do a loop at a select-option, the name of the select-option is in charlike field gr_rsel_paras->*-NAME. Both solutions do not work, who can help me? Thanks a lot.

field-SYMBOLS: <fs_range_t> type ANY TABLE,

<fs_range_s> type ACE_PARAM_NAME_RANGE.

loop at gt_RSEL_PARAS REFERENCE INTO gr_RSEL_PARAS where kind = 'S'.

gs_valutab_sel-SELNAME = gr_rsel_paras->*-NAME.

gs_valutab_sel-KIND = gr_rsel_paras->*-kind.

ASSIGN (gr_rsel_paras->*-NAME) to <fs_range_t>.

  • Short dump

loop at <fs_range_t> into <fs_range_s>.

  • ...

endloop.

loop at (gs_valutab_sel-SELNAME) into <fs_range_s>.

  • ... doesn't work because of the '('

endloop.

8 REPLIES 8
Read only

Former Member
0 Likes
1,035

What is your requirement.. actually..??

Regards.

Read only

0 Likes
1,035

I want to fill the table gt_valutab_sel type RSPARAMS_TT with all select-options of my report to hand it over to a function module.

Read only

Former Member
0 Likes
1,035

Hi:

Try....

field-SYMBOLS: <fs_range_t> type ANY TABLE,

<fs_range_s> type ACE_PARAM_NAME_RANGE.

loop at gt_RSEL_PARAS REFERENCE INTO gr_RSEL_PARAS where kind = 'S'.

gs_valutab_sel-SELNAME = gr_rsel_paras->*-NAME.

gs_valutab_sel-KIND = gr_rsel_paras->*-kind.

append gs_valutab_sel to gt_valutab_sel (internal table)

ASSIGN gs_valutab_sel-SELNAME to <fs_range_t>.

loop at <fs_range_t> into <fs_range_s>.

  • ...

endloop.

loop at gt_valutab_sel into gs_valutab_sel

assign gs_valutab_sel-SELNAME-SELNAME into <fs_range_s>.

endloop.

Read only

0 Likes
1,035

Hi, I tested but it doesn't work, the select-options have many entries so I have to loop over the select-options. The name of the select-option is in gs_valutab_sel-SELNAME or gr_rsel_paras->*-NAME. Other suggestions?

Read only

0 Likes
1,035

Hi,

Use FM PRINT_SELECTIONS to get all your select options/parameters

Regards,

Srini.

Read only

0 Likes
1,035

Hi, PRINT_SELECTIONS prints the select-options in non-structured table, I finally need the values for further modification in my report in internal table with structure rsparams_tt. Do you know other FM which does this?

Read only

0 Likes
1,035

Hi..

Loop at the non structured table and move the contents of each iteration to another internal table which has structure similar to rsparams_tt.

Regards.

Read only

0 Likes
1,035

Hi, would be possible.

Thanks a lot for your help!!!

While testing, I've just found this solution.

FIELD-SYMBOLS: <fs_range_t> TYPE ANY TABLE,

<fs_range_s> TYPE ANY,

<fs_comp> TYPE ANY.

LOOP AT gt_rsel_paras REFERENCE INTO gr_rsel_paras WHERE kind = 'S'.

gs_valutab_sel-selname = gr_rsel_paras->*-name.

gs_valutab_sel-kind = gr_rsel_paras->*-kind.

CONCATENATE gs_valutab_sel-selname '[]' INTO gv_itab.

ASSIGN (gv_itab) TO <fs_range_t>.

LOOP AT <fs_range_t> ASSIGNING <fs_range_s>.

  • select-option has 4 fields (sign, option, high, low)

DO 4 TIMES.

ASSIGN COMPONENT sy-index OF STRUCTURE <fs_range_s> TO <fs_comp>.

CASE sy-index.

WHEN 1.

WRITE: / 'Sign: '.

gs_valutab_sel-sign = <fs_comp>.

WHEN 2.

WRITE: / 'Option: '.

gs_valutab_sel-option = <fs_comp>.

WHEN 3.

WRITE: / 'Low: '.

gs_valutab_sel-low = <fs_comp>.

WHEN 4.

WRITE: / 'High: '.

gs_valutab_sel-high = <fs_comp>.

ENDCASE.

WRITE <fs_comp>.

ENDDO.

APPEND gs_valutab_sel TO gt_valutab_sel.

ENDLOOP.

ENDLOOP.