Skip to Content
author's profile photo Former Member
Former Member

create select-options using internal table

Hello,

I have number of table-fields in one internal table.

I need to create select-options on screen for each of the table field in that internal table.

Can anybody please provide a code for it ?

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

9 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 06:32 AM

    Try this sample code:

    REPORT z_demo_jg1 LINE-COUNT 10(2) NO STANDARD PAGE HEADING.

    DEFINE option.

    select-options : s_&1 for w_itab-&1.

    END-OF-DEFINITION.

    TYPES: BEGIN OF ty_itab,

    vbeln LIKE vbap-vbeln,

    posnr LIKE vbap-posnr,

    werks LIKE vbap-werks,

    END OF ty_itab.

    DATA: t_itab TYPE TABLE OF ty_itab,

    w_itab TYPE ty_itab.

    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.

    option : vbeln,posnr,werks.

    SELECTION-SCREEN END OF BLOCK b1.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 06:06 AM

    using ranges.u can achive.

    loop the internal table.......

    and pass the value in range option..

    Regards

    Anbu B

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 06:09 AM

    simply write like that.

    select-options <name> for itab-<field name>.

    thanks & regards

    abhishek

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 19, 2008 at 06:05 AM

    select-options : s_field1 for table1-field1.

    select-options : s_field2 for table2-field2.

    select-options : s_field3 for table2-field3.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 06:16 AM

    hiii

    still you are having problem to write code or its satisfy you

    thanks & regards

    abhishek

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 06:18 AM

    hi,

    you can create in this way :

    select-options: <name> for itab-<field name>.

    example code:

    TABLES: vbak.    " standard table
     
    TYPE-POOLS: slis.
     
    *-- Structure to hold data from table 
    TYPES: BEGIN OF tp_itab1,
           vbeln LIKE vbap-vbeln,
           posnr LIKE vbap-posnr,
           werks LIKE vbap-werks,
           lgort LIKE vbap-lgort,
           END OF tp_itab1.
     
    *-- Data Declaration
     
    DATA: t_itab1 TYPE TABLE OF tp_itab1.
    DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
     
    *----------------------------------------------------------------------*
    *                    Selection  Screen                                 *
    *----------------------------------------------------------------------*
    *--Sales document-block
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
                                 s_posnr FOR vbap-posnr,
                                 s_werks FOR vbap-werks,
                                s_lgort  FOR vbap-lgort.*
    SELECTION-SCREEN END OF  BLOCK b1.

    hope it will help you

    regards

    Rahul sharma

    Edited by: RAHUL SHARMA on Sep 19, 2008 8:25 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 06:25 AM

    Hey guys.

    Thanks for your replies.

    Actually problem is that, internal table may contain random number of table-fields , hence i can not hard code the select-options.

    I want to create them dynamically according to number of table-fields present in internal table.

    Thanks a lot.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 06:26 AM

    Hi,

    See the sample code.

    TABLES:spfli.

    TYPES: BEGIN OF ty_spfli,

    carrid TYPE spfli-carrid,

    connid TYPE spfli-connid,

    cityfrom TYPE spfli-cityfrom,

    cityto TYPE spfli-cityto,

    END OF ty_spfli.

    data: wa_spfli type ty_spfli.

    data: it_spfli type STANDARD TABLE OF ty_spfli.

    selection-screen begin of block b1 with frame.

    select-options: s_carrid for wa_spfli-carrid,

    s_connid for wa_spfli-connid,

    s_cityfr for wa_spfli-cityfrom,

    s_cityto for wa_spfli-cityto.

    selection-screen end of block b1.

    Regards,

    Kumar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 06:48 AM

    Thanks ..

    Points assigned to everyone..!!!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.