Skip to Content

                                                   with header line.”#EC

data: int_message type standard table of BAPIRET2   with header line.

                                                            “#EC

  • Declaration for BAPI_IPAK_GETLIST

data: int_ins     type standard table of BAPI6102SL  with header line,

      int_infopac type standard table of BAPI6109L   with header line,

      int_msg     type standard table of BAPIRET2    with header line,

      int_src     type standard table of BAPI6101SL  with header line,

      int_dtsrc   type standard table of BAPI6109DSSL

                                                   with header line.”#EC

  • Declaration for BAPI_IPAK_GETDETAIL

data: int_det     type standard table of BAPI6109     with header line,

      int_ret     type standard table of BAPIRET2     with header line,

      int_dlt     type standard table of BAPI6109IC   with header line,

      int_sel     type standard table of BAPI6109SEL  with header line,

      int_thrdp   type standard table of BAPI6109TCP  with header line,

      int_flparam type standard table of BAPI6109FILE

                                                   with header line.”#EC

SELECTION-SCREEN BEGIN OF BLOCK BLOCK1.

PARAMETERS: P_FILE(255) type c.

SELECTION-SCREEN END OF BLOCK BLOCK1.

SELECTION-SCREEN COMMENT /1(30) text-h01.

PARAMETERS: Actual radiobutton group rg1,

            Plan   radiobutton group rg1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

*Providing F4 help for upload File name.

  PERFORM F3000_GET_FILE_NAME USING P_FILE.

AT SELECTION-SCREEN ON P_FILE.

  • Check for file Existance on the Presentaion server

  PERFORM F3100_FILE_EXISTS USING P_FILE.

START-OF-SELECTION.

  • Get data from File to internal table.

  PERFORM F3200_GET_DATA_FROM_FILE USING P_FILE.

FORM F3000_GET_FILE_NAME USING    P_FILE.

  •   Displays Windows popup to get filename

  CALL FUNCTION ‘WS_FILENAME_GET’

    EXPORTING

      DEF_FILENAME     = SPACE

      MASK             = ‘,.,..’

      MODE             = ‘O’

    IMPORTING

      FILENAME         = P_FILE

    EXCEPTIONS

      INV_WINSYS       = 1

      NO_BATCH         = 2

      SELECTION_CANCEL = 3

      SELECTION_ERROR  = 4

      OTHERS           = 5.

  IF SY-SUBRC = 4.

    MESSAGE …….

  ENDIF.

ENDFORM.                    ” f3000_get_file_name

FORM F3100_FILE_EXISTS USING    P_FILE.

  DATA : P_EXISTS TYPE C.

  • Check if File Exists on Presentation Server

  CALL FUNCTION ‘WS_QUERY’

    EXPORTING

      FILENAME = P_FILE

      QUERY    = ‘FE’

    IMPORTING

      RETURN   = P_EXISTS.

  IF P_EXISTS = 0.

    MESSAGE ….

  ENDIF.

ENDFORM.                    ” F3100_FILE_EXISTS

FORM F3200_GET_DATA_FROM_FILE USING    P_FILE.

  clear g_t_data.

  data : loc_file type string.

  loc_file = P_FILE.

  CALL FUNCTION ‘GUI_UPLOAD’

    EXPORTING

      FILENAME                = loc_file

      FILETYPE                = ‘ASC’

    TABLES

      DATA_TAB                = g_t_data

    EXCEPTIONS

      FILE_OPEN_ERROR         = 1

      FILE_READ_ERROR         = 2

      NO_BATCH                = 3

      GUI_REFUSE_FILETRANSFER = 4

      INVALID_TYPE            = 5

      NO_AUTHORITY            = 6

      UNKNOWN_ERROR           = 7

      BAD_DATA_FORMAT         = 8

      HEADER_NOT_ALLOWED      = 9

      SEPARATOR_NOT_ALLOWED   = 10

      HEADER_TOO_LONG         = 11

      UNKNOWN_DP_ERROR        = 12

      ACCESS_DENIED           = 13

      DP_OUT_OF_MEMORY        = 14

      DISK_FULL               = 15

      DP_TIMEOUT              = 16

      OTHERS                  = 17.

  IF SY-SUBRC .

  append int_src.

  CALL FUNCTION ‘BAPI_IPAK_GETLIST’

    TABLES

      SELINFOSOURCE    = int_ins

      SELSOURCESYSTEM  = int_src

      INFOPACKAGE_LIST = int_infopac

      RETURN           = int_msg.

  loop at int_infopac.

*—-


  • Clearing of the Standard parameter Tables

*—-


    clear int_det.

    clear int_ret.

    clear int_dlt.

    clear int_sel.

    clear int_thrdp.

    clear int_flparam.

    CALL FUNCTION ‘BAPI_IPAK_GETDETAIL’

      EXPORTING

        INFOPACKAGE        = int_infopac-INFOPACKAGE

      IMPORTING

        DETAILS            = int_det

        FILE_PARAMS        = int_flparam

      TABLES

        SELECTIONS         = int_sel

        INFOCUBES          = int_dlt

        THIRD_PARTY_PARAMS = int_thrdp

        RETURN             = int_ret.

*—-


  • When Actual Flag is on

*—-


    if int_dlt-DELETEALLBEFORE .

        clear req.

        clear stt.

        CALL FUNCTION ‘BAPI_IPAK_START’

          EXPORTING

            INFOPACKAGE = int_infopac-INFOPACKAGE

          IMPORTING

            REQUESTID   = req

          TABLES

            RETURN      = int_message.

        wait up to 10 seconds.

        CALL FUNCTION ‘BAPI_ISREQUEST_GETSTATUS’

          EXPORTING

            REQUESTID  = req

          IMPORTING

            TECHSTATUS = stt.

        if stt EQ ‘Y’.

          MESSAGE …..

        elseif stt EQ ‘G’.

          MESSAGE …..

        elseif stt EQ ‘R’.

          MESSAGE …..

        endif.

      endif.

*—-


  • When Plan Flag is on

*—-


    elseif int_dlt-DELETEALLBEFORE EQ ‘X’ AND Plan EQ ‘X’.

      if int_flparam-FILENAME EQ

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply