Google Search - Blog...........

ABAP - F4 (Value On Request) On Logical File On selection Screen.

REPORT ztest_see.

DATA: BEGIN OF lt_dynpfields OCCURS 0.
INCLUDE STRUCTURE dynpread.
DATA: END OF lt_dynpfields.

DATA : i_mdate TYPE sy-datum.
DATA: w_filename TYPE string.
SELECT-OPTIONS: s_date FOR i_mdate.

PARAMETERS: p_file TYPE filename-fileintern,
p_lofile LIKE filename-fileintern.

PARAMETERS: p_rad1 RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND aaa,
p_rad2 RADIOBUTTON GROUP g1 .

AT SELECTION-SCREEN .

SELECT SINGLE fldate
INTO i_mdate
FROM sflight
WHERE carrid LIKE 'A%' AND
fldate IN s_date.

IF sy-subrc NE 0.
MESSAGE ' Enter the date in the format YYYY/MM/DD' TYPE 'E'.
ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

MOVE 'P_RAD1' TO lt_dynpfields-fieldname.
APPEND lt_dynpfields.
MOVE 'P_RAD2' TO lt_dynpfields-fieldname.
APPEND lt_dynpfields.
MOVE 'P_FILE' TO lt_dynpfields-fieldname.
APPEND lt_dynpfields.
MOVE 'P_LOFILE' TO lt_dynpfields-fieldname.
APPEND lt_dynpfields.

CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
TABLES
dynpfields = lt_dynpfields
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10.
LOOP AT lt_dynpfields.
CASE lt_dynpfields-fieldname.

WHEN 'P_RAD1'.
p_rad1 = lt_dynpfields-fieldvalue.
WHEN 'P_RAD2'.
p_rad2 = lt_dynpfields-fieldvalue.
WHEN 'P_FILE'.
p_file = lt_dynpfields-fieldvalue.
WHEN 'P_LOFILE'.
p_file = lt_dynpfields-fieldvalue.
ENDCASE.
ENDLOOP.

IF p_rad1 EQ 'X'.
PERFORM get_local_file USING p_file.
ELSEIF p_rad2 EQ 'X'.
PERFORM get_appl_file USING p_lofile.
ENDIF.

*&---------------------------------------------------------------------*
*& Form get_local_file
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P_FILE text
*----------------------------------------------------------------------*
FORM get_local_file USING p_p_file.

CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
client = sy-mandt
logical_filename = p_file
IMPORTING
file_name = w_filename
EXCEPTIONS
file_not_found = 1
OTHERS = 2.
ENDFORM. " get_local_file

*&---------------------------------------------------------------------*
*& Form get_appl_file
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P_LOFILE text
*----------------------------------------------------------------------*
FORM get_appl_file USING p_p_lofile.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
client = sy-mandt
logical_filename = p_lofile
IMPORTING
file_name = w_filename
EXCEPTIONS
file_not_found = 1
OTHERS = 2.
ENDFORM. " get_appl_file


ALSO READ:

- Display Icon On Selection Screen.

- Sample Program To Display Icon On Selection Screen.

- Multiple Selection Screen Options.

- Pop Up Window With Check Box.

- F4 (Value On Request) For Parameter On Selection Screen.

No comments:

Post a Comment