Hey,
I'm trying to write a little program to select a value from a listbox on a screen...
Filling the listbox, no problem. But showing the value on screen, and using the selected value isn't working...
So when i select a value, directly after the listbox 'closes', the selected value disappears...
I read already different threads regarding this topic, but i don't see a solution :(.
Below you find the code. Anyone sees where the problem is?
Screen number = 300.
PROCESS BEFORE OUTPUT.
MODULE status_0300.
Module init_dropdown_box.
PROCESS AFTER INPUT.
MODULE user_command_0300.
REPORT ztesttom2 .
TABLES: zbadgelinks.
TYPE-POOLS vrm.
DATA values TYPE vrm_values WITH HEADER LINE.
data: name type vrm_id.
DATA ok_code LIKE sy-ucomm.
DATA save_ok LIKE sy-ucomm.
DATA init.
DATA it_badgelinks LIKE zbadgelinks OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
SELECT * FROM zbadgelinks INTO TABLE it_badgelinks.
CALL SCREEN 300.
*&---------------------------------------------------------------------*
*& Module status_0300 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module status_0300 output.
SET PF-STATUS 'ST_0300'.
SET TITLEBAR 'TB_0300'.
endmodule. " status_0300 OUTPUT
MODULE init_dropdown_box output.
IF init is initial.
name = 'LB_SEL_PC'.
loop at it_badgelinks.
values-text = it_badgelinks-description.
values-key = it_badgelinks-id.
append values.
endloop.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = name
values = 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.
endif.
init = 'X'.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module user_command_0300 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module user_command_0300 input.
CASE OK_CODE.
WHEN 'BACK'. LEAVE TO SCREEN 0.
WHEN 'EXIT'. LEAVE TO SCREEN 0.
WHEN 'CANC'. LEAVE TO SCREEN 0.
WHEN 'CB_CANCEL'. leave to screen 0.
WHEN 'CB_OK'.
READ TABLE it_badgelinks WITh KEY ID = it_badgelinks-id.
IF SY-SUBRC = 0.
MESSAGE I398(00) WITH 'ID: ' it_badgelinks-id
'Description: ' it_badgelinks-description.
ENDIF.
WHEN 'SEL_PC'.
CALL FUNCTION 'VRM_GET_VALUES'
EXPORTING
id = name
IMPORTING
VALUES = values[]
EXCEPTIONS
ID_NOT_FOUND = 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.
ENDCASE.
endmodule. " user_command_0300 INPUT
Thanks in advance,
Kind Regards,
Tom