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

help in daynamic select

Hi,

i do FM and i wont to give to user option which field to select

i try to move name field to variable and try to do it all time with change field,how i can do that i try like below and i have error .

Regards

TYPES : BEGIN OF ab,
        dim0calmonth TYPE /bi0/oicalmonth,
        dim0costcenter TYPE /bi0/oicostcenter,
        change_fld TYPE p DECIMALS 2,
        END OF ab.

data: fl_tab type table of ab.



    SELECT  dim0calquarter dim0costcenter  ( key_field )
      FROM /bic/0 
      INTO  TABLE fl_tab
      FOR ALL ENTRIES IN leaf_tab
      WHERE dim0costcenter =  leaf_tab-dim0costcenter
      AND dim0calquarter = year_q
      AND dim0curtype = curr_type.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Jun 17, 2008 at 01:38 PM

    Hi,

    You need to create a dynamic internal table for fl_tab using field symbols and your internal table contains the field1 field2 and keyfield from user selection then change the select statement like the following

    SELECT  * from
          FROM /bic/0 
          INTO  corresponding fields of TABLE <fl_tab>
          FOR ALL ENTRIES IN leaf_tab
          WHERE dim0costcenter =  leaf_tab-dim0costcenter
          AND dim0calquarter = year_q
          AND dim0curtype = curr_type.
    

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 01:37 PM

    Hi,

    Pl. see the code below. May be it will help u.

    parameters: cities as checkbox,

    carriers as checkbox,

    seats as checkbox,

    names as checkbox.

    data: begin of wa,

    carrid type sbook-carrid,

    connid type sbook-connid,

    fldate type sbook-fldate,

    customid type sbook-customid,

    cityfrom type spfli-cityfrom,

    cityto type spfli-cityto,

    carrname type scarr-carrname,

    seatsmax type sflight-seatsmax,

    seatsocc type sflight-seatsocc,

    name type scustom-name,

    end of wa,

    from type string value u2018sbook as bu2018,

    list type string value

    u2018bcarrid bconnid bfldate bcustomidu2018.

    if cities = 'X'.

    concatenate

    from u2018 join spfli as p on bcarrid = pcarrid and bconnid = pconnidu2018

    into from.

    concatenate list u2018 cityfrom citytou2018 into list.

    endif.

    if carriers = 'X'.

    concatenate

    from u2018 join scarr as c on bcarrid = ccarridu2018 into from.

    concatenate list u2018 c~carrnameu2018 into list.

    endif.

    if seats = 'X'.

    concatenate

    from u2018 join sflight as fu2018

    u2018 on bcarrid = fcarrid and bconnid = fconnid and bfldate = ffldateu2018

    into from.

    concatenate list u2018 seatsmax, seatsoccu2018 into list.

    endif.

    if names = 'X'.

    concatenate

    from u2018 join scustom as u on bcustomid = uidu2018 into from.

    concatenate list u2018 nameu2018 into list.

    endif.

    select (list) from (from) into corresponding fields of wa. << Without any space

    write: / wa-connid, wa-carrid, wa-fldate, wa-customid.

    if cities = 'X'.

    write: wa-cityfrom, wa-cityto.

    endif.

    if carriers = 'X'.

    write: wa-carrname.

    endif.

    if seats = 'X'.

    write: wa-seatsmax, wa-seatsocc.

    endif.

    if names = 'X'.

    write: wa-name.

    endif.

    endselect.

    Regards,

    Joy.

    Edited by: Joyjit Ghosh on Jun 17, 2008 3:40 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 01:38 PM

    Hello,

    Avoid this ->>dim0calquarter dim0costcenter ( key_field )

    and create the selection itself with a * and use INTO CORRESPONDING.......

    example

    SELECT *

    FROM /bic/0

    INTO CORRESPONDING FIELDS OF TABLE fl_tab

    FOR ALL ENTRIES IN leaf_tab

    WHERE dim0costcenter = leaf_tab-dim0costcenter

    AND dim0calquarter = year_q

    AND dim0curtype = curr_type.

    also you can create the selection fields on one string....but not sure if it works....

    example

    DATA slc type string.

    concatenate 'dim0calquarter' 'dim0costcenter' 'key_field' into

    slc separated by space.

    SELECT slc

    FROM /bic/0

    INTO TABLE fl_tab

    FOR ALL ENTRIES IN leaf_tab

    WHERE dim0costcenter = leaf_tab-dim0costcenter

    AND dim0calquarter = year_q

    AND dim0curtype = curr_type.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 01:33 PM

    Hi,

    this is the error that i get how can i avoid it?

    Unknown column name "(" until runtime, you cannot specify a field list.

    regards

    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.