Wednesday, 31 January 2024

Upload File From Server

 


Types : begin of itab1,
        rec(1000type c,
        end of itab1.

data  itab type table of itab1.
data  wa type itab1.

  refresh itab.
  clear itab.
  if p_fname is not initial.  "This Option not use

    message 'Can Not Select File, Only For Background' type 'E'.

    p_file  p_fname+7(53).

    replace all occurrences of '\' in p_file with '/'.
    concatenate '/sapinterface/N' p_file into p_file.

*   For Test Location only
    replace all occurrences of 'QAS' in p_file with ''.

    w_flname p_file+36(25).

    open dataset p_file
    for input in text mode encoding default ."WITH WINDOWS LINEFEED.

    if sy-subrc <> 0.
*    MESSAGE XXX WITH v_file.
    endif.

    do.
      read dataset p_file into wa.
      if sy-subrc <> 0.
        exit.
      endif.

      replace all occurrences of cl_abap_char_utilities=>cr_lf(1in wa with space.

      concatenate wa ';' w_flname into wa.
      append wa to itab.
    enddo.

    close dataset p_file.

No comments:

Post a Comment

Visitor

Code Syntax Try...Endtry

  Code : Report Try. Parameters  NUMBER  type  I . data  RESULT  type  P  decimals  2 . data  OREF  type  ref  to  CX_ROOT . data  TEXT  typ...