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

ALV

Hi,

In FM Reuse_alv_grid_display the exporting parameter I_structure_name must be same as the name of the database table and t_outtab is the name of the table whose structure is same as database table.

My question is if I make a internal table whose structure is made with the haelp of two diffrent tables. In that situation what should be my I_structure_name value.

Provide some code with description since I have less knowledge on how to do.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 08:46 AM

    Hi Praveen ,

    In that case you will have to use a field catalog .

    Field catalog is basically a table which contains the detials of which all fields are to be displayed.

    in the FM check the parameter IT_FIELDCAT.

    Regarsd

    Arun

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 08, 2007 at 08:48 AM

    Hi,

    t_outtab is the structure it may contains the fields or as you said may be two tables.

    You can pass the internal table name as

    I_structure_name = 'T_OUTTAB'. (caps)

    Otherwise you can create a structure using se11 and give the name here. Thats is a good approach.

    If you use only one table then u can specify as I_structure_name = 'MARA'.

    The main thing is the strcuure name should be in caps.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 08:48 AM

    if you dont want to make the field catalog then you have to craete the same structure in database as of your internal table.

    other wise you create your own field catalog and pass it in the fn module.

    regards

    shiba dutta

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 08:48 AM

    If u r internal table fields are from more than one database table then no need to pass the value to i_structure_name.

    Just build fieldcatalog and pass it to it_fieldcat parameter.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 08:52 AM

    u have to use fieldcatalog merge function.

    Please refer demo code as below,reward if helpfull-

    REPORT ZGILL_ALV message-id rp .

    type-pools slis.

    tables: zgill_main,zgill_details.

    data z_fieldcat type slis_t_fieldcat_alv.

    data begin of itab occurs 0.

    DATA ICON TYPE ICON-ID.

    include structure zgill_main.

    data salary like zgill_details-salary.

    data end of itab.

    *data itab1 like table of itab with header line.

    data : WA_SORT TYPE SLIS_SORTINFO_ALV,

    IT_SORT TYPE SLIS_T_SORTINFO_ALV,

    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

    IT_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,

    WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

    PARAMETERS: p_list radiobutton group A1,

    P_GRID RADIOBUTTON GROUP A1.

    SELECT-OPTIONS: S_PERNR FOR ZGILL_MAIN-PERNR.

    start-of-selection.

    perform fill_itab.

    perform sort_list.

    perform fill_fieldcat1 changing z_fieldcat. "Preparing field catalog with merge function

    perform display_alv.

    *****************end of scenario without container*****************************************

    &----


    *& Form fill_itab

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form fill_itab .

    *select * from zgill_main up to 20 rows INTO CORRESPONDING FIELDS OF TABLE itab.

    *ITAB1[] = ITAB[].

    select apernr aname aorg adob b~salary INTO CORRESPONDING FIELDS OF TABLE itab

    from zgill_main as a join zgill_details as b on apernr = bpernr

    WHERE A~PERNR IN S_PERNR.

    endform. " fill_itab

    &----


    *& Form display_alv

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form display_alv .

    data repid like sy-repid.

    REPID = SY-REPID.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = repid

    IT_FIELDCAT = IT_FIELDTAB

    TABLES

    t_outtab = itab[]

    EXCEPTIONS

    PROGRAM_ERROR = 1

    OTHERS = 2.

    .

    IF sy-subrc <> 0.

    message e016 with 'Error in Display'.

    ENDIF.

    endform. " display_alv

    &----


    *& Form fill_fieldcat1

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form fill_fieldcat1 changing d_fcat type slis_t_fieldcat_alv.

    data repid like sy-repid.

    data d_fcat1 type slis_t_fieldcat_alv with header line.

    REPID = SY-REPID.

    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

    EXPORTING

    I_PROGRAM_NAME = repid

    I_INTERNAL_TABNAME = 'ITAB'

    I_STRUCTURE_NAME = 'ZGILL_MAIN'

    • I_CLIENT_NEVER_DISPLAY = 'X'

    • I_INCLNAME =

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE =

    CHANGING

    ct_fieldcat = d_fcat[]

    EXCEPTIONS

    INCONSISTENT_INTERFACE = 1

    PROGRAM_ERROR = 2

    OTHERS = 3.

    IF sy-subrc <> 0.

    message e016 with 'Error in preparing fiedl catalog'.

    ENDIF.

    loop at d_fcat into d_fcat1.

    case d_fcat1-fieldname.

    when 'NAME'.

    d_fcat1-reptext_ddic = 'Emp Name'.

    MODIFY D_FCAT FROM D_FCAT1.

    WHEN 'PERNR'.

    d_fcat1-reptext_ddic = 'Emp Num'.

    MODIFY D_FCAT FROM D_FCAT1.

    WHEN 'ORG'.

    d_fcat1-reptext_ddic = 'Org Unit'.

    MODIFY D_FCAT FROM D_FCAT1.

    endcase.

    clear d_fcat1.

    endloop.

    endform. " fill_fieldcat1

    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.