2007 Mar 20 11:09 AM
Hi.
I have requirement such as there should three dropdowm and one table control on screen. when we select ZONE in first dropdown, then STATE of that ZONE should come automatically come in second dropdown, and when we select STATE in second dropdown then CITIES should in third dropdown. Finally when we select CITY then data for that city from ZTABLE should display in table control.
Please suggest me solution or send me sample code like this.
Thanks.
2007 Mar 20 1:23 PM
Hi,
Create 3 list box and one table control. Create 3 internal tables with your required data and pass them to the function module 'VRM_SET_VALUES' this is show in the list box based on the selection show the values in the table control.
Find the sample code to show values in the list box.
REPORT DEMO_DYNPRO_DROPDOWN_LISTBOX.
TYPE-POOLS VRM.
DATA: NAME TYPE VRM_ID,
LIST TYPE VRM_VALUES,
VALUE LIKE LINE OF LIST.
DATA: WA_SPFLI TYPE SPFLI,
OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM.
TABLES DEMOF4HELP.
NAME = 'DEMOF4HELP-CONNID'.
CALL SCREEN 100.
MODULE CANCEL INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE INIT_LISTBOX OUTPUT.
CLEAR DEMOF4HELP-CONNID.
SELECT CONNID CITYFROM CITYTO DEPTIME
FROM SPFLI
INTO CORRESPONDING FIELDS OF WA_SPFLI
WHERE CARRID = DEMOF4HELP-CARRIER2.
VALUE-KEY = WA_SPFLI-CONNID.
WRITE WA_SPFLI-DEPTIME TO VALUE-TEXT
USING EDIT MASK '__:__:__'.
CONCATENATE VALUE-TEXT
WA_SPFLI-CITYFROM
WA_SPFLI-CITYTO
INTO VALUE-TEXT SEPARATED BY SPACE.
APPEND VALUE TO LIST.
ENDSELECT.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = NAME
VALUES = LIST.
ENDMODULE.
MODULE USER_COMMAND_100.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
IF SAVE_OK = 'CARRIER'
AND NOT DEMOF4HELP-CARRIER2 IS INITIAL.
LEAVE TO SCREEN 200.
ELSE.
SET SCREEN 100.
ENDIF.
ENDMODULE.
MODULE USER_COMMAND_200.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
IF SAVE_OK = 'SELECTED'.
MESSAGE I888(BCTRAIN) WITH TEXT-001 DEMOF4HELP-CARRIER2
DEMOF4HELP-CONNID.
ENDIF.
ENDMODULE.
Br,
Laxmi
2007 Mar 21 6:29 AM
hi lakshmi.
thanks.. but i want it on same screen and when we select value in 3rd dropdown then other details should display in table control.
thanks.
2007 Mar 21 5:43 AM
Hi
you can use vrm_set_values function module for setting the values in the drop down list
Regards,
Prasanth
reward all helpful replies
2007 Mar 21 9:16 AM
Hi ,
In PAI,u can write the code.
i.e,let d1, d2, d3 be dropdown boxes.
have a push button say 'DISPLAY' ON THE SCREEN.
****FOR LIST DISP
1)
if d1 is not initial.
select state from ztable into it_state where zone = d1.
endif.
if d2 is not initial.
select city from ztable into it_city where city = d2.
endif.
2)
Then , on usercommand, write the following code,
case-sy-ucomm.
when 'DISPLAY'.
SELECT * FROM ZTABLE INTO IT_FINAL WHERE ZONE = D1 AND STATE = D2 AND CITY = D3.
ENDCASE.
3) to get the possible entries or drop down, u can use FM F4IF_FIELD_VALUE_REQUEST or vrm_set_values.