ABAP log

April 27, 2007

Copying ABAP program texts between two SAP systems / programs / languages.

Filed under: ABAP, SAP — abaplog @ 9:24 am

From time to time I need to transfer text elements between different SAP systems or ABAP programs without the hassle of the transport system. This happens if we have to do changes in “parallel” systems, or if I have a copy of a program but texts were not copied initially. Yet another case is quick copying of texts from one language to another without clicking a hundred times in the translation screen.

In this case I use two simple ABAP programs. One saves the text in specified language into a file on your PC. And the second one reads the texts back and writes them into the text pool of the second program.

************************
*     Download
************************
report zdowntex.

parameters:
  p_report like sy-repid,
  p_file like rlgrap-filename,
  p_lang like sy-langu.

data: it_text like textpool occurs 100 with header line.

start-of-selection.

  read textpool p_report into it_text language p_lang.

  if sy-subrc = 0.
    call function 'WS_DOWNLOAD'
        exporting
             filename            = p_file
             filetype            = 'DAT'
         tables
              data_tab            = it_text
         exceptions
              file_open_error     = 1
              file_write_error    = 2
              invalid_filesize    = 3
              invalid_table_width = 4
              invalid_type        = 5
              no_batch            = 6
              unknown_error       = 7
              others              = 8.
    write: / 'ws_download : ', sy-subrc.
  else.
    write: / 'read textpool : ', sy-subrc.
  endif.

************************
*     Upload
************************
report zuplotex.

parameters:
  p_report like sy-repid,
  p_file like rlgrap-filename,
  p_lang like sy-langu.

data: it_text like textpool occurs 100 with header line.

start-of-selection.

  call function 'WS_UPLOAD'
       exporting
            filename            = p_file
            filetype            = 'DAT'
       tables
            data_tab            = it_text
       exceptions
            conversion_error    = 1
            file_open_error     = 2
            file_read_error     = 3
            invalid_table_width = 4
            invalid_type        = 5
            no_batch            = 6
            unknown_error       = 7
            others              = 8.

  if sy-subrc = 0.
    insert textpool p_report from it_text language p_lang.
    write: / 'insert textpool : ', sy-subrc.
  else.
    write: / 'ws_upload : ', sy-subrc.
  endif.
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: