10-13-2008 11:09 AM
Hi,
I have two list boxes(drop down fields) on the selection-screen.
Based on the input given in the first field, the input help for the 2nd field has to be changed. (Without pressing any other key)
How it is done.
10-13-2008 12:08 PM
Hi Charan,
Here is the sample :
PARAMETERS : p_carrid TYPE spfli-carrid
AS LISTBOX VISIBLE LENGTH 20 USER-COMMAND onli .
PARAMETERS : p_connid TYPE spfli-connid
AS LISTBOX VISIBLE LENGTH 20 .
data : begin of itab occurs 0,
connid type spfli-connid,
end of itab.
data : i_dynp type table of DYNPREAD with header line.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_connid.
i_dynp-fieldname = 'P_CARRID'.
APPEND i_dynp.
CLEAR i_dynp.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
TABLES
dynpfields = i_dynp.
READ TABLE i_dynp WITH KEY fieldname = 'P_CARRID'.
IF sy-subrc IS INITIAL.
MOVE : i_dynp-fieldvalue TO p_carrid.
ENDIF.
SELECT connid
FROM spfli
INTO TABLE itab
WHERE carrid EQ p_carrid.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'CONNID'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'P_CONNID'
value_org = 'S'
TABLES
value_tab = itab.
Try it out, It will work.
10-13-2008 11:12 AM
Hi,
Use the At Selection screen on field <field name> or
At slection screen on input.
Under this event fetch data for second list box and populate it.
(press F1 on At events, to get exact syntax or go to tcode ABAPDOCU )
Thanks & Regards,
Navneeth K.
10-13-2008 11:15 AM
Hi,
The addition USER-COMMAND can be used to assign a function code fcode to the dropdown list box.
When the user selects a line of the list box on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and transfers the function code fcode to the component ucomm of the interface work area sscrfields. If a function code used in the GUI status of the selection screen is specified for fcode, the selection screen processing is affected accordingly.
Without the addition USER-COMMAND, selecting a line in the dropdown list box does not lead to the event AT SELECTION-SCREEN.
see the below example:
PARAMETERS p_carrid TYPE spfli-carrid
AS LISTBOX VISIBLE LENGTH 20
USER-COMMAND onli
DEFAULT 'LH'.
AT SELECTION-SCREEN.
...
Regards
Shiva
10-13-2008 11:24 AM
Hi,
Do the coding in AT SELECTION-SCREEN. event, as it triggers when you press enter key after input.
PARAMETRES : p_1(5) AS LISTBOX,
p_2(5) AS LISTBOX.
AT SELECTION-SCREEN.
IF p_1 EQ 'ABC'.
p_2 = 'XYZ'.
ENDIF.
Regards
Bala Krishna
10-13-2008 12:08 PM
Hi Charan,
Here is the sample :
PARAMETERS : p_carrid TYPE spfli-carrid
AS LISTBOX VISIBLE LENGTH 20 USER-COMMAND onli .
PARAMETERS : p_connid TYPE spfli-connid
AS LISTBOX VISIBLE LENGTH 20 .
data : begin of itab occurs 0,
connid type spfli-connid,
end of itab.
data : i_dynp type table of DYNPREAD with header line.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_connid.
i_dynp-fieldname = 'P_CARRID'.
APPEND i_dynp.
CLEAR i_dynp.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
TABLES
dynpfields = i_dynp.
READ TABLE i_dynp WITH KEY fieldname = 'P_CARRID'.
IF sy-subrc IS INITIAL.
MOVE : i_dynp-fieldvalue TO p_carrid.
ENDIF.
SELECT connid
FROM spfli
INTO TABLE itab
WHERE carrid EQ p_carrid.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'CONNID'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'P_CONNID'
value_org = 'S'
TABLES
value_tab = itab.
Try it out, It will work.