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

internal table values to select-options

Former Member
0 Likes
2,397

Hi,

I have to modify an existing program.

here

1. I am populating one field in the selection-screen with a file path which contain some data.

2. then this file i am converting into an internal table.(At selection-screen event)

<b>Now, i have to pass this data of the internal table to a select-option in the selection-screen back.</b>

how it is possible, i have tried a lot.

please help me.

Regards,

Maahi.

Hi,

I have to modify an existing program.

here

1. I am populating one field in the selection-screen with a file path which contain some data.

2. then this file i am converting into an internal table.(At selection-screen event)

<b>Now, i have to pass this data of the internal table to a select-option in the selection-screen back.</b>

how it is possible, i have tried a lot.

please help me.

Regards,

Maahi.

8 REPLIES 8
Read only

Former Member
0 Likes
1,391

Hi maahi,

Can you just paste your existing code so that I can suggest the changes.

Regards,

Atish

Read only

0 Likes
1,391
tables bkpf.

data: begin of itab occurs 0.
INCLUDE STRUCTURE alsmex_tabline.
data end of itab.

PARAMETERS p_fpath like rlgrap-filename.

SELECT-OPTIONS rbelnr FOR bkpf-belnr.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fpath.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
 EXPORTING
*   PROGRAM_NAME        = SYST-REPID
*   DYNPRO_NUMBER       = SYST-DYNNR
*   FIELD_NAME          = ' '
   STATIC              = 'X'
*   MASK                = ' '
  CHANGING
    FILE_NAME           = p_fpath
* EXCEPTIONS
*   MASK_TOO_LONG       = 1
*   OTHERS              = 2
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
  EXPORTING
    FILENAME                      = p_fpath
    I_BEGIN_COL                   = 1
    I_BEGIN_ROW                   = 1
    I_END_COL                     = 1
    I_END_ROW                     = 2000
  TABLES
    INTERN                        = itab
* EXCEPTIONS
*   INCONSISTENT_PARAMETERS       = 1
*   UPLOAD_OLE                    = 2
*   OTHERS                        = 3
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

sort itab by value.
delete adjacent duplicates from itab comparing value.

now after this i have to implement the logic in 3rd point.

thanks ,

Maahi

Read only

0 Likes
1,391

HI Maahi verma,

This feature is already there in a normal select-option/

Just do this.

SELECT-OPTIONS rbelnr FOR bkpf-belnr.

Whne you have a file with all the BELNRs in a file.

You just have to run the program.

Click on the Multiple selection Button on the selection-screen.

Click on the "Import from the text file" button on the pop up.(Shift+f11).

Then you can browse for your file and transfer the values in to select-option.

Regards,

Ravi

Read only

0 Likes
1,391

You can write

loop at itab.

rbelnr-low = itab-value.

rbelnr-option = 'EQ'.

rbelnr-sign = 'I'.

append rbelnr.

clear rbelnr.

endloop.

after your code i.e. at selection screen.

Write your select query in START-OF-SELECTION

reward point if helpful

Read only

0 Likes
1,391

Hi ravikanth,

thats right. but i cant sort those data and delete the duplicate entries,if i directly fetch the file from multiple selection screen option.

thanks,

maahi

Read only

Former Member
0 Likes
1,391

loop at itab.

s_sopt-low = itab-value.

s_sopt-option = 'EQ'.

s_sopt-sign = 'I'.

append s_opt.

clear s_opt.

endloop.

Regards,

ravi

Read only

Former Member
0 Likes
1,391

Hi Maahi,

For whcih field do you want to populate the data?

See one appoach is:

Case1: I have 2 screen fields then If i select entries in first field related data should be displayed on selection screen.like,

at selection on <field>

at selection output.

Where you will pass the FM which takes input as screen field1 and output internal table.

Case2. May be after filling internal table you can set screen 0 and again call screen <selection-screen no>

Hope it helps.

Reward if useful!

Read only

Former Member
0 Likes
1,391

Hi Maahi,

Check whether you can write Call Screen again after filling select-option.

loop at itab.

sel_option-low = itab-value.

.

.

.

Append sel_option.

endloop.

Then call Screen