Application Development 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: 

Loop at Selection-Option

Former Member
0 Kudos
4,045

Hi Experts,

Select-options : so_budat like mseg-budat.

I need to loop that select-options.

How this can be done any idea.

This is due i need to loop at the select-options and read a internal table with that date.

Thank you.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
818

Hi,

You can apply loop on select-optoins table as follows:

loop at so_budat.

if so_budat-(low/High/sign/option) = <value>.

<process as per ur need>

endif.

endloop.

Hope this will help.

Regards,

Nitin.

8 REPLIES 8

Former Member
0 Kudos
818

Hi

Its simple

Loop at so_budat.

endloop.

You can access data inside loop as

so_budat-low

so_budat-high

so_budat-sign

so_budat-option.

Regards

Aditya

Former Member
0 Kudos
819

Hi,

You can apply loop on select-optoins table as follows:

loop at so_budat.

if so_budat-(low/High/sign/option) = <value>.

<process as per ur need>

endif.

endloop.

Hope this will help.

Regards,

Nitin.

Former Member
0 Kudos
818

Hi Sarvanannan,

Can you let us know what exactly you require. do you want to display the current date of the system or what.

Because if you use loop then there will be no execution of the report.

SuhaSaha
Advisor
Advisor
0 Kudos
818

Hello,

Can you plz elaborate a bit on your requirement?

From initial reading i understand that its not necessary to LOOP at Select-Options.

You can use this code.


LOOP AT ITAB WHERE BUDAT IN SO_BUDAT.
* Your Logic.
ENDLOOP.

Hope this is clear.

BR,

Suhas

Former Member
0 Kudos
818

Hi,

It is diffcult to loop at select-options unless you restrict the intervals and extensions. Remember that the user has a wide choice on the select option to choose The OPTION as CP, NE, NP, GE, LE etc.

He/she can enter ranges which you will have to determine programmitically.

However in addition to what Suhas suggested, you can alternatively check the date inside the loop if you want :


Loop at itab into wa
  if wa-budat in so_budat.
Endloop.

Rather best would be to put this in the where condition when you are selecting the data from the database itself.


Select * from dbtable
where budat in so_budat.

regards,

Advait

Former Member
0 Kudos
818

hi ,

report dummy.

tables: mara.

select-options: matnr for mara-matnr.

start-of-selection.

loop at matnr.

write: / matnr-sign,

matnr-option,

matnr-low,

matnr-high.

endloop.

regards

chinnaiya

Former Member
0 Kudos
818

Hi.

i hope, this will work for your requirement.

*To write the data in the output screen given by the user on the selection screen.

DATA: lv_variant TYPE raldb-variant.

lv_variant = sy-slset.

types: TYPES: BEGIN OF gt_selections,

selections TYPE c LENGTH 100,

END OF gt_selections.

data: gi_selections TYPE STANDARD TABLE OF gt_selections

CALL FUNCTION 'PRINT_SELECTIONS'

EXPORTING

mode = '1'

rname = sy-cprog

rvariante = lv_variant

TABLES

infotab = gi_selections

EXCEPTIONS

OTHERS = 1.

IF sy-subrc EQ 0.

LOOP AT gi_selections INTO gwa_selections.

WRITE / gwa_selections-selections.

ENDLOOP.

ENDIF.

Former Member
0 Kudos
818

Thank you everyone.