Application Development 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: 

Is it somehow possible to add objects to transport request by code?

Former Member
0 Kudos

Hey gurus,

I would like to know if it is a way to add objects to transport request by code. Or how does it work in the SAP system when I am saving an object and assigning it to a transport request?

Regards,
Robert

<edited by moderator: changed 'transaction request' to 'transport request' >

Message was edited by: Manish Kumar

1 ACCEPTED SOLUTION

Jelena
Active Contributor
0 Kudos

I'm also curious what are you trying to achieve exactly. What 'external references' need to be added and why?

There are some objects that require manual entry and there are usually special programs available for that (e.g. texts or bitmaps). It is also possible to add an entry manually (e.g. I do this for translations). But in general there should be no need to fiddle with TR "by code".

Please also correct the discussion subject, so that it does not continue to confuse others.

Thank you.

26 REPLIES 26

Former Member
0 Kudos

Hi Robert,

Yes, it is possible. The core FM is ' TR_OBJECTS_INSERT', and there are some other FMs support it, before it and after it. you`d better search it in SCN for detail.

regards,

Archer

0 Kudos

Thank you Dengyong I will try it out. If it will work according to my requirements I mark this post as the correct answer.

0 Kudos

Can you please explain me how to correctly use it when for example I want to add a data element ZDATAEL to the transport request XXXK00000?

former_member185414
Active Contributor
0 Kudos

Hi,

I assume by transaction request you actually mean the transport request.

Since CTS(Transport) is very critical part, I want to know why do you want to automate/do it via coding?

BR.

0 Kudos

Yeh I meant transport request. Sorry for that. I want to add to my transport request even the external references of my report, that is why I am asking this question. Is there any tool or function module which I can use in my program?

0 Kudos

Ok, What do you mean by external references of report?

0 Kudos

The answer is below.

Jelena
Active Contributor
0 Kudos

I'm also curious what are you trying to achieve exactly. What 'external references' need to be added and why?

There are some objects that require manual entry and there are usually special programs available for that (e.g. texts or bitmaps). It is also possible to add an entry manually (e.g. I do this for translations). But in general there should be no need to fiddle with TR "by code".

Please also correct the discussion subject, so that it does not continue to confuse others.

Thank you.

Former Member
0 Kudos

If we are creating some complex program which uses some Z or Y objects then those Z or Y objects are also included in the transport request. However, if these Z or Y objects use other Z or Y objects then these objects are not included in the transport request (these objects are the external references). I would like to automatically add these objects to the transport request that is why I am asking this question.


I would like to correct my question, but I cannot edit it.

Jelena
Active Contributor
0 Kudos

Either we call them 'objects' or 'external references' it's still not clear, I'm sorry. What specific "objects" are we talking about? Data elements? Includes? Forms? Texts? There are very many different kinds.

Also - if those "objects" have not been modified then why would you need them in the transport? If they were modified then they would be included in the same or another transport. So you'd just need to make sure to move the transports in sequence (and there are tools to help with that as well). I'm still confused why this is a question or an issue...

Former Member
0 Kudos

Under objects I mean every 'objects' which you can access from SE38, but this does not really matter. Why do I need it? During some migration from one system to another there often occurs some errors because of missing objects (data elements, structures, ...) and another fixing transport is needed which contains the objects that the first one does not contained. My goal is to get all objects needed for working of the whole program to one transport request automatically.

For example if we create a program ZPROGRAM and we make a variable definition:
DATA: wa TYPE ztype

Then I save the ZPROGRAM and assign it to transport request XXXK000000, but the used ZTYPE was already existed in other transport request. So the ZTYPE is not in the XXXK000000 transport request but it is needed for the correct working of the ZPROGRAM. That is why I want to add ZTYPE to the XXXK00000 TR. I know it is possibly manually, but I want it to do automatically. Use the Environment Analysis from SE38 to find these objects and then assign them to the transport request.

Jelena
Active Contributor
0 Kudos

Google -> add related objects to transport site:sap.com

http://scn.sap.com/thread/2031270

http://scn.sap.com/thread/3364137

We don't copy a lot of stuff between the systems, so when we do I just add all missing pieces manually. This is also a good opportunity to review everything.

In any case - you might want to be careful with this stuff.

Former Member
0 Kudos

In addition to Jelena's very accurate response.

This would provide an excellent opportunity to break a whole bunch of stuff.

Would seriously not recommend this approach

Former Member
0 Kudos

That is mean when I do it wrong it can break a whole bunch of stuff, but if I do everything alright then it should work okay, should not it?

I understand that it is a complex task and I have to set all the dependent data properly otherwise it can be a big mismatch.

Former Member
0 Kudos

Hi Robert

Is the risk and required effort to make it 100% bulletproof to do something programmatically, which is typically a manual task with a higher degree of certainly...worth it.

Also...why would the other Y and Z objects be causing an issue?

Personally I'd take a step back and determine what is the root cause of the issues your facing.

From what I'm reading above, it sounds more like there is a general issue in how developments and transports are being managed. Fix that and your requirement falls away.

The SAP Transport mechanism may not be the greatest thing on the planet but used correctly it does work.

Regards

Arden

Matt_Fraser
Active Contributor
0 Kudos

I agree with Arden here, this looks like you are trying to find a programmatic way to fix bad change management processes, when really you should be fixing the process. The transport system generally does a good job of capturing all changed objects in transport requests, but bad habits among developers and/or system administrators can muck things up a bit.

Is the issue here that your transports between systems have gotten so out of sync due to mismanagement that you no longer have assurance that the environments are at all equivalent? If so, first fix the mismanagement (stop the bleeding), then use the tools available in the system to determine if you have version matches of needed objects for your development between systems. If not, use SE10 to manually add objects as needed to put them into a single transport request. This should be a one-time task (per development, anyway), so rather than try to build code to continue enabling mismanagement, do the work to fix it once and then use best practices among your team to not let it happen again.

Cheers,

Matt

0 Kudos

Hi,

If what you are looking for is mimicking ("automating") transporting from SE38 Environment Analysis then that sounds like something potentially doable, since Environment Analysis does support Transport from within the list of objects. The FM that does writing to transport request is RS_TOOL_ACCESS, with OPERATION = 'TRANSPORT'.

The first challenge I see is: how to extricate the object list from "Environment Analysis" - have you already solved it somehow?

Edit in:

and it looks like the entry point to Environment Analysis of a program could be FM REPOSITORY_ENVIRONMENT_ALL (DEEP = '1' - will evaluate only immediate dependencies). If you need to call this FM in a loop, SAP standard custom code analysis (on NW 702) uses this hack to enable it...

   lv_obj_type = ls_objkey-object.

   lv_obj_name = ls_objkey-obj_name.

   CLEAR lt_environment_h.

   CALL FUNCTION 'REPOSITORY_ENVIRONMENT_ALL'

     EXPORTING

       obj_type          = lv_obj_type

       environment_types = ls_env_types

       object_name       = lv_obj_name

*      PARALLEL_TASK     =

       deep              = '1'

     TABLES

       environment_tab   = lt_environment_h.

   APPEND LINES OF lt_environment_h TO lt_environment.

* bug in module NW 700: if called 2 times the data is buffered for recursion

   ASSIGN ('(SAPLSEUA)$ROLL_DATA$') TO <env_roll>.

   IF SY-SUBRC = 0 AND <env_roll> IS ASSIGNED.

     CLEAR <env_roll>.

   ENDIF.

The program environment also includes the SAP standard objects... those would need to be filtered away. Unfortunately, in REPOSITORY_ENVIRONMENT_ALL I don't see a way to restrict the search for dependencies only to the packages in customer name space - the way SE38 Environment Analysis can...

I don't want to discourage you, but this is a complex task. And I don't believe that evaluating and transporting immediate dependencies of a single program will guarantee that the program compiles in target system... It will reduce the number of errors, but eliminate them - I don't think so...

cheers

Jānis

Message was edited by: Jānis B

Former Member
0 Kudos

Thank you very much this looks like what I am looking for. This is exactly what I want to achieve. However, I need to try it out. If it will work I mark this post as a correct answer.

I know the Environment Analysis finds only immediate dependencies but I want to find all dependencies using a recursion.

0 Kudos

You're welcome and good luck It's really a pitty REPOSITORY_ENVIRONMENT_ALL can't take in package filter to exclude SAP standard objects, and I don't see a way to hack one in. I started it with DEEP = '2' for one of our function groups - it took about 4 minutes to finish and came up with about 8000 dependencies - most of them in SAP standard. Look around SCN - there seem to be quite a few people experimenting with the FM. Beware of circular dependencies

cheers

Jānis

Jelena
Active Contributor
0 Kudos

I do understand the issue but I'm having trouble seeing a scenario where the expense (and risk)  associated with such development would be justified. Not sure what kind of "migration" we're talking about, but I'm guessing it's not really "migration" but rather some program copy from one system to another in case of a merger or just two standalone systems within the same company.

We do have several systems and occasionally copy a program from one to another. But, as I've mentioned, we do it manually without involving transports. (Since the systems might be on different SPS levels it may be problematic anyway.) Also frequently I find that the copied programs can't be run "as is" because business process is also different and there are actually changes needed anyway. In such case if you brought some related objects with the program they might not even be needed. Also sometimes I find that an object might already exists with the same ID but have a different meaning (this usually happens with SE91 messages).

If there is some major scale ABAP program exchange then perhaps putting everything under one package would be a better solution, as was mentioned in one of the old discussions.

Former Member
0 Kudos

Than you all. I would like to answer in this post to all of you (Arden, Matt and Jelena)

I am a student (Junior Developer) working from home so I have no such experience with SAP system. Many things you mentioned is unknown for me, but I am still learning and try to sponge up all these knowledge and advice you are giving me.

This project was assign to me and my job is to complete the tasks which my boss give me. So the question whether it is good or not to do it this way is not really my business. The main goal of the project is to find the relations of development objects and include them into one transport request. Under this project I got a task to find out how does the system writes the objects to the transport requests. For this reason I started this discussion, to be able to start and get some overview about it from you.

Former Member
0 Kudos

Hi Robert

Is maybe worthwhile have a read of this Blog from http://scn.sap.com/people/gareth.ryan2

http://scn.sap.com/community/abap/blog/2015/07/03/youve-got-to-fight-for-your-right-to

I understand that your boss has requested you to do this. What the above forum is telling you, keeping in mind that they are mostly from SAP itself is that this may not be the best approach to resolve the issue.

My recommendation would be that you speak to your Boss and advise them of the issues we've presented.

Regards

Arden

Jelena
Active Contributor
0 Kudos

In addition to Arden's great response - IMHO it's just wrong for The Boss to send an inexperienced developer on such quest without giving them any support. I've worked with the developers on many levels and we've always made sure to assign the tasks according to their difficulty. Also everyone was supported by Team Lead and the rest of the team (regardless of the experience level - even Senior folks could sometimes use just a second set of eyes). Personally I'm not in favor of "sink or swim" and "find no one knows what" approaches and quite frequently people using them actually expect the subject to disappear conveniently (as the fairytales go ).

That aside, I think it's perfectly fine to advise the management on the risks associated with the assignment and suggest they review the ROI on this idea as well.

Not sure finding "how does the system write the objects to the transport requests" will help a lot with this assignment since when the transport requests are created originally they are meant to track changes and lock objects. None of this is needed for your task (I assume). There have been already many suggestions given for the function modules and related SCN posts, you might want to read them, use 'where used' to understand how FMs are called, etc. You can also find many interesting things using SQL Trace (ST05) and debugger, but it can be very time consuming.

Former Member
0 Kudos

Great response. Well I have assign a senior developer who leads the project and should help me with my question. Unfortunately he and also my boss is currently on vacation, but I wanted to do some of the work until their return. I will discuss it with them then.

Thank you for your advice. You are correct I need only assign the object to the transport request (no need of track changes or lock objects) to allow release it and import it from another system, all the related objects. I debugged many reports to find out how some FMs work, but I am still not done. Firstly I would like to try it manually and find out how does it work and what does it do, but I stuck.


I tried more ways from this question:

but always when I want to assign (include) some object (data element) from my previous transport request to my another transport request I get this error message:

Only edit objects from package *packagename* in local requests

Gaurav Dubey advice me to check the transport layer but I have no experience with that so I have to study and google a lot

Jelena
Active Contributor
0 Kudos

If you open the package in SE80 and double-click on the package then in the Properties tab you'll see 'Transport Layer' field. If you hit the dropdown on that field you'll see the available transport layers and also that blank value means "local". I can only guess that package has no transport layer. It is also possible though that the error message is not entirely accurate and means something else. E.g. I found that if you create a new transport manually, it is considered "local" until you go in and manually assign the target.

I'm sure you are already aware of the "local" objects (when you get prompted for a transport you can create a local object with no transport instead, those go into $TMP package). From what I see, SAP calls other things that have no known transport path "local" too.

Actually you might be better off asking a Basis admin to explain the transport basics since they usually know that better than [most] ABAPers. I recall vividly being told in BC400 class that we don't have to worry [our pretty little heads] about the transports at all.

Former Member
0 Kudos

Thank you I learn a lot from your posts. I have already solve this problem thankfully a little study I had not set the transport layer on the package from where I wanted to include the object as you also mentioned.

I slowly realize why it is risky to play with transport requests.

Well, in small companies developers often have to worry about everything not only about development.