Monday, June 17, 2013

RF Programming - Overriding SAP function(F1, F2, F3,F4, F5 etc) keys

Following are the steps to override the function keys for SAP RF Programming

  1. Go to GUI Status -> Utilities(Menu Options) -> F Key Consistency -> Define the Function Code for the Function Key
  2. Go to GUI Status -> Expand the Function Keys -> Click on the Function Code in the Standard Toolbar-> Extras(Menu Options) -> Function Active <-> Inactive (Deactivate the SAP standard functionality. Repeat for all those function keys which you want to deactivate)
  3. Go to GUI Status -> Expand the Function Keys -> Click on the Function Code in the Standard Toolbar-> Extras(Menu Options) -> Active functions in current status -> Select all the function codes for which you want to override the standard  functionality

Tuesday, December 11, 2012

Useful programs for SAPScript

RSTXFCONConverts SAPScript page formats
RSTXSCRPUpload and download SAPScript layout sets

Table analysis between two systems

The contents of a table between two systems can be checked through the transaction OY19

SAP Tables for Enterprise Structure

 Enterprise Structure                                    Definition
FI          T880                                       Company
            T001                                       Company code
CO        TKA01                                   Controlling area
LO        T001W                                    Plant / sales organization
T499S                                     Locations
TSPA                                      Division
SD         TVKO                                    Sales organization / company code
TVTW                                    Distribution channel
TVBUR                                  Sales office
TVKBT                                  Sales office text

TVKGR                                  Sales group
TVGRT                                   Sales group text
T171T                                     Sales district text
MM       T001L                                    Storage locations
T024E                                     Purchasing organization
T3001                                     Warehouse number
TVST                                      Shipping point
TVLA                                     Loading point
TTDS                                     Transportation
Assignment
CO        TKA02                                    Assign company code to controlling area
LO        T001K                                     Assign plant (valuation area) to company code

SD         TVKO                                     Sales organization / company code
TVKOV                                   Distribution channel / sales organization
TVKOS                                   Division to sales organization
TVTA                                      Sales area
TVKBZ                                   Sales office to sales area
TVBVK                                   Sales group to sales office
TVKWZ                                  Plants to sales organization
MM       T024E                                     Purchasing organization / company code
T024W                                    Plant to Purchase organization
T001K                                     Link plant ( = valuation area) / company code
TVSWZ                                   Shipping point to plant
T320                                        Assignment MM Storage Location to WM Warehouse

Maintaining a workflow substitute for someone else

As an administrator of workflow you may want to assign a substitute for someone else (e.g. if they are out sick)

To do this use T-Code RMPS_SET_SUBSTITUTE

Add Local SAPScript to Transport Request

At times developers develop SAPScript as local object. Unlike reports where we can change the development class using the attributes option , nothing such is available for SAPScripts.

However we can use the program RSWBO052 to change the development class.

Following are the step by step screenshots to change the development class

Click on the Object Directory and change the package

Workitem stuck in READY status but the workflow is COMPLETE

If a work item is being executed and the workflow runtime system tries to access the work item then it will not be successful due to the lock or enqueue currently on the work item.

Example 1

An asynchronous task is being executed by a user. While the work item is being executed the terminating event is raised in the system and tries to set the work item status to COMPLETE but cannot due to the lock/enqueue.In this case the event is buffered in the event queue. As soon as the work item is released, it will deliver the buffered event immediately.

Example 2

You use parallel processing where you have a fork with 2 branches (1 Branch necessary for completion). In one branch is a dialog activity step and in the other is a 'Wait for Event' step. While the dialog step is being executed by a user the Wait for Event step receives its event and continues along the branch and completes the fork (Remember only 1 branch needed for completion). Once the end of fork is reached the dialog work item should be set to status Logically Deleted but this does not occur due to the lock/enqueue on the work item while the user is executing it. Since a callback is essential for a workflow to continue running, this callback is suspended (stored in the SWP_SUSPEN table). These callbacks are started again via the RSWWERRE report. If you have not scheduled report RSWWERRE then the work items will remain in table SWP_SUSPEN and the work items will not receive their callback and will therefor will not continue.

Troubleshooting

If there are examples of work items hanging then check table SWP_SUSPEN to see if the callback work item ID is there. If it is then make sure you have the RSWWERRE job running in order to redeliver it. If RSWWERRE is running and the entry is not being delivered then please check for notes using the search term "RSWWERRE" and "SWP_SUSPEN". If there is no entry in SWP_SUSPEN, then check the workflow definition to see if the work item is asynchronous i.e. needs a terminating event as in Example 1 above. Check the event queue via transaction SWEQADM to see if the terminating event is being buffered there. If it is then it should automatically be redelivered so do a notes search in relation to the event queue.

Retrieving Email addresses from Distribution List

Distribution list(Email id's) can be maintained in SBWP. They are stored in table SOOD. It can be retrieved using function module SO_DLI_READ_API1.

Performance of transaction SBWP (Available BAdI's)

If you are experiencing performance issue in SBWP the main reason being that users have far too many work items in their inboxes (Several thousand). Some customers have a business need to have all work items in their inboxes rather than use more specific agent assignment (Call Centre scenario). Therefore several BAdI's are provided to improve performance e.g. reduce the number of work items in users inboxes
  • WF_BWP_SELECT_FILTER                                         
    This BAdI enables you to limit the number of the work items displayed by filtering. It is mainly suited to scenarios where all users are working on the same inventory of work items (for example, call center).
     
  • WF_BWP_DYN_COLUMN                                           
    Hiding the dynamic columns improves performance in the Business Workplace. If this is not possible, you can implement the BAdI WF_BWP_DYN_COLUMN to determine the values of the dynamic columns directly from the application data.
     
  • WF_BWP_OBJ_ATTRIBUTE                                         
    With this BAdI, it is possible to set the default attributes of the dominant object (_WI_Object_ID) and the grouping characteristic (_WI_Group_ID). The default attributes are used for grouping according to content, and grouping according to sort key and for hiding the group object column and work item content.

Thursday, March 8, 2012

Encode and Decode URL in ABAP

CL_HTTP_UTILITY is an utility class which provides several functions related to URL manipulations. There are many methods available in it, the one which I would like to share here is IF_HTTP_UTILITY~ESCAPE_URL and IF_HTTP_UTILITY~UNESCAPE_URL.
The method ESCAPE_URL does the URL encoding and the method UNESCAPE_URL does the URL Decoding as mentioned below:

Report YURL.
DATA:v_unescaped TYPE string,
           v_escaped   TYPE string,
           v_return_code TYPE i.
START-OF-SELECTION.
***********Example for URL encoding
  v_unescaped = 'HTTP://TOOMUCHABAP.BLOGSPOT.COM/'.
  v_escaped = cl_http_utility=>escape_url(
                unescaped = v_unescaped ).
  v_return_code = cl_http_utility=>get_last_error( ).
  IF v_return_code = 0.
    WRITE: 'Encoded URL-',v_escaped.
    SKIP 1.
  ENDIF.
***********Example for URL decoding
  CLEAR:v_unescaped.
  v_unescaped = cl_http_utility=>unescape_url(
                  escaped   = v_escaped ).
  v_return_code = cl_http_utility=>get_last_error( ).
  IF v_return_code = 0.
    WRITE: 'Decoded URL-',v_unescaped.
    SKIP 1.
  ENDIF.

How to find Enhancement(SMOD) from Function Exit

If the function module name is avaialble then you can pass this function module to MODSAP table and get the Enhancement name. This enhancement can then be used in a project in CMOD transaction.

Tuesday, January 24, 2012

10 Best Practices to Be a Successful SAP ABAP Developer

Successful & Resourceful SAP ABAP Developer
ABAP / ABAP OO development are very crucial in addressing any solution gaps, RICEFs or custom development on any SAP project. I think it is very important to know a lot of different programming aspects during an SAP implementation project and follow certain guidelines that can make an SAP ABAP professional very successful in your career.

Steps for being an Efficient SAP ABAP Programmer or SAP Technical Team Lead

1. Review Business Requirements & Write Functional Specification The first part of any ABAP development project begin with meeting the end users or business experts and understand the business requirements that need to be implemented in the SAP system during the realization phase. A best approach is to conduct workshops to gather all the business requirements. Make sure that if any SAP function consultants are involved than they are in the meetings as well. After all the business requirements are collected, either a SAP functional consultant or business expert will write a detailed functional specification. Review the functional specification until the document has all the details, different business scenarios and expected goals clearly defined. A well defined functional specification should contain UML diagrams and test case scenarios. It is important to have an official signoff on the functional specification before continuing with design and development.

2. Review ABAP Development Standards In ideal case, your SAP Project Lead or ABAP Development Manager should have created a programming standards and guidelines document. Review this document so that you follow the naming conventions for function modules, classes, dictionary objects, software components, name spaces and proxies (if using SAP XI / PI), program input/output parameters, etc just to name a few. Following the guideline for the project helps maintain a consistent coding approach and also helps other functional and technical analysts to read and debug your code. ABAP objects naming should begin with Z if it will be migrated to SAP production system and Y if it will not be migrated into the production system.

3. Write and Review Test Cases
The test case documents are written by the business experts or functional SAP consultants in most SAP implementation projects. But on some SAP implementation projects a programmer may be required to write test cases. Before writing a test case review the functional specification document thoroughly and review the written test case with the business users or functional consultants. Get a sign-off as mentioned in most steps in this article. As an ABAP Development Manager for a variety of SAP implementation projects, my goal has been to keep my team motivated and always cover the team against any change of scope on the development tasks. Having a sign-off at each phase of a SAP custom development or enhancement tasks always helps the SAP implementation team and project management team keep in sync which is a vital to complete the SAP implementation in time and budget.

4. Write and Review Technical Design Specifications Read the functional specification and list all the development objects that would be needed to implement the required functionality in the SAP system. First step is to draw a flowchart and review with technical and business experts. The technical design document should include a technical overview, list of new database objects, ABAP objects that can be reused, a data model and class diagram (if using ABAP OO classes). It is highly recommended to have a rough prototype in the sandbox system (Development system if no SAP sandbox system is available) if the development being done is complex or if the end deliverable is not well defined. You should then review your prototype with functional experts and business users. Make sure that the ABAP Development team lead or manager signs off on the prototype. If effort required to complete the ABAP programming task is not presented and approved by the senior project management then this would be a good time to get the development estimate and timeline approved.

5. Realization of the Specification - ABAP Development During this step you will be creating development objects and implementing the code in the SAP development system. Before you begin, if prototype was done in the sandbox system then analyze the prototype and design specification. Remember that quality and reusability of existing ABAP objects are more important than strictly following the design specification. Determine which existing dictionary objects can be reused for this topic. If new dictionary objects or classes needs to be created then ensure that these objects can be extended and reused for other development tasks. It may require extra effort to develop objects that are reusable and flexible. This one time effort for building reusable ABAP objects during the course of a development project can potentially save a lot of work for programming similar objects that could otherwise utilize already built objects. Review your approach with an SAP technical team lead or a development manager on your project before deviating from the technical design specification and implementing your own ideas. If you are involved in SAP XI (now Process Integration) related tasks or creating enterprise services then this is the best area where you could reuse existing objects. Review the message types that already exist within your SAP business unit and see if any existing messages can be extended with new fields. Review with the team lead whether the communication should be synchronous or asynchronous before you generate proxies.

6. SAP Development Best Practices SAP ABAP (or JAVA if working on SAP Netweaver) development best practices should be followed throughout the development lifecycle of the project. Although this aspect depends on your project technical manager, I personally have maintained a checklist for developers in my team on all projects and it has been a tremendous success in delivering high quality output on all development tasks. Here are a few best practices worth adapting in your project. Check whether you adhere to all naming conventions as described in the programming standards set for your implementation project. Include comments in your code to allow someone else to easily understand your programs. This is particularly helpful when you work in large teams and multiple people work with same objects. Ensure that you have check for user authorization if you are building transactions or web user-interfaces that will require human interaction. Check that you do not have ABAP code segments that could take a hit on performance like nested loops, nested select statements (use views if desired), excess database commits (persistent objects or buffering alternatives may be a good option), etc. Field symbols are a great asset when it comes to processing internal tables and also variables with unknown data types that are resolved at runtime. Field symbols are very similar to concept of using pointers in OO programming landscape. Check if all exceptions are handled and error messages are communicated accurately to the end users. As an ABAP programmer it should be well accepted by now that short dumps should not be OK to occur. All these do occur in unknown special case scenarios the short dumps should be fixed.

7. ABAP Code Reviews and Performance As a ABAP programmer you should test your code upon completion for all possible scenarios. Verify that end results are same as that expected in the documented test cases. Perform ABAP runtime analysis to check for performance of your code. Seek suggestions from your technical team lead or manager on how to improve code performance if you notice any red flags during the runtime analysis. Schedule a formal code review with your mentor or a senior ABAP developer once the development is completed and tested by all responsible developers. Make any revisions and retest your code against the desired output as documented in the test scripts. Remember that code reviews is not to find flaws in your programming but it will only make you a better ABAP developer and maintain consistency.

8. Documentation Make sure you write an end user documents with overview of the functionality or enhancement upon completion. Include screenshots where possible. Prepare documentation keeping in mind that an end user unfamiliar with your deliverable can read the document and test the functionality. Include contact information in this document for users to easily reach the SAP technical team for any questions.

9. User Acceptance Testing Now that your ABAP coding is completed and reviewed by technical experts, it is time for the business users to perform a formal user acceptance testing. UAT testers will check whether the output meets business process requirements and suggest any improvements or modifications to the delivered functionality. After completion of these fixes or modifications you should request a formal sign-off on the functionality.

10. Migration to SAP Test System and Production System
Quality assurance engineers will test your functionality in the SAP QA environment to verify that everything is working in your delivered functionality as tested during user acceptance testing. Also any problems in transporting your ABAP objects across SAP systems will be identified and addressed during this step. If no problems are found then your transports will be approved to be migrated to SAP production system in the next transport cycle.

You have just learned how to be an efficient SAP ABAP Developer or per say a high quality Senior ABAP expert right from writing specifications until realizing your implementation in production system. Use this article as a guideline as there are many more aspects to improve yourself to be a good ABAP programmer which is not possible to cover in a brief article like this one. You can always contact me with any suggestions or ideas you may seek for your SAP implementation.

Ref.- http://ezinearticles.com/?10-Best-Practices-to-Be-a-Successful-SAP-ABAP-Developer&id=1556194

Friday, January 20, 2012

Transport Organiser Search for Requests

You may want to search for a specific Transport you can do the following:

Transaction SE10
Select Goto–>Transport Organizer Tools
Select “Search for Objects in Requests Tasks“

Here you can search for a specific , Program, Function Group, Class, Table/Structure, View, Table Type, Data Element.

If you wish you can search for other objects too by doing the following:

Enter TABU in the object field press enter, this will create a line which says R3TR-TABU where you can then enter the table name which you would like to search on. (R3TR-TABU will give you transports with the content of the table has been transported, should you wish to see the actual movement of a table you can use R3TR-TABL.)

There are over 800 valuees you can use on R3TR, which can be seen from using F4 on the object key and once you get the result limited to 500 values, select Shift+F5 to increase the number of values to 900 and select Program ID R3TR.

Other good values to use for example are R3TR-VDAT and R3TR-VIEW.

Generate Routines Automatically in each target client

If you want to Generate a Routine/Requirement/Formula/Include automatically in each client it is transported to, you have the following 2 options:
 
1. In the Transport Organizer you can manually add the following entry to the parent Workbench Request for the Routine.
R3TR    XPRA     RV80HGEN.
This automatically executes report [RV80HGEN] after the Transport Request has been imported into the target system.
Please see SAP Note 22808 for more detail.
 
2. Alternatively, you can apply SAP Note 598475 to your development system. This effects a change in VOFM, automatically by adding the entry above to each Workbench Request created from VOFM.

Table contents transport

Q – How do I delete table values from a client. For example I have 969 values in client 2 and 966 values in client 1. I want to move all 966 values to client 2, and therefore delete the surplus values in client 2.

Answer – This is easily done by using a asterix in the key in the transport. Create a transport for the table, eg: R3TR TABU and the key of the from client with a * in the next field of the key. The result will be the target client will have the values of the table deleted and all the values of the source client copied into the target client.

Dont forget to test you can use SCC1, between your development client and a sandbox/test client.

Can I compare the values inside a table across clients?

Hi There, I have a table with many entries in it. Is there a way to compare the data values across clients without having to export both tables and do a Vlookup / Hlookup in excel?

Yes, there is You can compare the values of records in tables across clients by using transaction SCMP.

Which Hot Package(support pack) is installed?

How do I know what support pack is installed?

Within the system go;

System–>Status–>click on the display ICON under component information –>Select the SupPack tab–>All the support packagaes may be seen.

How do you add activities and nodes to IMG Structure

Question – How to add nodes and activities to the IMG structure (SPRO)?

Answer – You can edit the IMG structures using transaction SIMGH. For complete step by step procedures follow this simple instruction

http://help.sap.com/saphelp_sm32/helpdata/en/9a/b7b2375ca97f68e10000009b38f8cf/content.htm