Tuesday, 19 March 2013

Difference between logical and physical deletion of work items in SAP workflow

For understanding in a simple way, the main difference between logical and physical deletion is as same as the difference between the DELETE and SHIFT+DELETE functionality respectively in windows environment.
Logical deletion: When you perform the logical deletion, work items will be removed from the agent's inbox but will not be deleted permanently from the system.
The main advantage of logical deletion is that we can trace back the agent (Responsible/Possible) to whom work item belongs to/who has performed the deletion and we can retrieve the deleted work item.
After deleting the work item logically its status will be set to CANCELLED.
I have found out three possible ways of deleting the work item logically.
First way, execute the T-code SWIA input the work item id that you want to delete












After that just select the work item go to EDIT menu à Work Item à Logically Delete. Once you are done with this you will see that the status of the work item is changed from STARTED to CANCELLED.
















Second one, execute the T-code SWIA give the work item id that you want to delete








                                                                                                                                                                                        Now you will see the work item and its status as STARTED

                                        




Select the Work item and enter the Command “ADMC”. As soon as you execute the ADMC Command the status of the work item will change from STARTED to CANCELLED.

We can use ADMC (Administrative Cancel) to delete the multiple work items at a time. For that you just have to select the multiple work items and fallow the same procedure as explained above.
                                                                                                                                                                                                                                                                                                                                                                                                                 
Third way is to execute the SWIA T-code by giving the work item id.







                                                                                                                                                                                                                                                             
Now double click on the work item







                                                                                                                                                                                                                                                           
After that click on Menu Goto à Technical work item display








                                                                                                                                                                                                                                 
You will see the below screen goto menu EDITà Change 


After that just execute the logical deletion step.








                                                                                                                                                                                                                                             
Physical deletion: When you perform the physical deletion, work items will be removed from the agent's inbox but also it will delete the work items permanently from the system.  There by we will not be able to retrieve back the work item.
Caution Note: Don’t you ever try to perform physical deletion in the production environment!!!
After performing the physically deletion of the work item its status will be set to COMPLETED.
There are multiple reports by which we can do the physical deletion which include
·         RSWWWIDE (deletes the work items including attachments)
·         RSWWWIDE_TOPLEVEL (deletes all the dependent work items)
·         RSWWHIDE (deletes the work item history)

Execute the T-code SWWL, Give the work item id that you want delete permanently and mark the check box Delete immediately.

                                                                                                                                                                                                   

Next you will be asked whether you want to delete permanently or not press YES.


                                                                                                                                                                        

Finally the work item will be physically deleted.


Wednesday, 27 February 2013

Introduction to Idocs in SAP

First let me emphasize on the fact that I am in a budding state when it comes to the field of Idocs (Intermediate Documents). I am just doing my level best to put across whatever info I gathered pertaining to Idocs.
Understanding the concept of Idocs is relatively easy when compared to explaining it or rather finding the root cause when an issue is encountered in Idocs.
The first question that arises in our mind is what exactly the Idocs are? Let me put this way, in any business transaction there are basically two entities involved. And the transactions are made in the format which both entities have agreed upon. Idocs are the file formats used to exchange the data between the two entities involved.
Idocs can be Master Idoc or Communication Idocs. The main difference between the two is the number of Idocs generated. There can be only one Master Idoc generated for any number of receivers for the same data but when it comes to Communication Idoc number depends on number of receivers for the same data.
Idocs are mainly categorized into two types.
1.       Outbound Idoc (Sender)
2.       Inbound Idoc (Receiver)
 
For example triggering an Idoc whenever a sales order (VA01) is created is Outbound Idoc and creating a sales order using the same triggered Idoc is Inbound Idoc.
VA01 à Idoc (Outbound)
Idoc à VA01 (Inbound)

Structure of an Idoc
Idoc mainly consist of three types of records as shown in the below screenshot.
1.       Control Record
2.       Data Record
3.       Status Record

An Idoc can have multiple data and status records but there can be only one control record.






Control Record: Control records ate stored in EDIDC table which contains the key info which is essential to establish the connection between the two systems (done through RFC Configuration – SM59). 

                                                                                                                                                             Data Record: The structure EDIDD holds all the data transferred through Idoc in the form of segments. It specifies the Idoc Number, Segment Type and so on. 
 










Status Record: When an Idoc is processed, at each level a status record is generated which will specify the current status of an Idoc. For Outbound process the status records range is 01-49 and for Inbound process 50-75. The table EDIDS stores all the status records.
 
                                                                                                                                                                            For successful Outbound process the status of an Idoc should be 03 and for Inbound process 53 should be the status. We can see all the status messages via WE47 Tcode.

                                        
 
 
 
There is one more data record EDID4 (Idoc Data Records) which will store all the inbound and the outbound Idocs and their corresponding segments.
 


                                                                                                                                                                                        
 
References:
 



Thursday, 24 January 2013

Smartform Debugging in SAP

Smart form is an output format. It’s just like a ready to print document. We can design the form to be printed in different ways with the requisite information on it. Some examples are Invoices, Purchase Order, Sales Order…

As we all know, there are two entities involved in smart form.
1.       Smart form design.
2.       Driver program.
Sometimes it happens that the information which needs to get printed on the form is missing or customer wants to display some new information on the form or client wants a change in the design format (Roll-Out Projects) and so on… At that point in time it is important to know from where the data is being retrieved to make the necessary changes. We can find out how, what and from where the data is retrieved through Debugging.
To debug a smart form we must know the smart form name and the driver program associated with it. It’s the functional consultant who will provide us this information. But if we know the smart form name we can find its driver program by
1.       NACE Tcode à Output Types à Processing Routines.
2.       TNAPR Table à Contents à Form Name (Smart form name).
3.       SPRO Tcode. 
As for as i know, Smartform can be debugged in four ways.
  1. By setting breakpoints in the function module.
  2. By setting breakpoints in the driver program.
  3. By setting breakpoints in the smartform include program.

Setting breakpoints in the function module.

Debugging a smart form is just like debugging a function module. To debug a smart form we have to follow the below steps.
  • Tcode SMARTFORMS à Enter the smart form name à Goto Environment Menu àFunction Module Name à Copy the Function Module Name (Ex: 1BCDWB/SF00000142)
  • Tcode SE37 à Paste the Function Module Name à Put the breakpoints in the required places
  • Tcode SMARTFORMS à Enter the smart form name à Test button à Test/Execute à give the Output Device as LP01 à Click on Print preview à Now the debugger session will open at the place where you have put the breakpoints.

Setting breakpoints in the driver program.

In order to set the breakpoints in the driver program,
  • Tcode SE38 and provide the program name and display it.
  • Put the breakpoints in the relevant places of driver program.
  • Try to print the smart form by giving the default printer name. Then the moment you click on print preview button, the smart form will enter the debug mode.
Setting breakpoints in the smartform include program.

Every time when the smartform is activated a corresponding include program is generated. To find out the corresponding include program follow the below steps.
  • Tcode SMARTFORMS à Enter the smart form name à Goto Environment Menu àFunction Module Name à Copy the Function Module Name (Ex: 1BCDWB/SF00000142).

  • Goto Tcode SE38 and paste the function module name and before displaying it Just prefix "L" before SF and postfix "F01" after 142. Now the include program name is : 1BCDWB/LSF00000142F01.
  • Put the breakpoints in the required places.
  • Try to print the smart form by giving the default printer name. Then the moment you click on print preview button, the smart form will enter the debug mode.

We can also use popup window debugging method to debug a smartform and to do that follow the below steps. 
  • Try to print the smartform and when the popup appears drag the .BAT file and drop it on the popup. You will see "Debugger switched on" message in the status bar.
  • After dropping the .BAT file on the above popup just click on the print preview you will enter the debug mode.

Sunday, 20 January 2013

Reprocessing and Function Module Testing of Idocs.


In an Idoc there are mainly three segments. Control record (EDIDC), Data record (EDIDD) and Status record (EDIDS). Idoc can have many data and status records but there can be only one Control record.

To reprocess an Idoc, first we have to know the status of it. For that we have to execute the Tcode WE02/WE05 which displays the entire Idoc list and from there you can find the Idoc which you have to reprocess.

Steps to fallow:

  1. We02/05 --> Display all Idocs --> Your Idoc --> Status Record (if the Idoc is successfully processed the status would be 03 for Outbound Idoc and 53 for Inbound Idoc).
  2. BD87 --> Idoc inbound process (Keep the cursor on it) --> Process.

You will encounter some scenario where you have to find the function modules used in Idoc to test why the Idoc is not getting triggered or not getting reprocessed. In those scenarios fallow the above steps to know the status. And to know the function modules we have to fallow the below steps.

Steps to fallow:

  1. WE20 --> Partner Type -->In inbound parameters select the message type (double click) --> Process Code (Double Click) --> You will find the function module (Identification).
  2. We19 --> Inbound function module -->Select call in debugging mode --> You will enter the debugger.

Wednesday, 7 November 2012

Popup Window Debugging in SAP

First let me tell you there are basically three types of debugging in SAP:
1.       System Debugging.
2.       Update Debugging.
3.       tRFC Debugging.
For more info regarding these types of debugging go through the links that I have mentioned in References.
Normally Debugger can be started in three ways:
1.       By hard coding “Break-Point” statement in the program.
2.       By setting Session Breakpoint at a particular LOC.
3.       By setting External/User Breakpoint at a particular LOC.
The main difference between Session break point and External/User break point is that, In Session Breakpoint the breakpoints exist till the time the session is active whereas in External/User Breakpoint the breakpoints exist even if the session is terminated.
Now coming to Debugging a Screen/Pop-up, we just need to add four lines of code and to know how? Fallow the below steps:
1.       Open the Note/Text File.
2.       Add the fallowing LOC into it.
[FUNCTION]
Command=/H
Title=Debugger
Type=SystemCommand
3.       Save the File as Batch File (Say Debug. Bat).
4.       Drag and Drop the Bat file on the screen which you want to debug.
5.       Finally you will see “Debugger Switched On” message in the status bar.
6.       Then use the fallowing keys based on your need.
F5 -  For Step By Step Debugging.
F6 - To Skip the Loops and Sub routines.
F7 -  To Skip Loops/Sub routines and to return to last cursor position.
Shift+F12 (Debugger --> Goto Statement) - To go to the line of code where cursor is positioned.
F8 - Execute the program and Come out of the debugging mode.

If you think that the above steps are too many to fallow then let me tell you the alternative. There is a shortcut of creating a bat file for pop-up screen debugging and for that you just have to click on create shortcut button in SAP screen.





 Now enter the Tiile, Type as "System Command" and Command as "/h"



















After that you just have to click on Next fallowed by Finish button. Once you are done with it you will see a shortcut on your desktop with the tittle you have given. Now you just have to drag and drop that shortcut on the pop-screen that you want to debugg :-)


References: