2011 Sep 30 2:30 PM
Hi Guys
I have coded a dynamic selection screen (shown below). I want to create an ALV report based on what the user enters in the selection screen. Is the right way of doing this to code an IF s_matnr is not initial statement then call all the subroutines for output of material data and then else call a second batch of subroutines for billing data. It seems a bit long winded to me but I haven't been able to find anything on google that clearly explains the approach.
REPORT ZTREVOR_DYNAMIC_ALV_MAKT_VBRP.
TABLES : makt,
marc,
t001w,
vbrk,
vbrp.
CONSTANTS : c_yes TYPE c VALUE '1',
c_no TYPE c VALUE '0'.
Selection-screen begin of block b1 with frame title text-sc1.
PARAMETERS : p_opt1 TYPE c RADIOBUTTON GROUP radi USER-COMMAND op1, "Material
p_opt2 TYPE c RADIOBUTTON GROUP radi. "Billing Document
Selection-screen end of block b1.
Selection-screen begin of block b2 with frame title text-sc2.
SELECT-OPTIONS : s_matnr FOR makt-matnr MODIF ID op1, "Material
s_vbeln FOR vbrp-vbeln MODIF ID op2. "Billing Document
Selection-screen end of block b2.
T SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN .
IF screen-group1 = 'OP1' .
IF p_opt1 = 'X' .
screen-invisible = c_no .
screen-active = c_yes .
ELSE.
screen-invisible = c_yes .
screen-active = c_no .
ENDIF.
MODIFY SCREEN .
ENDIF.
IF screen-group1 = 'OP2' .
IF p_opt2 = 'X' .
screen-invisible = c_no .
screen-active = c_yes .
ELSE.
screen-invisible = c_yes .
screen-active = c_no .
ENDIF.
MODIFY SCREEN .
ENDIF.
ENDLOOP.
2011 Sep 30 3:02 PM
Hi,
First of all, you should check your radiobutton instead of select-option...
Then you will have to build the output internal table dynamically based on the option chosen. There are lot of example on SDN...
Here is a start: http://wiki.sdn.sap.com/wiki/display/Snippets/Tutorialabap-CodeforDynamicAlv+grid
Kr,
m.
Hi Guys
I have coded a dynamic selection screen (shown below). I want to create an ALV report based on what the user enters in the selection screen. Is the right way of doing this to code an IF s_matnr is not initial statement then call all the subroutines for output of material data and then else call a second batch of subroutines for billing data. It seems a bit long winded to me but I haven't been able to find anything on google that clearly explains the approach.
REPORT ZTREVOR_DYNAMIC_ALV_MAKT_VBRP.
TABLES : makt,
marc,
t001w,
vbrk,
vbrp.
CONSTANTS : c_yes TYPE c VALUE '1',
c_no TYPE c VALUE '0'.
Selection-screen begin of block b1 with frame title text-sc1.
PARAMETERS : p_opt1 TYPE c RADIOBUTTON GROUP radi USER-COMMAND op1, "Material
p_opt2 TYPE c RADIOBUTTON GROUP radi. "Billing Document
Selection-screen end of block b1.
Selection-screen begin of block b2 with frame title text-sc2.
SELECT-OPTIONS : s_matnr FOR makt-matnr MODIF ID op1, "Material
s_vbeln FOR vbrp-vbeln MODIF ID op2. "Billing Document
Selection-screen end of block b2.
T SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN .
IF screen-group1 = 'OP1' .
IF p_opt1 = 'X' .
screen-invisible = c_no .
screen-active = c_yes .
ELSE.
screen-invisible = c_yes .
screen-active = c_no .
ENDIF.
MODIFY SCREEN .
ENDIF.
IF screen-group1 = 'OP2' .
IF p_opt2 = 'X' .
screen-invisible = c_no .
screen-active = c_yes .
ELSE.
screen-invisible = c_yes .
screen-active = c_no .
ENDIF.
MODIFY SCREEN .
ENDIF.
ENDLOOP.
2011 Sep 30 3:01 PM
Hi,
Simply use radiobutton.
if p_opt1 = 'X'.
perform get_material.
else.
perform get_billing.
endif.
Take care.
Çağatay
2011 Sep 30 3:02 PM
Hi,
First of all, you should check your radiobutton instead of select-option...
Then you will have to build the output internal table dynamically based on the option chosen. There are lot of example on SDN...
Here is a start: http://wiki.sdn.sap.com/wiki/display/Snippets/Tutorialabap-CodeforDynamicAlv+grid
Kr,
m.