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

Interactive report using ALV

i need to create a interactive report using alv. in my primary list i should display the account numbers from my account database table along with a check box beside them. when the user selects few check boxes it should go to the secondary list and display other fields from the database table for the selected account numbers..

is it possible to use alv in both the primary and the secondary list?

kindly help me out on this....

Nikhil.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 06:12 AM

    Hi Nikhil,

    Yes it is possible, u can display both lists as an ALV, u should concentrate on selection login in USER_COMMAND event of ALV

    Regards,

    Chaitanya.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 03:23 PM

    Hi, this code will work for u.

    report yh645_secndry_alv.

    type-pools: slis.

    data: fieldcat type slis_t_fieldcat_alv,

    fieldcat_ln like line of fieldcat,

    fs_layout type slis_layout_alv,

    t_layoout like standard table

    of fs_layout.

    data: begin of fs_spfli,

    carrid type spfli-carrid,

    connid type spfli-connid,

    countryfr type spfli-countryfr,

    cityfrom type spfli-cityfrom,

    airpfrom type spfli-airpfrom,

    countryto type spfli-countryto,

    cityto type spfli-cityto,

    airpto type spfli-airpto,

    fltime type spfli-fltime,

    deptime type spfli-deptime,

    arrtime type spfli-arrtime,

    distance type spfli-distance,

    distid type spfli-distid,

    fltype type spfli-fltype,

    period type spfli-period,

    checkbox,

    color(3),

    end of fs_spfli.

    data:

    begin of fs_table,

    carrid type spfli-carrid,

    connid type spfli-connid,

    end of fs_table.

    data: begin of fs_sflight,

    check,

    color(3).

    include type sflight.

    data:end of fs_sflight.

    data:

    begin of fs_table1,

    carrid type sflight-carrid,

    connid type sflight-connid,

    fldate type sflight-fldate,

    end of fs_table1.

    data:

    t_spfli like standard table

    of fs_spfli.

    data:

    t_table like standard table

    of fs_table.

    data:

    t_table1 like standard table

    of fs_table1.

    data:

    t_sflight like standard table

    of fs_sflight.

    data:

    t_sbook like standard table

    of sbook.

    data t_layout type slis_layout_alv.

    select *

    into corresponding fields of table t_spfli

    from spfli.

    perform start_list_viewer.

    perform get_spfli_details.

    &----


    *& Form SUB1

    &----


    • text

    ----


    • -->RT_EXTAB text

    ----


    form sub1 using rt_extab type slis_t_extab.

    data: flight type slis_extab.

    flight-fcode = 'SFLIGHT'.

    append flight to rt_extab.

    set pf-status 'SFLIGHT'. " EXCLUDING RT_EXTAB.

    endform. "SUB1

    &----


    *& Form START_LIST_VIEWER

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form start_list_viewer .

    data: pgm like sy-repid.

    pgm = sy-repid.

    fs_layout-box_fieldname = 'CHECKBOX'.

    fs_layout-info_fieldname = 'COLOR'.

    call function 'REUSE_ALV_LIST_DISPLAY'

    exporting

    i_callback_program = pgm

    i_callback_pf_status_set = 'SUB1'

    i_callback_user_command = 'USER_COMMAND'

    i_structure_name = 'SPFLI'

    is_layout = fs_layout

    tables

    t_outtab = t_spfli

    exceptions

    program_error = 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.

    endform. " START_LIST_VIEWER

    *******Process Call Back Events (Begin)**************************

    form user_command using ucomm like sy-ucomm

    selfield type slis_selfield.

    case ucomm.

    when 'SFLIGHT'.

    selfield-refresh = 'X'.

    perform get_spfli_details.

    select *

    from sflight

    into corresponding fields of table t_sflight

    for all entries in t_table

    where carrid eq t_table-carrid

    and connid eq t_table-connid.

    perform display_sflight.

    when 'SBOOK'.

    selfield-refresh = 'X'.

    perform get_sflight_details.

    select *

    from sbook

    into corresponding fields of table t_sbook

    for all entries in t_table1

    where carrid eq t_table1-carrid

    and connid eq t_table1-connid

    and fldate eq t_table1-fldate.

    perform display_sbook.

    endcase.

    endform. "USER_COMMAND

    &----


    *& Form SUB2

    &----


    • text

    ----


    • -->RT_EXTAB text

    ----


    form sub2 using rt_extab type slis_t_extab.

    data: flight type slis_extab.

    flight-fcode = 'SBOOK'.

    append flight to rt_extab.

    set pf-status 'SBOOK'. " EXCLUDING RT_EXTAB.

    endform. "SUB2

    &----


    *& Form DISPLAY_SFLIGHT

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form display_sflight .

    data: pgm like sy-repid.

    pgm = sy-repid.

    clear t_layout.

    fs_layout-box_fieldname = 'CHECK'.

    fs_layout-info_fieldname = 'COLOR'.

    call function 'REUSE_ALV_LIST_DISPLAY'

    exporting

    i_callback_program = pgm

    i_callback_pf_status_set = 'SUB2'

    i_callback_user_command = 'USER_COMMAND'

    i_structure_name = 'SFLIGHT'

    is_layout = fs_layout

    tables

    t_outtab = t_sflight

    exceptions

    program_error = 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.

    endform. " DISPLAY_SFLIGHT

    &----


    *& Form GET_SPFLI_DETAILS

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form get_spfli_details .

    loop at t_spfli into fs_spfli.

    if fs_spfli-checkbox = 'X'.

    fs_spfli-color = 'C51'.

    fs_spfli-checkbox = '1'.

    fs_table-carrid = fs_spfli-carrid.

    fs_table-connid = fs_spfli-connid.

    append fs_table to t_table.

    modify t_spfli from fs_spfli.

    endif.

    endloop.

    endform. " GET_SFLIGHT_DETAILS

    &----


    *& Form GET_SFLIGHT_DETAILS

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form get_sflight_details .

    loop at t_sflight into fs_sflight.

    if fs_sflight-check = 'X'.

    fs_sflight-color = 'C71'.

    fs_sflight-check = '1'.

    fs_table1-carrid = fs_sflight-carrid.

    fs_table1-connid = fs_sflight-connid.

    fs_table1-fldate = fs_sflight-fldate.

    append fs_table1 to t_table1.

    modify t_sflight from fs_sflight.

    endif.

    endloop.

    endform. " GET_SFLIGHT_DETAILS

    &----


    *& Form DISPLAY_SBOOK

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    form display_sbook .

    data: pgm like sy-repid.

    pgm = sy-repid.

    call function 'REUSE_ALV_LIST_DISPLAY'

    exporting

    i_callback_program = pgm

    i_structure_name = 'SBOOK'

    tables

    t_outtab = t_sbook

    exceptions

    program_error = 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.

    endform. " DISPLAY_SBOOK.

    kindly reward if found helpful.

    cheers,

    Hema.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 10:14 PM

    Check this thread..U have sample program.

    ALV INTERACTIVE REPORT

    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.