‎2011 Dec 27 10:59 AM
Hi ,
I am using drop down functionality using VRM_SET_VALUES for field called YEAR . The values in this drop down are decided by other parameters in the screen like Country and company code .
When I am executing the report and coming back on the Selection screem , the year drop down disappears and only the one which I had selected for executing the report is visible .
I cannot use the Initialization as the values of drop downs are decided at runtime .
Please let me know how can i retail the values of the dropdown
Supriya
‎2011 Dec 27 11:02 AM
put the code in at selection screen output. thats the reason you are not getting back the list when you come back to the selection screen.
‎2011 Dec 27 11:04 AM
Hello Supriya,
In which SELECTION-SCREEN event have you coded for the drop-down list? AT SELECTION-SCREEN OUTPUT, is it?
Can you paste your code snippet, so that we can analyse it better?
BR,
Suhas
‎2011 Dec 27 11:06 AM
I have put in Selection screen output
AT SELECTION-SCREEN OUTPUT .
IF p_ctcd IS NOT INITIAL AND p_cocd IS NOT INITIAL AND p_year IS INITIAL .
DATA : g_year TYPE zyeas .
CLEAR p_year .
PERFORM f4_drop_down_year USING p_cocd p_ctcd CHANGING g_year it_values .
ENDIF .****
FORM F4_DROP_DOWN_YEAR USING P_COCD
P_CTCD
CHANGING P_YEAR
T_VALUES .
CONSTANTS : C_0 TYPE CHAR1 VALUE 0 ,
C_I TYPE CHAR1 VALUE 'I' .
TYPES : BEGIN OF T_YEAR ,
ZYEAR TYPE ZYEAS ,
END OF T_YEAR .
DATA : G_KEY TYPE I .
DATA : IT_VALUES TYPE VRM_VALUES ,
WA_VALUE LIKE LINE OF IT_VALUES .
DATA : IT_YEAR TYPE STANDARD TABLE OF T_YEAR ,
WA_YEAR TYPE T_YEAR .
SELECT ZYEAR FROM ZPMS_YEAR INTO TABLE IT_YEAR
WHERE ZCLOSE = C_0
AND MOLGA EQ P_CTCD
AND BUKRS EQ P_COCD .
G_KEY = 1 .
IF SY-SUBRC EQ 0 .
LOOP AT IT_YEAR INTO WA_YEAR .
WA_VALUE-KEY = G_KEY.
CONDENSE WA_VALUE-KEY .
WA_VALUE-TEXT = WA_YEAR-ZYEAR .
APPEND WA_VALUE TO IT_VALUES.
G_KEY = G_KEY + 1.
CLEAR WA_YEAR .
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'P_YEAR'
VALUES = IT_VALUES
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE TEXT-002 TYPE C_I .
ELSE.
* READ TABLE
SORT IT_VALUES BY KEY .
T_VALUES = IT_VALUES .
ENDIF.
ELSE.
MESSAGE 'No Year maintained for the Year and company code' TYPE C_I .
ENDIF.<Added Code tags>
Edited by: Suhas Saha on Dec 27, 2011 4:40 PM
‎2011 Dec 27 11:12 AM
so, for the first time to get the values, are you pressing enter after filling up the values for P_COCD and P_CODE?
anyways,
you clear out the values of P_COCD and P_CODE and p_year at the end of selection event (just before your code finishes for the processing), then when you come back to selection screen these three values wiil be blank and your initial screen will come back
‎2011 Dec 27 11:07 AM
Hai,
TYPe-pools vrm.
DATA: param TYPE vrm_id,
values TYPE vrm_values,
value LIKE LINE OF values.
PARAMETERS: p_name type kunnr AS LISTBOX VISIBLE LENGTH 10 USER-COMMAND adi.
AT SELECTION-SCREEN OUTPUT.
REFRESH values.
param = 'P_NAME'.
value-key = '1'.
value-text = 'Adi'.
APPEND value TO values.
value-key = '2'.
value-text = 'Siva'.
APPEND value TO values.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = param
values = values.
Follow the above code there i maintained the values manually .
‎2011 Dec 27 11:20 AM
Hi
Make the Input field of Year as a List box in the selection screen
As the Value of Year is based on Country and Company Code so you need to press Enter to avoid that you got to provide the F4 help as mentioned below
at selection-screen on value-request for year. " Provide the F4 Help under this Event
First use *DYNP_VALUES_READ* Function module to read the Values in Country and Company Code
Then use *F4IF_INT_TABLE_VALUE_REQUEST* Function Module
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = SY-REPID
dynumb = SY-DYNNR
TABLES
dynpfields = dynpfields "Go through the Function Module Documentaion
EXCEPTIONS
OTHERS = 1.
For More info on how to use these function module take the Help of Where used ListHope this would serve your purpose
Cheerz
Ramchander Rao.K