2012 Jun 08 4:59 AM
Hi,
In selection screen I have a parameter field P_STATUS. When I press F4 on P_STATUS it displays CREATE and REPROCESS. Is it possible to keep a dynamic push button based on my status selection.If I selected CREATE status it should display CREATE push button and If I selected REPROCESS status it should display REPROCESS push button.
Is it possible.Please suggest how to do.
Thanks and regards,
Umakanth
Hi,
In selection screen I have a parameter field P_STATUS. When I press F4 on P_STATUS it displays CREATE and REPROCESS. Is it possible to keep a dynamic push button based on my status selection.If I selected CREATE status it should display CREATE push button and If I selected REPROCESS status it should display REPROCESS push button.
Is it possible.Please suggest how to do.
Thanks and regards,
Umakanth
2012 Jun 08 5:04 AM
2012 Jun 08 5:06 AM
Hi UmaKanth,
I am guessing you are using SELECTION SCREEN PUSHBUTTON to create the push buttons.
You need to create 2 pushbuttons and hide them in AT SELECTION-SCREEN OUTPUT.
Then depending on the value selected, you can display one in AT SELECTION-SCREEN.
Thanks,
Shambu
2012 Jun 08 5:12 AM
HI ,
But how to handle in At Selection-Screen event.
Thanks,
Umakanth
2012 Jun 08 5:38 AM
Use this sample code. Give the value as C or R and check.
SELECTION-SCREEN:
PUSHBUTTON 2(10) create USER-COMMAND cli3 MODIF ID bu1,
PUSHBUTTON 12(10) reproc USER-COMMAND cli4 MODIF ID bu2.
PARAMETER : p_status TYPE c.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'BU1' OR screen-group1 = 'BU2'.
screen-invisible = '1'.
MODIFY SCREEN.
ENDIF.
IF p_status = 'C'.
IF screen-group1 = 'BU1' .
screen-invisible = '1'.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'BU2' .
screen-invisible = '0'.
MODIFY SCREEN.
ENDIF.
ELSEIF p_status = 'R'.
IF screen-group1 = 'BU1' .
screen-invisible = '0'.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'BU2' .
screen-invisible = '1'.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
Thanks,
Shambu
2012 Jun 08 6:13 AM
Refer to these threads you may find it useful.
http://scn.sap.com/thread/515678
http://scn.sap.com/thread/1565809
Regards,
Jake
2012 Jun 08 6:13 AM
Hello,
There s no need to create multiple push-button. Only 1 will do, you can use the combination of the parameter & the PB to decide what operation the program will perform!
PARAMETERS: p_mode TYPE char20 AS LISTBOX
USER-COMMAND mod
VISIBLE LENGTH 15
DEFAULT 'CREATE'.
SELECTION-SCREEN: PUSHBUTTON /2(15) v_tx_but USER-COMMAND but.
INITIALIZATION.
v_tx_but = 'CREATE'. "Default value
AT SELECTION-SCREEN OUTPUT.
* Set the button text as per the mode selected
CASE p_mode.
WHEN 'CREATE'.
v_tx_but = 'CREATE'.
WHEN 'REPROCESS'.
v_tx_but = 'REPROCESS'.
ENDCASE.
AT SELECTION-SCREEN.
IF sy-ucomm = 'BUT'.
CASE p_mode.
WHEN 'CREATE'.
MESSAGE 'Program will CREATE!!!' TYPE 'S'.
WHEN 'REPROCESS'.
MESSAGE 'Program will REPROCESS!!!' TYPE 'S'.
ENDCASE.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_mode.
TYPES:
BEGIN OF ty_f4_val,
mode TYPE char20,
END OF ty_f4_val.
DATA: gt_f4_val TYPE STANDARD TABLE OF ty_f4_val,
gs_f4_val TYPE ty_f4_val.
CLEAR gt_f4_val.
gs_f4_val-mode = 'CREATE'. APPEND gs_f4_val TO gt_f4_val. CLEAR gs_f4_val.
gs_f4_val-mode = 'REPROCESS'. APPEND gs_f4_val TO gt_f4_val. CLEAR gs_f4_val.
* Call the F4 help
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MODE'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'P_MODE'
value_org = 'S'
TABLES
value_tab = gt_f4_val
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
* SUBRC check is not required
ENDIF.BR,
Suhas
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |