Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to Create TR and attach data when modify a custom table in abap code

Former Member
0 Likes
3,088

Hi guys,

I need to create a TR when modifying a custom table by abap code.

The changed data should attached to the created TR.

Ex - Modify (Ztable) By (work area)

Thanks and Regards,

Chinthaka

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,297

Hi Chinthaka,

Please clarify your requirement in detail?

Regards,

Sudeesh Soni

6 REPLIES 6
Read only

Former Member
0 Likes
2,298

Hi Chinthaka,

Please clarify your requirement in detail?

Regards,

Sudeesh Soni

Read only

Former Member
0 Likes
2,297

Hi,


Hopefully you can find the solution on the link below.

Transporting Table Entries in ABAP programmatically - ABAP Development - SCN Wiki

Kind Regards

Bert

Read only

0 Likes
2,297

Hi Bert,

I used the way in the above link using the FM  TR_REQUEST_CHOICE.

TR can be created but FM return exception 4 (Objects are not attached.)

Can you please help on this.

this is my code

DATA: lt_zxa_header    TYPE TABLE OF zxa_header,

       ls_zxa_header    TYPE zxa_header.

DATA: l_request        TYPE trkorr VALUE 'IDSK901097',

       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.

CLEAR lt_zxa_header[].

SELECT *

   FROM zxa_header

   INTO TABLE lt_zxa_header.

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_zxa_header-id.

   ls_e071k-trkorr     = l_request.

   ls_e071k-pgmid      = 'R3TR'.

   ls_e071k-object     = 'TABU'.

   ls_e071k-objname    = 'ZXA_HEADER'.

   ls_e071k-as4pos     = lv_position.

   ls_e071k-mastertype = 'TABU'.

   ls_e071k-mastername = 'ZXA_HEADER'.

   ls_e071k-lang       = sy-langu.

   ls_e071k-tabkey     = lv_tabkey.

   APPEND ls_e071k TO lt_e071k.

   CLEAR ls_e071k.

ENDLOOP.

break att_develop2.

*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

   EXCEPTIONS

     invalid_request      = 1

     invalid_request_type = 2

     user_not_owner       = 3

     no_objects_appended  = 4

     enqueue_error        = 5

     cancelled_by_user    = 6

     recursive_call       = 7

     OTHERS               = 8.

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Read only

former_member435048
Discoverer
0 Likes
2,297

Hi,

you have to write BDC for the Customizing table using SM30.

Read only

0 Likes
2,297

Hi Vijay,

Can you please explain more about this.

Thanks,

Chinthaka

Read only

0 Likes
2,297

HI,

Record the BDC for customizing table....while passing the customizing TR ,

use the BAPI " BAPI_CTREQUEST_CREATE".  You will get the TR number in the importing parameter

in requestid, pass this to the BDC field where tr number is shown.

Regards,

Vijay.