Wednesday, May 23, 2012

Basis Tricks and Tweaks


Mass Changing Object Directory Entries or Source System of ABAP objects:

In one of my client, they created a new system(XYZ) as a copy of current system(ABC) to upgrade it to latest version of ABAP.

Once the system is upgraded from ABC to XYZ, all the programs need to be changed in the new system. When copying the programs from old system to new system, Source System option needs to be changed from old to new system, otherwise everytime you try to change an object it will pop-up Modification dialog and all the modifications need to be tracked as the object is originated in a different system.

If for any reason, if basis forgets to change the source system when copying the transports, we need to change source system of each object.Instead there is a trick to do it in MASS,

Go to SE03, double click on Change Object Directory Entries button, give the objects for which you want to change the source system,



Once you click on execute, you will see the list of objects based on the selection criteria.



click on the package name and then click on the Select button which will select all the objects under it. Once all the objects are selected, in the command prompt on the top, enter MASS command and hit enter,




once you click on enter, you will see the below pop-uip,



Here enter the new Original system in that field and click on Enter. Once you click on the Green Check, it will change the Source System for all the objects selected.

Thats is, you are done :). Post in SDN which mentioned this solution is,

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

Unlocking Objects in a Transport:

When you assign objects to a transport, those objects gets locked in that transport. So whenever anyone makes changes to those objects, those changes have to be in that same transport unless it is released.

Sometimes we would have to remove locks for certain objects to be able to add them to another transport or when creating transport of copies, due to various other reasons we might want to remove lock for those objects. This cannot be done using SE09 or SE10, this unlocking of objects in a transport is possible only using SE03 transaction code as shown below,

When Objects are locked in a transport, it looks as shown below:



NOTE: Unlocking of Objects is not at all recommended by SAP in standard process, only in some emergency scenarios we might have to do this, so do not do this unless needed.


When you click you will get the tcode where you can give the Tport number of which you want to unlock all the objects,



Once you click on execute, you will get a pop-up as do you want to unlock the transport, just click on Unlock button. Now, when you go back to SE09/SE10 you will see that the objects are no longer locked.



That ends the notes about unlocking objects in a transport.



Thursday, May 10, 2012

Creating Service for a function module


Creating a Webservice for a Function module:

We can create a Webservice for a function module which can then be called directly by any system or application which can accept web service calls.

Take any function module, go to SE37, click on display of that function module.

In the next screen on the top menu,

SAP's wizard to create web service pop-ups where you have to specify the Service definition and also the description.



Click Continue, it will show the Function module name for which we will be creating the webservice, click CONTINUE on this screen too.

Now the next screen is, it will provide option to select Application type and also the Profile. Profile helps to decide the Authentication level of the web service.

Next screen is where is provides the option to select Package and Transport number. Once you click on the Continue button over here, it will create the Webservice from here.

Once the service is created, go to sicf, find the service and activate it.

Also, the service needs to be configured in SOAMANAGER.


Tuesday, May 1, 2012

Debugging Proxy


Debugging Proxy:

Proxy is like a web service call from SAP - PI - 3rd Party. It creates a webservice which can be called directly by any system which is capable of doing that.

Apart from that, we can also use proxy for interaction between SAP - SAP, mostly for synchronous calls. Instead of using RFC's SAP recommends to use proxy if they have PI as a middle ware as there are many advantages of using proxy instead of RFC's.

Steps to create a proxy are explained in a different post, this post is to explain as how to debug a proxy from sproxy transaction.

Step 1: Go to Sproxy transaction and select the appropriate proxy scenario and then click on the execute button on the top.

Execute button is the one on the top left side.

Once you click on that, you get a pop-up where you can select various options to provide the input data. We will be selecting the radio button, Generate Template data and click on execute which will generate test template as how should be the input xml be.


Next screen will the HTML format of the template as how should it look like and also on that screen, there will be button which says XML editor which will allow us to enter data in the xml directly.


Providing the test data: This can be done in many ways.

Option 1 - Manual entry :). I know no one like this option.

Option 2 - If there is already a message sent from Source to PI, then you can go to SXMB_MONI on PI and copy the XML format of the payload and then paste that on to the xml editor. One precaution is, the data on PI will be in HTML view of XML so it might have '-' at the begin of each tag which needs to be removed. Another option, click on the PRETTY PRINTER button on the XML editor which will arrange the tags and you can remove those additional '-' marks. Also, the header tag needs to be adjusted little as per the input format. Easy way to check if the input format is correct or not is, open another session of the same proxy and repeat the steps until where you can see the XML editor. You can compare the tags based on that template which is generated.Also, there is Syntax check button on the top.

Option 3: This is a similar option as 2 but the difference is, I may not have the XML data file on MONI. In that case, you can go to that interface on PI, in the TEST Scenario of mapping, give the data and generate an XML and then come here and give that XML in the data.

Once the data is provided, click on the EXECUTE button with a break-point in the proxy code.

It stops at the break-point and you can debug from there, so its all yours from here :).




SAP Tricks and Tweaks


Finding the Proxy based on Class or Structure:


This is a trick told by one of my very own friend Adithya. ( Its one of many tricks he might be knowing :)).

If you know the Structure or Class generated by a proxy and trying to figure out as what is the actual Proxy to check its settings on PI, one of the method is to go and check Package of the class or data dictionary object and then go to SE80, open that package. Inside that, there will be a folder which says Enterprise Services. Under that you can see all the Client and Server Proxies.



Creating a variant in a function module while debugging the program which calls that function module:


This part explains as how to create a test variant for a function module when debugging a program which calls that function module. Reason for it is, sometime you might want to just debug the function module and not the whole code as the main logic or the issue might be inside the function module.



This document is to add Test Variant to a function module which a called inside a program while debugging the program. Same applies even when we are processing an idoc manually through WE19.


Take an I/B iDoc which can be processed through WE19, using its Inbound function module.
For Ex: In CAG, I have an idoc 6274503 and the I/B function module for that is /DEEREAG/GISSUE_IDOC_INPUT.



Once I am inside the function module through debugger, click on the Tools button on the variables section of the debugger(generally the right part of the screen)



In pop-up, we will see an option which says ‘Save Parameter as test Data(SE37)’.


Now, if you go back to SE37 and execute the inbound function module directly, and then click on Test data directory,


Here, we will see the variant created through debugger.

Similarly, it works even when you debug a program which calls a function module, and once the program enters the function module, you can save the test data variant for that function module through program.
It’s very useful if we don’t have access to a program or WE19.


Difference types of Debugging Commands:


Below is a simple notes explaining the difference between various debugging commands in ABAP. We mostly use /h but there are also other types and below are the details.

/h - start debugging
/hs - system debugging
/ha - debugging - no screens