Skip to end of metadata
Go to start of metadata

Submitted: June 15, 2007

Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
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.
DATA: IT_FIELDVALUES TYPE STANDARD TABLE OF DYNPREAD,
      WA_FIELDVALUES TYPE DYNPREAD.
*----------------------------------------------------------------------*
*                   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.
*----------------------------------------------------------------------*
*         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.
  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 .
  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 .
  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.
  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.
  READ TABLE IT_FIELDVALUES INTO WA_FIELDVALUES WITH KEY FIELDNAME =
'P_APPL'.
  IF WA_FIELDVALUES-FIELDVALUE = 'X'.
    PERFORM GET_F4_APPLICATION.
  ELSE.
    PERFORM GET_F4_PRESENTATION.
  ENDIF.
ENDFORM.                    " f4_file_name
*&---------------------------------------------------------------------*
*&      Form  get_f4_presentation
*&---------------------------------------------------------------------*
FORM GET_F4_PRESENTATION .
*-- 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
*&---------------------------------------------------------------------*
*&      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.
  IF SY-SUBRC EQ 0.
    P_FILE = L_PATH.
  ENDIF.
  IF L_ABEND_FLAG = 'X'.
    EXIT.
  ENDIF.
ENDFORM.                    " get_f4_application