Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Split a string.

Hi,

In our project there is requirement wherein we have to split a string.can we split a string into n no. of parts.

Regards,

Suresh

Tags:
replied

Hi Suresh,

See this example code ...

DATA: BEGIN OF file_all OCCURS 0,
          all(1000) TYPE c,
        END OF file_all.
CALL FUNCTION 'UPLOAD_FILES'
       EXPORTING
*           i_trunclen = ''
            i_filetype = 'ASC'
            i_xpc      = i_xpc
       TABLES
            file_all   = file_all
            tab_file   = tab_file
       EXCEPTIONS
            error_file = 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.

  LOOP AT file_all.

    SPLIT file_all AT ';' INTO it_file-bankl
                               it_file-banka
                               it_file-provz
                               it_file-stras
                               it_file-ort01
                               it_file-swift
                               it_file-bnklz
                               it_file-brnch.

"ur code...........
Endloop.

Regards

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question