Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Consider two tables 'ZXA_HEADER' and 'ZXA_HEADERT'. 'ZXA_HEADERT' is the text table of ZXA_HEADER. When we transport entries in the header table we would also need to transport entries in the text table as well. We can transport objects

1.      By adding individual entries to the transport request.
2.      By using a Piece list to transport the required objects.
  
OBJECT_TYPE: 'REPO','KPI','DASH'.

ZXA_HEADER

Field

Key

Data Type

Length

OBJECTID

Yes

CHAR

60

OBJECT_TYPE

Yes

CHAR

4

OBJVERS

Yes

CHAR

1

XMLROW

 

STRING

0

GUID

 

CHAR

36

OWNER

 

CHAR

12

 ZXA_HEADERT

Field

Key

Data Type

Length

LANGU

Yes

LANG

1

OBJECTID

Yes

CHAR

60

OBJECT_TYPE

Yes

CHAR

4

OBJVERS

Yes

CHAR

1

TXTSH

 

CHAR

 

TXTLG

 

CHAR

 


1.    By adding individual entries to the transport request.
 
It is important to understand structures e071 and e071k. We need one entry of e071 for every table whose entries needs to be transported. e071k contains the key combination of the entry that needs to be transported. Hence we would have entry in e071k for every unique record that needs to be transported.  
As in this mechanism we do not use a piece list we have to manually add all dependant table entries from other tables. In this example we need to transport header and then all corresponding entries of the text table individually. If we use a piece list we can determine dependant table and table entries that need to be transported.  
REPORT transport_program_table_entries.

DATA:
      lt_zxa_header    TYPE TABLE OF zxa_header,
      ls_zxa_header    TYPE zxa_header,     
      lt_zxa_headert   TYPE TABLE OF zxa_headert,
      ls_zxa_headert   TYPE zxa_header.

DATA:
      l_request         TYPE trkorr,
      lt_e071           TYPE tr_objects,
      lt_e071k          TYPE tr_keys,
      lv_position       TYPE ddposition,
      lv_tabkey         TYPE trobj_name,
     ls_e071           TYPE e071,
     ls_e071k          TYPE e071k.

//let us assume that we only want to transport objects with object_type 'INVOICE'.SELECT * FROM zxa_header INTO TABLE lt_zxa_header WHERE object_type EQ 'INVOICE'.
 //transport those only entries in the text table that are in the lt_zxa_header
SELECT * FROM zxa_headert INTO TABLE lt_zxa_headert FOR ALL ENTRIES IN lt_rsxa_header WHERE objectid EQ lt_rsxa_header-objectid AND object_type EQ lt_rsxa_header-object_type
//Create one header row for table ZXA_HEADER.
//E071 contains only one row per table. The objfunc is 'K' if we need to transport //specific entries as specified in the e071k structure.
 ls_e071-trkorr   = l_request.
 ls_e071-as4pos   = 1.
 ls_e071-pgmid    = 'R3TR'.
 ls_e071-object           = 'TABU'.
 ls_e071-obj_name = 'ZXA_HEADER'.
 ls_e071-objfunc  = 'K'.
 ls_e071-lang     = sy-langu.

APPEND ls_e071 TO lt_e071.
CLEAR ls_e071.
CLEAR lv_position.
 //add all table entries in table ZXA_HEADER that need to be transported to lt_e071k
LOOP AT lt_zxa_header INTO ls_zxa_header.

      lv_position = lv_position + 1.

      lv_tabkey = ls_rsxa_header-objectid.
      lv_tabkey+60 = ls_rsxa_header-object_type.
      lv_tabkey+64 = ls_rsxa_header-objvers.

      ls_e071k-trkorr     = iv_request.
      ls_e071k-pgmid      = 'R3TR'.
      ls_e071k-object     = 'TABU'.
      ls_e071k-objname    = 'ZXA_HEADER'.
      ls_e071k-as4pos     = iv_position.
      ls_e071k-mastertype = 'TABU'.
      ls_e071k-mastername = 'ZXA_HEADER'.
      ls_e071k-lang       = sy-langu.
      ls_e071k-tabkey     = iv_tabkey.

      APPEND ls_e071k TO lt_e071k.
      CLEAR ls_e071k.
ENDLOOP.
//Create one header row for table ZXA_HEADERT.
//E071 contains only one row per table. The objfunc is 'K' if we need to transport //specific entries as specified in the e071k structure.
ls_e071-trkorr   = l_request.
ls_e071-as4pos   = 2.
ls_e071-pgmid    = 'R3TR'.
ls_e071-object           = 'TABU'.
ls_e071-obj_name = 'ZXA_HEADERT'.
ls_e071-objfunc  = 'K'.
ls_e071-lang     = sy-langu.

APPEND ls_e071 TO lt_e071.
CLEAR ls_e071.
CLEAR lv_position.
 //add all table entries in table ZXA_HEADER that need to be transported to lt_e071k
LOOP AT lt_zxa_headert INTO ls_zxa_headert.

      lv_position = lv_position + 1.

      lv_tabkey    = ls_zxa_headert-langu.
      lv_tabkey+1  = ls_zxa_headert-objectid.
      lv_tabkey+61 = ls_zxa_headert-object_type.
      lv_tabkey+65 = ls_zxa_headert-objvers.

      ls_e071k-trkorr     = iv_request.
      ls_e071k-pgmid      = 'R3TR'.
      ls_e071k-object     = 'TABU'.
      ls_e071k-objname    = 'ZXA_HEADERT'.
      ls_e071k-as4pos     = iv_position.
      ls_e071k-mastertype = 'TABU'.
      ls_e071k-mastername = 'ZXA_HEADERT'.
      ls_e071k-lang       = sy-langu.
      ls_e071k-tabkey     = iv_tabkey.

      APPEND ls_e071k TO lt_e071k.
      CLEAR ls_e071k.
ENDLOOP.
//To add entries to the transport request we call the following function module
  CALL FUNCTION 'TR_REQUEST_CHOICE'
    EXPORTING
      iv_suppress_dialog   = 'X'
      iv_request           = l_request
      it_e071              = lt_e071
      it_e071k             = lt_e071k.


2.    By using a Piece list to transport the required objects.

Using a piece list helps in organizing the transports and also is less cumbersome as we only provide the objects in the primary table. The rest of the object are automatically derived and added to the transport request.  
Transaction 'SOBJ': Definition of Transportable Object Types. In this transaction we can create a piece list.

Transportable Object Types: http://help.sap.com/saphelp_nw70/helpdata/EN/46/8e540127d02805e10000000a1553f6/frameset.htm

Steps to create a new Transportable Object

     a.     Create a new entry by clicking on 'New Entries'

     b.      Type - 'L' for a Logical Transport Object         

     c.      Enter the following properties as shown below and save it.     

     d.      Please enter the piece list for the newly created Transportable Object as shown below. For example for table ZXA_HEADER: '/&' - OBJECTID, 'REPO' - OBJECT_TYPE, 'A' - OBJVERS; ZXA_HEADERT: '/L' - Language, '/&' - OBJECTID, 'REPO' - OBJECT_TYPE, 'A' - OBJVERS.

                                              i.      /* is the remaining key parts that only occur in the relevant table, and are not part of the object name.

                                              ii.      /L is the language field

                                              iii.      A or D is the object version

                                              iv.      /& is the name part of the object key.
 

REPORT  transport_program_table_piece_list.

DATA:
      lt_zxa_header    TYPE TABLE OF zxa_header,
     ls_zxa_header    TYPE zxa_header.

DATA:
      l_request         TYPE trkorr,
     lt_e071           TYPE tr_objects,
     l_tran_obj        TYPE trobjtype,
     ls_e071           TYPE e071.
      

//let us assume that we only want to transport objects with object_type 'INVOICE'.SELECT * FROM zxa_header INTO TABLE lt_zxa_header WHERE object_type EQ 'INVOICE'.
//crate ls_e071 structure for each transportable object and append it to lt_e071
LOOP AT lt_rsxa_header INTO ls_rsxa_header.
     CASE ls_rsxa_header-object_type.
         WHEN 'REPO'.
                l_tran_obj = 'XARP'.
         WHEN OTHERS.
                l_tran_obj = 'XOBJ'.
     ENDCASE.
     ls_e071-trkorr   = l_request.
     ls_e071-as4pos   = sy-tabix.
     ls_e071-pgmid    = 'R3TR'.
     ls_e071-object       = l_tran_obj.
     ls_e071-obj_name = ls_rsxa_header-objectid.
     ls_e071-lang     = sy-langu.
     Append ls_e071 to lt_e071.
     CLEAR ls_e071.

ENDLOOP.

//To add entries to the transport request we call the following function module
  CALL FUNCTION 'TR_REQUEST_CHOICE'
    EXPORTING
      iv_suppress_dialog   = 'X'
      iv_request           = l_request
      it_e071              = lt_e071.

  • No labels