07-16-2010 4:27 PM
Hi All,
As per my requirement I have to createtwo pushbuttons on my selection screen , BUTT1 and BUTT2. That I have created.
on BUTT1 I have to fill selection screen fields with some values, that is no problem.
My problem : on BUTT2 I have to generate a ALV report.
my code so far is as follows.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON (20) W_BUTN1 USER-COMMAND BUTTON1.
SELECTION-SCREEN PUSHBUTTON (25) W_BUTN2 USER-COMMAND BUTTON2.
SELECTION-SCREEN END OF LINE.
At selection screen.
I'm checking sccrfields-ucomm here... for
if BUTT1
filling the screen field values.
elseif BUTT2.
flag = 1.
endif.
Start-of-selection.
if flag = 1.
Extract data from tables and display ALV report.
endif.
Not able to achieve BUTT2 functionality of displaying ALV report. Where should I code for BUTT2.
Please help.
Thanks in advance.
07-16-2010 4:51 PM
At selection screen.
I'm checking sccrfields-ucomm here... for
if BUTT1
* filling the screen field values.
elseif BUTT2.
PERFORM extact_data_and_display. "> Extract data from tables and display ALV report.
endif.
Remember, you are not executing the report, hence it is not going to trigger start-of-selection
07-16-2010 4:52 PM
You would want to make your buttons part of a group. I do something like this (greatly simplified here):
type-pools: abap.
. . .
parameters: p_b1 radiobutton group zzzz default 'X',
p_b2 radiobutton group zzzz.
at selection-screen...
* do what is needed to fill fields...etc
. . .
start-of-selection.
case abap_true.
when p_b1.
* do what you want to do for button 1.
when p_b2.
* do something for button2
endcase.
* do any necessary housekeeping.
. . .
07-16-2010 5:43 PM
For this you need to create a screen -9001 with custom container and write your ALV code in PBO/PAI for that screen.
Create the pf status =ALV via SE41 .Call screen will help you to get the ALV report.
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN 'B1'.
SET PF-STATUS 'ALV'.
CALL SCREEN 9001.
ENDCASE.
07-16-2010 6:10 PM
You can see sample example below ,
initialization.
Default Values
g_prog = sy-repid.
sscrfields-functxt_01 = 'Update Rep - Sales order'.
selection-screen function key 1.
AT SELECTION-SCREEN.
case sscrfields-ucomm.
when 'Update Rep - Sales order' or 'FC01'.
call transaction 'ZSCMU'.
endcase.
You can write similarly and hope you understand.
Thank you
Seshu
07-16-2010 7:49 PM
Thank you all for replying.
I tried selecting data and displaying ALV on AT SELECTION_SCREEN event. and it is working fine.
At selection screen.
case sy-ucomm.
if BUTT1.
select frm table and display dta i fields on selection screen.
elseif BUTT2.
select data from table
populate ALV table and display
endif.
My concern is can write all my select queries in at selection-screen.. data selection shud be done in start-of-selection. But when I write in start-of-selection my ALV report is not displayed ?
Also on my ALV report I have to add 2 pushbuttons and do multiple selection of rows and based on rows selected execute the functionalities on 2 pushbuttons.
My ques is where shud I set my pf-status. since my report is generated directly after At selection-screen. never reaching start-of- selection. ?
07-18-2010 8:06 AM
Why you want to do this at selection screen.?
use start-of-selection.
if but2 = 'X'.
Select
ALV
In PAI
processing on rows selected.
07-18-2010 3:40 PM
i agree with "boby thankachen" you should be using a call screen.
you can easily code the screen pf status and call it in the - at selection screen.
07-18-2010 6:24 PM
u should write the code under aat selection screen output and loop the screen and modify it.
for example i will give you the code to display a parameter value when u select one radio button and change another value if u select another button.
========================================================================================================
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: so_expid FOR v_expid NO INTERVALS. "ID expiry date
PARAMETERS: p_ictyp TYPE pa0185-ictyp.
PARAMETERS: passport RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND ABC, "passport
workperm RADIOBUTTON GROUP rad1, "
iqama RADIOBUTTON GROUP rad1, "
exit RADIOBUTTON GROUP rad1, "
visa RADIOBUTTON GROUP rad1, "
license RADIOBUTTON GROUP rad1, "
insurid RADIOBUTTON GROUP rad1. "
SELECTION-SCREEN END OF BLOCK bl1.
AT SELECTION-SCREEN OUTPUT.
CASE 'X'.
WHEN passport.
p_ictyp = 'PP'.
WHEN workperm.
p_ictyp = '04'.
WHEN iqama.
p_ictyp = '03'.
WHEN license.
p_ictyp = '06'.
WHEN exit.
p_ictyp = '06'.
WHEN visa.
p_ictyp = '07'.
WHEN insurid.
p_ictyp = '05'.
ENDCASE.
LOOP AT SCREEN.
IF screen-name CP 'p_ictyp'.
screen-input = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
======================================================================================================
Hope this may help you.
07-20-2010 10:26 AM
Hi Pooja,
Functionlity for BUTT2 can be achieved at START-OF-SELECTION event.
This event is necessary to perform any data extraction.
Thus, you can keep BUTT1 functionality as it is and for BUTT2, place your perform in start-of-selection.
BR,
Vishal.