Skip to Content

Hi there.

As it was shown in previous example it’s possible to supply any data into RFC enabled FORM. But, at the same time direct usage of IMPORT clause requires explicit specification of the ID’s in data buffer and also involves some manual work to define types. Fortunately there is a special class CL_ABAP_IMPEXP_UTILITIES that could handle all dirty work.

The only limitation I’ve found – it works pretty good with DDIC types, but for custom defined types it could fail without any detailed explanation.

This greatly simplifies extension of the methods and makes code much more compact and readable.

I’ve tested this example with 50000 lines and seems ABAP can handle such amount of data. Generally for the parallel processing this should be enough.

So, here is the sample code:


REPORT Z_BINARY_TRANSFORM2.
data: x_b2      type xstring,
      lt_abc    type STANDARD TABLE OF t000,
      wa_t000  type t000.
INITIALIZATION.
* Fill table with sample data
wa_t000-mandt = sy-mandt.
wa_t000-mtext = 'SCN Demo #1'.
wa_t000-ort01 = 'Moscow'.
append wa_t000 to lt_abc.
wa_t000-mandt = sy-mandt.
wa_t000-mtext = 'SCN Demo #2'.
wa_t000-ort01 = 'Tokio'.
append wa_t000 to lt_abc.
* Export data into buffer
export tadir = lt_abc to DATA BUFFER x_b2 COMPRESSION on.
* Check the result
perform describe_buffer using x_b2.
form describe_buffer
  using in_buffer type xstring.
  data: lt_datatab type tab_cpar.
  FIELD-SYMBOLS: <fs> like line of lt_datatab,
                <fs2> type any table,
                <fs3> type any.
  lt_datatab = cl_abap_expimp_utilities=>dbuf_import_create_data( dbuf = in_buffer ).
  loop at lt_datatab assigning <fs>.
        write : <fs>-name.    " Here is the name of the currently processed tab in buffer
        new-line.
        assign <fs>-dref->* to <fs2>.
        loop at <fs2> assigning <fs3>.
                  write : <fs3>.
                  new-line.
        endloop.
  endloop.
endform.

To report this post you need to login first.

1 Comment

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

Leave a Reply