2016 Apr 26 7:30 AM
Hi All,
I am using ABAP Listbox with VRM to set the dropdown.
I am able to set the dropdown, but the user selected value doesnot appear in the parameter specified.
I have tried using VRM_GET_VALUES but the same didnt work.
Please guide.
Below is my code:
REPORT zbw_mosl_file_upd.
TYPE-POOLS: vrm, slis.
TYPES: BEGIN OF ty_retailer,
/bic/zcretalr TYPE /bic/oizcretalr,
END OF ty_retailer.
TYPES: BEGIN OF ty_pzcfilenm2,
checkbox TYPE xfeld,
/bic/zcfilenm TYPE /bic/oizcfilenm,
objvers TYPE rsobjvers,
changed TYPE rsrchangeflag,
/bic/zcstat TYPE /bic/oizcstat,
/bic/zcretalr TYPE /bic/oizcretalr,
END OF ty_pzcfilenm2.
DATA: lt_retailer TYPE TABLE OF ty_retailer,
ls_retailer TYPE ty_retailer.
DATA: lt_pzcfilenm TYPE TABLE OF /bic/pzcfilenm,
ls_pzcfilenm LIKE LINE OF lt_pzcfilenm.
DATA: lt_pzcfilenm2 TYPE TABLE OF ty_pzcfilenm2,
ls_pzcfilenm2 LIKE LINE OF lt_pzcfilenm2.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
ls_fieldcat TYPE slis_fieldcat_alv.
DATA: name TYPE vrm_id,
list TYPE vrm_values,
value LIKE LINE OF list,
lv_records TYPE i,
lv_message TYPE string.
DATA: lv_repid TYPE sy-repid VALUE sy-repid.
DATA lr_grid TYPE REF TO cl_gui_alv_grid.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_retail LIKE /bic/pzcfilenm-/bic/zcretalr AS LISTBOX VISIBLE LENGTH 30.
SELECTION-SCREEN: END OF BLOCK b1.
AT SELECTION-SCREEN OUTPUT.
SELECT /bic/zcretalr
FROM /bic/pzcfilenm
INTO TABLE lt_retailer
WHERE /bic/zcretalr IS NOT NULL.
IF sy-subrc NE 0.
MESSAGE e000(zbw_mosl_file_upd) WITH 'Error'.
EXIT.
ELSE.
SORT lt_retailer.
DELETE ADJACENT DUPLICATES FROM lt_retailer.
LOOP AT lt_retailer INTO ls_retailer.
value-key = sy-tabix.
value-text = ls_retailer-/bic/zcretalr.
APPEND value TO list.
ENDLOOP.
name = 'P_RETAIL'.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = name
values = list.
ENDIF.
AT SELECTION-SCREEN.
"Fetch all the Filenames which have Loaded status for the selected retailer
* PERFORM fetch_loaded.
CALL FUNCTION 'VRM_GET_VALUES'
EXPORTING
id = name
IMPORTING
values = list.
2016 Apr 26 7:42 AM
Hi Shrihari,
By seeing your code, P_RETAIL will have the integer value 0, 1, 2 etc.
The Value of the field in the list box will always be the Key Value.
Thanks and Regards,
Vinay Mutt
2016 Apr 26 7:59 AM
Hi Vinay,
I have mapped text value to the dropdown display and key field is filled with integers.
Also P_RETAIL is of the type text which is required to be displayed.
Thanks,
Srihari
2016 Apr 26 12:54 PM
Hi Srihari,
Are you able to see the drop down on the selection screen.
After you select a value from the drop down, in debug mode can you please check what is the value of the field P_RETAIL. Whether P_RETAIL has any value or is it blank.
Regards,
Vinay Mutt
2016 Apr 29 7:42 AM
Hi Srihari,
Once Check your Key Values .
Ex:
w_value-key = 'K1'.
w_value-text = 'SALES'.
append w_value to v_value.
clear w_value.
2016 Apr 26 8:08 AM
Hi,
Please call the code to populate the Listbox in Initialization Event and retrive the value of the selected the value from Selection-Screen field "Listbox" at event "AT Selection-Screen on ".
Thanks
2016 Apr 26 1:11 PM
Hi,
You didn't put 'START-OF-SELECTION' event statement after 'AT SELECTION-SCREEN'. That's why you are not getting the result. Try this and check. It will work.
Remove that function module 'VRM_GET_VALUES'. You will get the value in parameter p_retail directly.
Regards
Ashish
2016 Apr 26 2:09 PM
Hi,
You have specified sy-tabix as the key field and defined the parameter P_RETAIL as LISTBOX for /bic/pzcfilenm-/bic/zcretalr which might be the problem.
If you are mentioning sy-tabix as the key of the list, then the parameter has to be defined LIKE sy-tabix AS LISTBOX. With the current ddefinition of the parameter, you have to set ls_retailer-/bic/zcretalr as the key of the list.
Please let me know if this solves your issue.
Regards,
Shayeree.
2016 Apr 27 3:12 AM
Hi Srihari,
Use the condense statement after assigning the value to KEY field of your List.
Since you have used SY-TABIX and field VALUE-KEY is of 40 Char.
VALUE-KEY = Sy-tabix.
condense Value-key.
Append value to list.
You should get the value under same Parameter.
Thanks
Deepak
2016 May 02 11:10 AM
2016 May 02 8:54 PM
Please mark Deepak's answer as the right answer, and close your question. Thanks.
2016 May 03 6:13 AM
Hi Srihari,
* Please refer this sample code..it is working..
***************************************************************************************************************
REPORT ztest_2.
TYPE-POOLS : vrm.
TYPES : BEGIN OF ty_mara,
matnr TYPE char10,
END OF ty_mara.
DATA : it_mara TYPE TABLE OF ty_mara,
wa_mara TYPE ty_mara,
it_list TYPE TABLE OF vrm_value,
wa_list TYPE vrm_value.
PARAMETERS : p_matnr TYPE char10 AS LISTBOX VISIBLE LENGTH 15.
AT SELECTION-SCREEN OUTPUT.
wa_list-key = 1.
wa_list-text = '0000000001'.
APPEND wa_list TO it_list.
wa_list-key = 2.
wa_list-text = '0000000002'.
APPEND wa_list TO it_list.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_MATNR'
values = it_list
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
***************************************************************************************************************
Regards,
Rohan
2016 May 06 1:18 AM
Hi Srihari,
Can you please mark this question as answered mentioning the correct answer.
If the issue still persists , kindly let me know.
Thanks
Deepak