Supply Chain Management Blogs by Members
Learn about SAP SCM software from firsthand experiences of community members. Share your own post and join the conversation about supply chain management.
cancel
Showing results for 
Search instead for 
Did you mean: 
thanga_prakash
Active Contributor

This document will help you to upload file from presentation to application server and download from application into presentation server.

In SCM 5.00, there is no transaction CG3Z and CG3Y like in ECC for uploading and downloading files into and from the application server respectively.

Below is the program which will help you to achieve the same.

File upload into application server from Presentation server


Select the presentation server path by using F4 help and then provide the path of application server, execute.

After successful upload, a message will be displayed in the output screen.

PROGRAM


*&---------------------------------------------------------------------*


*& Report  ZBTP_FILE_UPLOAD


*&


*&---------------------------------------------------------------------*


*& Program to upload file from presentation to application server


*&---------------------------------------------------------------------*



REPORT  zbtp_file_upload.



PARAMETERS: pre_path TYPE saepfad,


            app_path TYPE saepfad.


DATA: p_pres1 TYPE localfile.



AT SELECTION-SCREEN ON VALUE-REQUEST FOR pre_path.


  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'


    EXPORTING


      program_name = syst-repid


      dynpro_number = syst-dynnr


      field_name   = p_pres1


    CHANGING


      file_name    = p_pres1


    EXCEPTIONS


      mask_too_long = 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.


  MOVE p_pres1 TO pre_path.



START-OF-SELECTION.


  CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'


    EXPORTING


      path      = pre_path


      targetpath = app_path


    EXCEPTIONS


      error_file = 1


      OTHERS    = 2.


  IF sy-subrc EQ 0.


    WRITE😕 'File uploaded successfully into application server path' , app_path.


  ENDIF.


File download into presentation server from application server


Select the application server path and presentation server folder by using F4 help, execute.

After successful download, a message will be displayed in the output screen.

PROGRAM



*&---------------------------------------------------------------------*


*& Report  ZBTP_FILE_DOWNLOAD


*&


*&---------------------------------------------------------------------*


*& Program to download file from application server to presentation


*&---------------------------------------------------------------------*



REPORT  zbtp_file_download.



PARAMETERS:app_path TYPE saepfad,


           pre_path TYPE saepfad.



DATA: p_pres1 TYPE dxlpath,


      p_pres2 TYPE string.



AT SELECTION-SCREEN ON VALUE-REQUEST FOR app_path.


  CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'


    EXPORTING


      i_location_flag = 'A'


      i_server       = '?'


      filemask       = '*.*'


      fileoperation  = 'R'


    IMPORTING


      o_path         = p_pres1


    EXCEPTIONS


      rfc_error      = 1


      error_with_gui = 2


      OTHERS         = 3.


  IF sy-subrc <> 0.


    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno


            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.


  ENDIF.


  MOVE p_pres1 TO app_path.



AT SELECTION-SCREEN ON VALUE-REQUEST FOR pre_path.


  CALL METHOD cl_gui_frontend_services=>directory_browse


    EXPORTING


      initial_folder      = p_pres2


    CHANGING


      selected_folder     = p_pres2


    EXCEPTIONS


      cntl_error          = 1


      error_no_gui        = 2


      not_supported_by_gui = 3


      OTHERS              = 4.


  IF sy-subrc EQ 0.


    pre_path = p_pres2.


  ENDIF.



START-OF-SELECTION.


  CALL FUNCTION 'ARCHIVFILE_SERVER_TO_CLIENT'


    EXPORTING


      path      = app_path


      targetpath = pre_path


    EXCEPTIONS


      error_file = 1


      OTHERS    = 2.


  IF sy-subrc EQ 0.


    WRITE😕 'File downloaded successfully into presentation server path', pre_path.


  ENDIF.


1 Comment