DATA: l_true TYPE btch0000-char1.
DATA: v_file TYPE string,
l_path TYPE dxlpath,
l_abend_flag TYPE dxxabend,
file TYPE filename,
flag1 TYPE c.
l_path TYPE dxlpath,
l_abend_flag TYPE dxxabend,
file TYPE filename,
flag1 TYPE c.
DATA: it_fieldvalues TYPE STANDARD TABLE OF dynpread,
wa_fieldvalues TYPE dynpread.
wa_fieldvalues TYPE dynpread.
*-----------------------------------------------------------------------------
*-- SELECTION- SCREEN
*-----------------------------------------------------------------------------
*-- SELECTION- SCREEN
*-----------------------------------------------------------------------------
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_file(120) LOWER CASE OBLIGATORY.
PARAMETERS: p_appl RADIOBUTTON GROUP g1,
p_pres RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b1.
PARAMETERS: p_file(120) LOWER CASE OBLIGATORY.
PARAMETERS: p_appl RADIOBUTTON GROUP g1,
p_pres RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b1.
*-----------------------------------------------------------------------------
*-- AT SELECTION- SCREEN ( F4 functionality )
*-----------------------------------------------------------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM f4_file_name.
*-----------------------------------------------------------------------------
*-- START-OF-SELECTION.
*-----------------------------------------------------------------------------
START-OF-SELECTION.
IF p_appl = 'X'.
PERFORM validate_server_file.
ELSE.
PERFORM validate_presentation_server.
ENDIF.
*-----------------------------------------------------------------------------
*-- END-OF-SELECTION
*-----------------------------------------------------------------------------
END-OF-SELECTION.
IF flag1 = 'X'.
MESSAGE s777(hk) WITH 'File doesn''t exist'.
CLEAR flag1.
ENDIF.
*-- AT SELECTION- SCREEN ( F4 functionality )
*-----------------------------------------------------------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM f4_file_name.
*-----------------------------------------------------------------------------
*-- START-OF-SELECTION.
*-----------------------------------------------------------------------------
START-OF-SELECTION.
IF p_appl = 'X'.
PERFORM validate_server_file.
ELSE.
PERFORM validate_presentation_server.
ENDIF.
*-----------------------------------------------------------------------------
*-- END-OF-SELECTION
*-----------------------------------------------------------------------------
END-OF-SELECTION.
IF flag1 = 'X'.
MESSAGE s777(hk) WITH 'File doesn''t exist'.
CLEAR flag1.
ENDIF.
*&---------------------------------------------------------------------*
*& Form validate_server_file
*&---------------------------------------------------------------------*
*& Form validate_server_file
*&---------------------------------------------------------------------*
FORM validate_server_file.
DATA: l_file TYPE tpfht-pffile.
CLEAR l_file.
l_file = p_file.
CALL FUNCTION 'PFL_CHECK_OS_FILE_EXISTENCE'
EXPORTING
fully_qualified_filename = l_file
IMPORTING
file_exists = l_true.
IF l_true = space.
flag1 = 'X'.
STOP.
ENDIF.
ENDFORM. " validate_server_file
DATA: l_file TYPE tpfht-pffile.
CLEAR l_file.
l_file = p_file.
CALL FUNCTION 'PFL_CHECK_OS_FILE_EXISTENCE'
EXPORTING
fully_qualified_filename = l_file
IMPORTING
file_exists = l_true.
IF l_true = space.
flag1 = 'X'.
STOP.
ENDIF.
ENDFORM. " validate_server_file
*&---------------------------------------------------------------------*
*& Form validate_presentation_server
*&---------------------------------------------------------------------*
*& Form validate_presentation_server
*&---------------------------------------------------------------------*
FORM validate_presentation_server .
DATA: result,
xfile TYPE string.
xfile = p_file.
CALL METHOD cl_gui_frontend_services=>file_exist
EXPORTING
file = xfile
RECEIVING
result = result.
IF result NE 'X'.
flag1 = 'X'.
STOP.
ENDIF.
ENDFORM. "validate_presentation_server
DATA: result,
xfile TYPE string.
xfile = p_file.
CALL METHOD cl_gui_frontend_services=>file_exist
EXPORTING
file = xfile
RECEIVING
result = result.
IF result NE 'X'.
flag1 = 'X'.
STOP.
ENDIF.
ENDFORM. "validate_presentation_server
*&---------------------------------------------------------------------*
*& Form f4_file_name
*&---------------------------------------------------------------------*
*& Form f4_file_name
*&---------------------------------------------------------------------*
FORM f4_file_name .
wa_fieldvalues-fieldname = 'P_PRES'.
APPEND wa_fieldvalues TO it_fieldvalues.
CLEAR wa_fieldvalues.
wa_fieldvalues-fieldname = 'P_PRES'.
APPEND wa_fieldvalues TO it_fieldvalues.
CLEAR wa_fieldvalues.
wa_fieldvalues-fieldname = 'P_APPL'.
APPEND wa_fieldvalues TO it_fieldvalues.
CLEAR wa_fieldvalues.
APPEND wa_fieldvalues TO it_fieldvalues.
CLEAR wa_fieldvalues.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
TABLES
dynpfields = it_fieldvalues
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
OTHERS = 11.
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
TABLES
dynpfields = it_fieldvalues
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
OTHERS = 11.
READ TABLE it_fieldvalues INTO wa_fieldvalues WITH KEY fieldname = 'P_APPL'.
IF wa_fieldvalues-fieldvalue = 'X'.
PERFORM get_f4_application.
PERFORM get_f4_application.
ELSE.
PERFORM get_f4_presentation.
PERFORM get_f4_presentation.
ENDIF.
ENDFORM. " f4_file_name
ENDFORM. " f4_file_name
*&---------------------------------------------------------------------*
*& Form get_f4_presentation
*&---------------------------------------------------------------------*
*& Form get_f4_presentation
*&---------------------------------------------------------------------*
FORM get_f4_presentation .
*-- F4 functionality for file name on Presentation Server
*-- F4 functionality for file name on Presentation Server
DATA: l_file TYPE string.
CALL METHOD cl_salv_test_data=>select_file
IMPORTING
filename = l_file.
p_file = l_file.
ENDFORM. " get_f4_presentation
CALL METHOD cl_salv_test_data=>select_file
IMPORTING
filename = l_file.
p_file = l_file.
ENDFORM. " get_f4_presentation
*&---------------------------------------------------------------------*
*& Form get_f4_application
*&---------------------------------------------------------------------*
*& Form get_f4_application
*&---------------------------------------------------------------------*
form get_f4_application .
*-- F4 functionality for filename on Application Server
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
i_location_flag = 'A'
i_server = ' '
i_path = '/secure_data/data_mig/dev'
IMPORTING
o_path = l_path
abend_flag = l_abend_flag
EXCEPTIONS
communication_failure = 1
system_failure = 2
rfc_error = 3.
*-- F4 functionality for filename on Application Server
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
i_location_flag = 'A'
i_server = ' '
i_path = '/secure_data/data_mig/dev'
IMPORTING
o_path = l_path
abend_flag = l_abend_flag
EXCEPTIONS
communication_failure = 1
system_failure = 2
rfc_error = 3.
IF sy-subrc EQ 0.
p_file = l_path.
ENDIF.
p_file = l_path.
ENDIF.
IF l_abend_flag = 'X'.
EXIT.
ENDIF.
EXIT.
ENDIF.
endform. " get_f4_application
ALSO READ:
- Sample Program On Use Of Selection Screen.
- Creating Tab-Strip Selection Screen tab-strip Without Using SE51.
- Change The Height Of The Screen Layout To Make It Full Screen.
- F4 (Value On Request) For Field Using FM RSISP_DDIC_F4_VALUES.
- F4 (Value On Request) For Organization Unit In HR Report Program.
- F4 (Value On Request) For Organization Unit In HR Report Program.
No comments:
Post a Comment