Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
Hello Everyone,


Many Times we face a issue where we need to capture the Table entries in a TR to move it across the SAP client. I also faced the similar issue and hence I thought rather than doing it manually lets write a code to make it work.

In this blog I am explaining a way to capture the Table entries for the table in TR using code.


For our example we will try to capture the entries of T012K(House Bank Accounts) Table

Step 1) Create a WorkBench TR and keep note of the TR#

Step 2) Create a Report
REPORT ztransport_table.
lv_request TYPE trkorr VALUE 'SYSXXXXXXX', "Change the value with your TR#
lt_e071 TYPE tr_objects,
lt_e071k TYPE tr_keys,
ls_e071 TYPE e071,
ls_e071k TYPE e071k,
lv_position TYPE ddposition,
lv_tabkey TYPE trobj_name,

"Define Internal Table and Workarea of Type the Table which Data we want to capture in TR
lt_t012k TYPE TABLE OF t012k
ls_t012k TYPE t012k.

"Fetch the data which we want to capture in TR
SELECT * FROM t012k INTO TABLE lt_t012k.
SORT lt_t012k BY bukrs hbkid hktid.

"Fill the workarea and append it in Internal Table
ls_e071-trkorr = lv_request.
ls_e071-as4pos = 1.
ls_e071-pgmid = 'R3TR'.
ls_e071-object = 'TABU'.
ls_e071-obj_name = 'T012K'.
ls_e071-objfunc = 'K'.
APPEND ls_e071 TO lt_e071.
CLEAR ls_e071.

CLEAR lv_position.

"Loop on the data and fill the E021K Table entry
LOOP AT lt_t012k INTO ls_t012k.
lv_position = lv_position + 1.
"Concatenate all the Key Values of the Table
CONCATENATE sy-mandt ls_t012k-bukrs ls_t012k-hbkid ls_t012k-hktid INTO lv_tabkey RESPECTING BLANKS.
ls_e071k-trkorr = lv_request.
ls_e071k-pgmid = 'R3TR'.
ls_e071k-object = 'TABU'.
ls_e071k-objname = 'T012K'.
ls_e071k-objfunc = 'K'.
ls_e071k-as4pos = lv_position.
ls_e071k-mastertype = 'TABU'.
ls_e071k-mastername = 'T012K'.
ls_e071k-tabkey = lv_tabkey.

APPEND ls_e071k TO lt_e071k.
CLEAR ls_e071k.

*"to add entries to the transport request we call the following function module
call function 'TR_REQUEST_CHOICE'
iv_suppress_dialog = 'X'
iv_request = lv_request
it_e071 = lt_e071
it_e071k = lt_e071k.


The above report will capture the fetched entries from table in the given TR.


We can even make this code dynamic so that it will capture any table data in a TR making developer's life easy 🙂