02-25-2010 7:22 AM
Hey guys,
i've got two questions.
My first question is: How can I bind a listbox in a select option?? I created the listbox and bind it in a dynpro field ( [Look here|http://f.imagehost.org/download/0895/problem123] ). Not so difficult ;). But now i want to bind it in this select option field ([Look here|http://f.imagehost.org/download/0214/problem124] ). Any idea?
Second question: Is there an easy way to disable the * function in a select option?
This is an example phrase.
If i want to find "example" in this phrase i have to type in my select field "* example *" but i want that you have to type "example" only. Is there an easy way to handle this?
Thank you very much guys
Greetings
02-25-2010 7:56 AM
Hi,
Try the followind code. It will solve your problem.
TYPE-POOLS: vrm.
DATA: name TYPE vrm_id,
list TYPE vrm_values,
value LIKE LINE OF list.
PARAMETERS: ps_parm(10) AS LISTBOX VISIBLE LENGTH 10.
AT SELECTION-SCREEN OUTPUT.
name = 'PS_PARM'.
value-key = '1'.
value-text = 'Line 1'.
APPEND value TO list.
value-key = '2'.
value-text = 'Line 2'.
APPEND value TO list.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING id = name
values = list.
AT SELECTION-SCREEN ON PS_PARM.
IF PS_PARM EQ ''.
MESSAGE 'SELECT ANY ONE OPTION IN PS_PARM' TYPE 'E'.
ENDIF.
START-OF-SELECTION.
Write: / 'Selected options'.
WRITE: / 'List box1:', ps_parm.
Regards,
Shankar.
02-25-2010 7:56 AM
Hi,
Try the followind code. It will solve your problem.
TYPE-POOLS: vrm.
DATA: name TYPE vrm_id,
list TYPE vrm_values,
value LIKE LINE OF list.
PARAMETERS: ps_parm(10) AS LISTBOX VISIBLE LENGTH 10.
AT SELECTION-SCREEN OUTPUT.
name = 'PS_PARM'.
value-key = '1'.
value-text = 'Line 1'.
APPEND value TO list.
value-key = '2'.
value-text = 'Line 2'.
APPEND value TO list.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING id = name
values = list.
AT SELECTION-SCREEN ON PS_PARM.
IF PS_PARM EQ ''.
MESSAGE 'SELECT ANY ONE OPTION IN PS_PARM' TYPE 'E'.
ENDIF.
START-OF-SELECTION.
Write: / 'Selected options'.
WRITE: / 'List box1:', ps_parm.
Regards,
Shankar.
02-25-2010 8:03 AM
Hello,
My first question is: How can I bind a listbox in a select option?? I created the listbox and bind it in a dynpro field ( Look here ). Not so difficult ;). But now i want to bind it in this select option field (Look here ). Any idea?
I donot think you can bind the Listbox to a select-option. Alternatively try building your internal table for F4 values & use the FM: F4IF_INT_TABLE_VALUE_REQUEST to provide the F4 help. In your START-OF-SELECTION you can check if the values enter in the SELECT-OPTION matches that in your internal table. Hope i am clear.
Is there an easy way to disable the * function in a select option?
You can achieve this using the FM: SELECT_OPTIONS_RESTRICT. Search SDN or read the FM documentation for details.
BR,
Suhas
02-25-2010 8:18 AM
Hi,
You can put listbox in select-options using this sample code.
This drill down don't work with extension.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-NAME(8) = 'SO_MERKM' "Your variable name
MOVE '1' TO SCREEN-VALUES_IN_COMBO. " Drilldown List allow
ENDIF.
MODIFY SCREEN.
ENDLOOP.
and in Initizialisation
SELECTION-SCREEN BEGIN OF BLOCK B08 WITH FRAME TITLE TEXT-B08.
* Master Inspection Characteristics
SELECT-OPTIONS SO_MERKM FOR QAMV-VERWMERKM MEMORY ID PMK.
SELECTION-SCREEN END OF BLOCK B08.
INITIALIZATION.
PERFORM SET_VALUE_MERKM USING 'SO_MERKM-LOW'.
PERFORM SET_VALUE_MERKM USING 'SO_MERKM-HIGH'.
FORM SET_VALUE_MERKM USING VALUE(I_ID) TYPE VRM_ID.
DATA IT_VALUES TYPE VRM_VALUES.
REFRESH IT_VALUES.
* get value to populate drill down list
SELECT MKMNR AS KEY
KURZTEXT AS TEXT
INTO CORRESPONDING FIELDS OF TABLE IT_VALUES
FROM V_QPMK
WHERE ZAEHLER IN SO_WERK
AND SPRACHE EQ SY-LANGU
ORDER BY KURZTEXT.
* call function to populate field
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = I_ID
VALUES = IT_VALUES
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " SET_VALUE_MERKM
Rgds
02-25-2010 8:21 AM
02-25-2010 9:23 AM
Hi Shankar,
thank you for your answer. It solved my first problem but not completely. If i dont enter a parameter now I get no records. But I want to have all data records if i dont type any parameters in. How does this work?
Thank you
EDIT 1: I did a second select. Now i can look after problem 2 ;).
EDIT 2: I think SELECT_OPTIONS_RESTRICT is not the right way to solve problem 2. It restricts intervals etc. and I use intervals. any other idea?
EDIT 3: Okay guys I solved the problem. Instead of select options I build parameters. Then I worked with Concatenate and condense so there is no problem anymore.
Thanks
Edited by: markok on Feb 25, 2010 2:32 PM
06-23-2015 5:31 PM
Thank for your answer Stephane, it works perfectly for me. Because in my case, I need to use select-options, not parameters