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: 

Copying internal table values into select options

Former Member
0 Kudos

Hello all,

in the selection screen I am having two fields as select options, for eg date and vendor number. When date is filled, I would like to get the vendors automatically into the vendors field based on the date range.

I have created an internal table and retreived the values but unable to copy those into the select options field before executing the report.

can someone share their views on how to achive this.

thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Chakravarthy,

One option to do that is u can use AT SELECTION-SCREEN OUTPUT event...enter the dates and click enter... if u r getting the dates by F4 help then use the event AT SELECTION-SCREEN ON VALUE REQUEST... i hope it works...do let me know if this works..

good question anyway

14 REPLIES 14

yogendra_bhaskar
Contributor
0 Kudos

Hi Chakravarthy  ,

select options work same as range table ,

insert your data in select options as per as range table .

it will work

For help , View this :

TABLES SBOOK.

SELECT-OPTIONS FL_DATE FOR SBOOK-FLDATE.

INITIALIZATION.

  MOVE: 'BT' TO FL_DATE-OPTION,

  '19960101' TO FL_DATE-LOW,

  '19960630' TO FL_DATE-HIGH.

  APPEND FL_DATE.

MOVE: 'I' TO FL_DATE-SIGN,

      'EQ' TO FL_DATE-OPTION,

      SY-DATUM TO FL_DATE-LOW.    

APPEND FL_DATE.

raymond_giuseppi
Active Contributor
0 Kudos

(FAQ) Just loop at your internal table of vendors, and append records into the select-options parameter which is also an internal table, First read the select-options statement documentation.

Regards,

Raymond

PS: Spoiler (select to display) : If you cannot find it yourself , use SIGN = 'I', OPTION = 'EQ' and LOW = LIFNR.

Former Member
0 Kudos

Hi,

thanks for the replies, I am able to retreive the records, but my question is how can i populate them in the select options field before executing the report.

regards.

Chakravarthy

0 Kudos

Hi kumar ,

I am not getting exactly , what you want ?

You want to display the records on selection screen ?

or

you want to populate the records in select option ?

0 Kudos

Hi Yogendra,

I would like to populate the records.

scenario is we need to do some pre-work in excel and then copy them to the select option vendor field and then execute the report.

so I am able to retreive the records as needed but dont know how to populate them in the field, as there would be no user action other than keying in the required fields.

0 Kudos

hi  Chakravarthy ,

First of all write the code at selection screen output.

If you are getting the data from excel to any internal table e.g. it_tab

you have to write such code :

loop at it_tab into wa_itab.

MOVE: 'I'    TO S_VENDOR-SIGN,

           'EQ' TO S_VENDOR-OPTION,

           wa_itab-kunnr to s_vendor-low.

append s_vendor.

endloop.

former_member491621
Contributor
0 Kudos

Hi Kumar,

When date is filled, I would like to get the vendors automatically into the vendors field based on the date range.

From the above statement I assume you want to populate vendors within the selected date range. If so, then try the below code:

Suppose V_TAB is your vendor table.

DATA : wa_vendor LIKE LINE OF s_vendor.

DELETE V_TAB WHERE date > s_date-high and date < s_date-low.

SORT V_TAB ASCENDING BY vendor.

LOOP AT v_tab INTO wa_vtab.

wa_vendor-low = wa_vtab-vendor.

APPEND wa_vendor TO s_vendor.

ENDLOOP.

Hpoe this helps

Former Member
0 Kudos

Hi Chakravarthy,

do u mean to tell that as soon as u type or input the date in input field, ur select option for vendor should get populated...means without executing? I think that will not be possible in core abap..u can do that in webdynpro etc..

Former Member
0 Kudos

Hi Chakravarthy,

One option to do that is u can use AT SELECTION-SCREEN OUTPUT event...enter the dates and click enter... if u r getting the dates by F4 help then use the event AT SELECTION-SCREEN ON VALUE REQUEST... i hope it works...do let me know if this works..

good question anyway

0 Kudos

Hi Shahir,

i have tried at selection screen, but the issue is we cannot get the date values, anyways thanks a lot for all the inputs, maybe I should give some user event and use at user command.

0 Kudos

Hi Chakravarthy,

Maybe you can use function key in you selection screen. It allows you to add a button on the application toolbar of the screen. After you enter date on the screen, you can click the button and get the vendor values in the select-options.

Here You have to use the ucomm of the table SSCRFIELDS(for selection screen fields).

You have to right the code in AT SELECTION SCREEN event for the button.

Hope this helps

Do revert back if you nedd anything

0 Kudos

Is it possible to move the select statement output(structure) to the parameter value?

when I select the value from the search help of another parameter?

PARAMETERS:p1 TYPE zd_studentno MATCHCODE OBJECT z1132_sh,
p2 TYPE zd_studentname.

AT SELECTION-SCREEN OUTPUT .
SELECT SINGLE studentname FROM ztt_sd WHERE studentno = @p1 INTO @p2.

Clemenss
Active Contributor
0 Kudos

Hi chakravarthy kumar,

you need a selection-screen event.

You may use AT SELECTION SCREEN and put the code as mentioned here.

Check SAP help on report selection screen events.

Regards

Clemens

Former Member
0 Kudos

thanks all, with at selection screen output was able to achive it.

so-vendor-sign = i

so-vendor-option = eq

loop at itab

so-vendor-low = itab-vendor1.

append so-vendor.

endloop