‎2008 Jan 29 5:46 AM
Hi,
I have a report,where 2 radibuttons have been assigned,one for displaying the ALV & the other for displaying smartform.What way should I code,so as to display the corresponding report at runtime,should I check the condition in Start of selection or should I check for the condition in perform.Please advice.
Thanks.
‎2008 Jan 29 5:53 AM
Hi,
U can check this condition under START-OF-SELECTION event and u can write the neccesay logic depending upon which radio button is selected.
PERFORM is not an event. Its just a function call which can be present under the start-of-selection. So if u have written PERFORM under this start-of-selection, u can check ur condition in PERFORM. If not, just check the condition after this start-of-selection.
Reward points if useful
Cheers,
Shanthi.
‎2008 Jan 29 5:49 AM
refer to this peice of code
SELECTION-SCREEN BEGIN OF BLOCK v1 WITH FRAME.
SELECT-OPTIONS : s_ebeln FOR ekko-ebeln .
SELECT-OPTIONS : s_ekorg FOR ekko-ekorg.
SELECT-OPTIONS : s_bukrs FOR ekko-bukrs.
PARAMETERS : s_vgabe TYPE vgabe.
SELECTION-SCREEN END OF BLOCK v1.
SELECTION-SCREEN BEGIN OF BLOCK v2 WITH FRAME TITLE text-101.
PARAMETERS: rb1 RADIOBUTTON GROUP rad1, "Grid
rb2 RADIOBUTTON GROUP rad1 . "List
SELECTION-SCREEN END OF BLOCK v2.
************************************************************************
AT SELECTION-SCREEN *
************************************************************************
AT SELECTION-SCREEN.
*Validation 1 for purchase order :
PERFORM zf_validate_po USING wa_final-ebeln
s_ebeln[].
*Validation 1 for purchasing org. :
PERFORM zf_validate_po_org USING wa_final-ekorg
s_ekorg[].
*Validation 1 for company code :
PERFORM zf_validate_po_comp USING wa_final-bukrs
s_bukrs[].
*Validation 1 for P.O. history
PERFORM zf_validate_po_hist USING S_vgabe
ci1
ci2.
************************************************************************
INITIALIZATION *
************************************************************************
INITIALIZATION.
CLEAR wa_header.
CLEAR wa_history.
CLEAR wa_items.
CLEAR wa_final.
CLEAR wa_layout.
CLEAR wa_fieldcat.
REFRESH it_header.
REFRESH it_history.
REFRESH it_items.
REFRESH it_final.
REFRESH it_fieldcat.
REFRESH it_eventcat.
REFRESH it_listheader.
v_progname = sy-repid.
************************************************************************
START-OF-SELECTION *
************************************************************************
START-OF-SELECTION.
POPULATING HEADER.
PERFORM zf_get_header USING s_ebeln[]
s_ekorg[]
s_bukrs[]
s_vgabe
CHANGING it_header[].
SORT it_header BY ebeln.
IF NOT it_header IS INITIAL.
FUNCTION-POPULATING HISTORY.
PERFORM zf_get_history USING s_ebeln[]
s_vgabe
CHANGING it_history[].
SORT it_history BY ebeln.
PERFORM zf_get_items USING s_ebeln[]
CHANGING it_items[].
PERFORM zf_get_final USING it_header[]
it_history[]
it_items[]
CHANGING it_final[].
ENDIF.
END-OF-SELECTION.
now after populating the tables and field cat and eventcat
if rb1 = x.
call FUNCTION 'REUSE LAV GRID DISPLAY'.
ELSE
call FUNCTION 'REUSE LAV LIST DISPLAY'.
ENDIF.
award if helpful plz
keep rockin
vivek
Edited by: vivek gaur on Jan 29, 2008 6:51 AM
‎2008 Jan 29 5:51 AM
Try as below:
parameters: p_alv radiobutton group rad1 default 'X',
p_form radiobutton group rad1.
selection-screen.
perform extract_data. " Retreiving required data
if not p_alv is initial.
perform display_alv. " Use data to display in ALV format
else.
peform print_form. " Use data to print as Smartform
endif.
Regards
Eswar
‎2008 Jan 29 5:53 AM
Hi,
U can check this condition under START-OF-SELECTION event and u can write the neccesay logic depending upon which radio button is selected.
PERFORM is not an event. Its just a function call which can be present under the start-of-selection. So if u have written PERFORM under this start-of-selection, u can check ur condition in PERFORM. If not, just check the condition after this start-of-selection.
Reward points if useful
Cheers,
Shanthi.
‎2008 Feb 04 6:35 AM
I have eben ablo to find a solution,by checking the value of radiobutton in Start of selection
‎2008 Feb 04 6:35 AM
I have been able to find a solution,by checking the value of radiobutton in Start of selection
‎2008 Feb 04 6:40 AM
OOPS i meant START-OF-SELECTION instead of SELECTION-SCREEN in my earlier post.
Wish we have compiler for codes we post on SDN. ...
Anyhow cheers you could find out.
~Eswar
‎2008 Feb 08 8:16 AM
Thanks for the correction,I knew you meant Start of selection,even though it was written selection screen.