Application Development 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: 

display different result

Former Member
0 Kudos

Hi everyone, i'm beginner in ABAP langage and i have a question plz
How can i display 2 different résults from 2 tables ( SFLIGHT / SPFLI ) depending on the radiobutton chosen in the selection screen IN the same ALV with CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'.

thnx.

1 ACCEPTED SOLUTION

anujawani2426
Active Participant
0 Kudos

Hi,

Please try below sample code. You can add parameter or select-options as per your requirement.

SELECTION-SCREEN BEGIN OF block b1 WITH FRAME.
PARAMETERS:P_Sfl RADIOBUTTON GROUP rad DEFAULT 'X',
p_spfli RADIOBUTTON GROUP rad.
SELECTION-SCREEN END OF block b1.
data: it_sflight type table of sflight,
it_spfli type table of spfli,
wa_sflight type sflight,
wa_spfli type spfli.
START-OF-SELECTION.
if p_sfl = 'X'.
select *
from sflight
into table it_sflight.
ELSEIF p_spfli = 'X'.
select *
from spfli
into table it_spfli.
endif.
if p_sfl = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_STRUCTURE_NAME = 'sflight'
TABLES
t_outtab = it_sflight
.
ELSEIF p_spfli = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
       I_CALLBACK_PROGRAM                = sy-repid
I_STRUCTURE_NAME = 'spfli'
TABLES
t_outtab = it_spfli
.
endif.

Regards,

Anuja Kawadiwale

3 REPLIES 3

AlexGourdet
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thank you for visiting SAP Community to get answers to your questions.

Since you're asking a question here for the first time, I'd like to recommend you with the following steps so you can get the most out of your community membership:

I also recommend that you include a profile picture. By personalizing your profile, you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html.

I hope you find this advice useful, and we're happy to have you as part of SAP Community!

All the best,
-Alex

anujawani2426
Active Participant
0 Kudos

Hi,

Please try below sample code. You can add parameter or select-options as per your requirement.

SELECTION-SCREEN BEGIN OF block b1 WITH FRAME.
PARAMETERS:P_Sfl RADIOBUTTON GROUP rad DEFAULT 'X',
p_spfli RADIOBUTTON GROUP rad.
SELECTION-SCREEN END OF block b1.
data: it_sflight type table of sflight,
it_spfli type table of spfli,
wa_sflight type sflight,
wa_spfli type spfli.
START-OF-SELECTION.
if p_sfl = 'X'.
select *
from sflight
into table it_sflight.
ELSEIF p_spfli = 'X'.
select *
from spfli
into table it_spfli.
endif.
if p_sfl = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_STRUCTURE_NAME = 'sflight'
TABLES
t_outtab = it_sflight
.
ELSEIF p_spfli = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
       I_CALLBACK_PROGRAM                = sy-repid
I_STRUCTURE_NAME = 'spfli'
TABLES
t_outtab = it_spfli
.
endif.

Regards,

Anuja Kawadiwale

Nice, thnx a lot 🙂