‎2008 Apr 17 9:46 AM
Hi guys,
In my program, the user can select a specific "profile" from a list of profiles he can make himself. These are stored in a customizing table.
Now, the problem is, i can show 5 profiles, but if the user makes more then 5, i only get to see the first 5.
How can i make something like a list, so that there is a scrollbar or something when the user has more then 5 profiles?
‎2008 Apr 17 12:35 PM
Fritz,
Assuming that you are using Dialog/Module code to display this list box, How are you building this list box now?
If you are using Dialog/Module make sure you're not getting all of the values by ensuring that you've scrolled down enough to see the last one.
As for coding it in the Dialog/Module program here is an example. The one thing you MUST remember to do is on the field attributes in Screen Painter, the dropdown list for Value List on the Progam Tab must be an A for From Program.
this can go in the TOP include.
TYPE-POOLS vrm.
DATA: ltype_field TYPE vrm_id,
ltype_result TYPE STANDARD TABLE OF vrm_value,
ltype_val LIKE LINE OF ltype_result.
In the PBO routine for the screen this dropdown list is for...
REFRESH ltype_result. CLEAR ltype_result.
* Drop down values
SELECT ltype ltypex " Building the table for the list box
INTO TABLE ltype_result
FROM zlmltyp
WHERE auth NE '9'. "System Only
* Field name to assign drop down values
ltype_field = 'WK_LTYPE'. " screen name of the field to use this list box
CALL FUNCTION 'VRM_SET_VALUES' " establishes the drop down list box.
EXPORTING
id = ltype_field
values = ltype_result
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
‎2008 Apr 17 12:17 PM
You can use the function modules
F4IF_INT_TABLE_VALUE_REQUEST
or
VRM_SET_VALUES
to populate the listbox and you have to limt the number of records as 5 when you are passing correponding ITAB to these function modules.
ie, in the case of F4IF_INT_TABLE_VALUE_REQUEST,
you have to limit the number of records as 5 for VALUE_TAB
Edited by: Rengith Skariah on Apr 17, 2008 1:19 PM
‎2008 Apr 17 12:35 PM
Fritz,
Assuming that you are using Dialog/Module code to display this list box, How are you building this list box now?
If you are using Dialog/Module make sure you're not getting all of the values by ensuring that you've scrolled down enough to see the last one.
As for coding it in the Dialog/Module program here is an example. The one thing you MUST remember to do is on the field attributes in Screen Painter, the dropdown list for Value List on the Progam Tab must be an A for From Program.
this can go in the TOP include.
TYPE-POOLS vrm.
DATA: ltype_field TYPE vrm_id,
ltype_result TYPE STANDARD TABLE OF vrm_value,
ltype_val LIKE LINE OF ltype_result.
In the PBO routine for the screen this dropdown list is for...
REFRESH ltype_result. CLEAR ltype_result.
* Drop down values
SELECT ltype ltypex " Building the table for the list box
INTO TABLE ltype_result
FROM zlmltyp
WHERE auth NE '9'. "System Only
* Field name to assign drop down values
ltype_field = 'WK_LTYPE'. " screen name of the field to use this list box
CALL FUNCTION 'VRM_SET_VALUES' " establishes the drop down list box.
EXPORTING
id = ltype_field
values = ltype_result
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
‎2008 Apr 18 8:44 AM
DATA declaration:
TYPE-POOLS vrm.
DATA: ltype_field TYPE vrm_id,
ltype_result TYPE STANDARD TABLE OF vrm_value,
ltype_val LIKE LINE OF ltype_result.
Code to build listbox:
MODULE init_listbox OUTPUT.
REFRESH ltype_result. CLEAR ltype_result.
* Drop down values
LOOP AT cust_scrprof.
ltype_val-key = '0000'.
ltype_val-text = cust_scrprof.
APPEND ltype_val TO ltype_result.
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES' " establishes the drop down list box.
EXPORTING
id = ltype_field
values = ltype_result
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
IF sy-subrc EQ 0.
ENDIF.
ENDMODULE. " INIT_LISTBOX OUTPUT
This does not work though. I debugged it, and my table "ltype_result" is getting filled with all the profiles, however, the listbox does not get filled.
Anyone who knows why?
EDIT:
Ok NVM, i just forgot some code.
Edited by: Fritz Heinzwagel on Apr 18, 2008 9:45 AM
Edited by: Fritz Heinzwagel on Apr 18, 2008 9:49 AM
‎2008 Apr 18 8:51 AM
Ok, so i finally get output, but not the way i want it to be shown.
I get it like this:
1 PROFILE1
2 PROFILE2
3 PROFILE3
...
But, i want it to just be like:
PROFILE1
PROFILE2
PROFILE3
...