Thursday, June 13, 2013

Enhancements Types

Enhancements
History of Enhancement -
Initiallly User-Exits were used as mode of enhancement. These use function modules as a source for user code. SAP provided hooks were a function module is called. This function module has a defined interface and has an include program. The user would add his code in this include program and activate it. Now when the standard transaction will be called so will the code added by the user at that specific point.
The main problem with user exits was that only a single implementation was possible. That means if an enhancement is included in a project that can not be reused as long as the project is active.
To over come this issue SAP came up with Badi's which supported multiple implementations. Now several users could create instances of the same object as it followed the OOPS concept. These enhancements were good with transactions but if an enhancement was required on a standard report than SAP gave what are known as Enhancement Spots. These were made available in version ECC 6.0 on.
These spots would be implicit or explict.
In implicit they are available at the beginning of subroutines defined in the standard reports.Edit-> Enhancement operations->show implicit enhancement options. This will highlight all the implicit enhancements in the report.
In Explicit enhancement we have two different types of enhancements - Enhancement point and Enhancement section.
Enhancement point - SAP has some standard functionality defined for a report , but it may be required that you'll need to add your own code. In this case the code that you'll add will be executed along with the standard code.
Enhancement section - SAP has its standard functionality defines but it may not suit your requirement, in that case you may need to add your code and you'll need that code to be executed only. By this method the existing code is automatically commented and a copy of the same code is available to edit.
After executing the report only your code will be executed and the standard code will be bypassed.
To identify an enhancement spot (more specifically and enhancement point/section) that will be mentioned on code as shown below
On the application toolbar there will be a button for enhance (Shift+F4). Place your cursor on the name of the enhancement (name just after the enhancement point keyword). This will cause the screen to white with grey text.Right click on the name and select  enhancement implementation->create.
This will allow you to add your code in case of enhancement point and will create a copy of the existing code in editable mode and comment the existing code in case of enhancement section.

SAP to send external mails


How to configure SAP to send mails.

After reading lots of threads related to this subject I found that most of the issues can be resolved by reviewing a few simple steps.
First you need to read the basic configuration found in the SMTP guide available in help.sap.com, If after that you still have trouble here is a few tips.
  1.  Always check that the port (usually port 25) is open and you can reach your SMTP server. You can do this by simply telnet the port if the port fail to reply please contact your network team.
    1. Open a command prompt
    2. Telnet
  2. Check that the IP Address of you SAP Server is maintained on the SMTP Relay Agent of your SMTP Server. Basically SMTP server require authentication by adding the IP Address of your server in the SMTP Relay Agent all the requests coming from your SAP system will be "trusted".
  3. Make sure that the E-mail Address and the Communication Method are maintained in SU01, this is a basic requirement to send an e-mail and without it your mail simply won't be sent.
Also please refer to following SAP Notes,
Note 455140 - Configuration of e-mail, fax, paging or SMS using SMTP
Note 455127 - E-mail (SMTP) in different SAP releases

Business Configuration Sets (BC Sets) and their use

What are Business Configuration Sets (BC Sets)

BC Set is a management tool that allows user to record, save and share customization settings. BC sets are snapshot of customization settings that can be used later as template or customization backup. BC sets can also be used in group rollouts where the customization settings can be compiled for pilot and passed on in a structured way to other rollout locations. SAP also provides pre packaged BC sets for selected industry sectors.
When BC Set is created, values from original customizing tables are copied into BC Set. When you activate this BC set in other system the values stored in BC sets are copied to corresponding customizing tables of the system. The settings in the BC set can be compared with system data to check the consistency of data
Benefits of BC sets
1. Store customization settings backup
2. Useful in Template Rollouts
3. Efficient Change Management
Types of BC Sets 
There are two types of BC sets e.g. Simple BC Set and Hierarchical BC Set
1. Simple BC Set - BC set contains data from customizing table rows and columns. There is no limitation on the size of BC Set. BC set can contain data from one or more IMG activities 
2.       Hierarchical BC Set - Hierarchical BC set consists of other BC sets which can be simple BC Sets or Hierarchical BC Sets. They represent hierarchy of BC sets. 
Example - Creating and Activating BC Set
Create BC Set
1.       From SAP Easy Access Menu, Tools -> Customizing -> Business Configuration Sets -> Display and Maintain BC Sets (Transaction Code SCPR3)
2.       From Menu, BC Set -> Create
3.       Enter Name and Text For BC Set
4.       Select option 'IMG Hierarchy' in Create BC Set From section to create simple BC Set and continue 
Other options e.g. Set of BC sets creates hierarchical BC Set and you can also create BC Set from Transport Request
5.       Choose the IMG Node for which you want to copy the table values in BC Set

The tables are shown in the Tables and Views for Selected Customizing Object.
6.   Select the data which you want to copy from Data Records tab 
7.   Go to Field Select Attributes and assign one of the attribute to the field.
The possible attributes are Standard, Not Changeable after activation and Get Values at activation
 
8.   Repeat the above steps for IMG Table Data you want to store in BC Set and then Save from Menu, BC Set -> Save.
Specify package under attributes
Exporting BC Set
You can download the BC set for usage in another system by following steps
1.  From SAP Easy Access Menu, Tools -> Customizing -> Business Configuration Sets -> Display and Maintain BC Sets (Transaction Code SCPR3)
2.  Select Download BC Set from BC Set -> Download
Importing BC Set
You can upload the BC set for usage by following steps
1.  From SAP Easy Access Menu, Tools -> Customizing -> Business Configuration Sets -> Display and Maintain BC Sets (Transaction Code SCPR3)
2.  Select Upload BC Set from BC Set -> Upload
Activate BC Set
After activating BC Sets, the values in the BC set are available in the system. The new or Changed data is available into a change request which can be used to transport in production system.
Before activation, following standard functionalities are available
-       Display
-       Consistency Check
-       Key Conflict Check
-       Compare with Customizing Tables
-       BC Set/ BC Set Comparison
It is a good practice to do the checks to avoid errors in customizing tables. BC sets can be activated if there is no production client in system
1.  From SAP Easy Access Menu, Tools -> Customizing -> Business Configuration Sets -> Activation of BC Sets (Transaction Code SCPR20)
2.  Enter the name of the BC Set and select Activate from Menu
3.  Provide Customizing Request 
The following message is displayed
'Caution You have started the BC Set activation If you continue, new data records will be created and/or existing ones overwritten' 
4.  Various activation options are available, choose appropriate and to proceed with the activation, choose Continue.
5.  BC Set is active and BC set data is stored in customization tables 

Thursday, June 6, 2013

ABAP Tip-How to Debug Pop-up window

How to Debug Popup Window

Creating SAPGUI shortcuts

Introduction
SAPGUI shortcuts are files located on a computer with SAPGUI for Windows installed, which are used to login directly to a SAP system, or run directly a SAP transaction, or entering okcode commands on modal dialogs.

How to create a SAPGUI shortcut
There are 4 ways to create a SAPGUI shortcut:
Approach 1:
  • Click on the Create shortcut icon on a the toolbar in a SAPGUI session
  • In the popup window, enter the values you need See SAP Library and note 103019 in Links chapter below for more information. The TYPE field may be Report, Transaction or System Command (this late one is useful for entering /H in popup windows)
  • A shortcut on the Desktop (or the location you entered) will be created
Approach 2:
  • From desktop, choose Create SAP Shortcut using contextual menu and enter file name with extension .sap
  • Then choose Modify in the SAP Shortcut contextual menu and enter Shortcut attributes as above
Approach 3:
  • Create a text file with .SAP extension on the desktop with this kind of content (replace the values with your local ones):
    [System]
    Name=YD1
    Description=04 - **** Solman ****
    Client=100
    [User]
    Name=ALBERT
    Language=
    [Function]
    Title=Debug
    Command=/H
    Type=SystemCommand
    [Configuration]
    WorkDir=C:\Documents and Settings\albert\SapWorkDir
    [Options]
    Reuse=1
    
    The parameters are more or less explained in note 103019 below, as the sapshcut.exe parameters have the same names.
Approach 4:
  • It is also possible to create a shortcut file from an ABAP program by calling SWN_CREATE_SHORTCUT function module, and save the text to a file (using GUI_DOWNLOAD function module). See the wiki in the Links below.
How to execute a SAPGUI shortcut :
There are 3 ways to execute a SAPGUI shortcut:
  • Double-click the .SAP file from Windows desktop or Windows explorer
  • You may execute a .SAP file by sapsh.exe before 4.5 and sapshcut.exe after 4.5
  • Drag and drop the .SAP file to an existing SAPGUI session window. It is especially useful for system commands (okcode commands) that need to be entered on a modal window (popup) as the okcode field is protected, like /H, /RON, /ROFF, etc.
    • Locate the window of your SAP popup window:
    • Display desktop by Windows-D key, then drag (do not drop) the shortcut to the window
    • Drag the shortcut to the popup window:
    • Drop it:

Debugging workflows and generating sub-workflows

Workflow Debugging
First of all, you cannot set breakpoints in a workflow, so I assume you mean that you have set a break-point in a method used in one of the task's used in your workflow?
If so, and if this task-method is a background method (i.e. a non-dialog task), debugging is not possible, since a background method, as the name states, is executed in another context in background.
To see how the workflow passes values from/to the different container's, you can use transaction SWUD (to see if the values needed for your method, are binded correctly).
Other useful tools for workflow error search, are: SWEL (first turn on even trace with SWELS) or simply look at the workitems created to see what kind of errors they may have encountered: SWI2_FREQ f.x.
If background task, I recommend you use SWUS for the specific task in question to create a WorkItem. Find the workitem with SWI2_FREQ, then display it. From there, display Container, to see the outcome.
You can debug the method, from SWO1 for the Object Type owning the method. From SWO1 simply click the test button. Then click "create instance". Execute the method for the object instance and you will be able to debug the method.
Generating Sub Workflow
1. Add one of your subflows to the main workflow as an activity step and define the binding. This subflow is just a place-holder and will be replaced by another subflow when the workflow runs.
2. In the step definition specify "Task to be determined using an expression" and specify which container element (or expression) contains the subflow ID to be used.
At run time, the place-holder subflow will be replaced by the subflow that is specified by the expression. In other words this expression reads the table that you created to find the subworkflow to call and this subworkflow is called by the main workflow instead of the (static) place-holder subflow.
Finding out the Object Types involved
  • Switch the event trace ON (Tcode SWELS), carry out your transaction and view the event log (Tcode SWEL).
  • If there is a standard event then the trace will tell you the name of the object and the event raised.
  • Otherwise create your own object and events and trigger it (them) using FM "SWE_EVENT_CREATE".

ABAP Debugger Tips

This  post lists few frequently asked questions about abap debugger

Create maintenance view variant

This post explains how to create a maintenance view variant for an existing maintenance dialog.

NOTE: When you create a maintenance view variant, no new dialog is generated, i.e. all screens and function modules of the original dialog are used. For this reason, all basis dialog checks are made in view variant maintenance.

Prerequisites: The basis dialog for which the maintenance variant is created already exists.