06-08-2022 3:31 PM
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.
06-08-2022 4:14 PM
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
06-08-2022 3:31 PM
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,06-08-2022 4:14 PM
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
06-08-2022 10:03 PM