We can help. Together we learn....

How to find BAdis

by Voice | Wednesday, October 29, 2008 in , | comments (0)

Business Add-Ins (BAdis) are a  SAP enhancement technique based on ABAP Objects. Two parts - Definition and its Implementation - definition can either be SAP provided or user may also create it.


How to find BAdi
You can look for BAdi definition in IMG and in component hierarchy. But there are some easier methods to find a BAdi. They are follows:

Method 1
These steps should enable you to find a BAdi related to any transaction in a matter of minutes.
1) Go to the transaction SE37 to find your function module.
2) Locate the function SXV_GET_CLIF_BY_NAME.
3) Put a breakpoint there.
4) Now open a new session.
5) Go to your transaction.
6) At that time, it will stop this function.
7) Double click on the function field NAME.
8) That will give you name of the BAdi that is provided in your transaction.

Method 2
1. Goto SE80,  open CL_EXITHANDLER (Class)
2. Goto Method, GET_INSTANCE
3. Set a break point at 
CALL METHOD cl_exithandler=>get_class_name_by_interface
    EXPORTING
      instance                      = instance
    IMPORTING
      class_name                    = class_name
    CHANGING
      exit_name                     = exit_name
    EXCEPTIONS
      no_reference                  = 1
      no_interface_reference        = 2
      no_exit_interface             = 3
      data_incons_in_exit_managem   = 4
      class_not_implement_interface = 5
      OTHERS                        = 6.
  CASE sy-subrc.
    WHEN 1.
      RAISE no_reference.
    WHEN 2.
      RAISE no_interface_reference.
    WHEN 3.
      RAISE no_exit_interface.
    WHEN 4.
      RAISE data_incons_in_exit_managem.
    WHEN 5.
      RAISE class_not_implement_interface.
  ENDCASE.

4) Now open a new session.
5) Go to your transaction.
6) At that time, it will stop this function.
7) Double click on the function field EXIT_NAME.
8) That will give you name of the BAdi that is provided in your transaction.


Method 3:
1. Goto ST05
2. Select SQL trace and buffer trace
3. Activate trace
4. Now run your transaction
5. Deactivate trace
6. Display trace
7. A pop will come



















8. Select following objects (Views)












9. Now display the trace results. It will return all the BAPI and enhancement list in order of their execution.














Some tips

by Voice | Monday, October 27, 2008 in , | comments (0)

Here are some tips which may save some time for you. And it is always fun experimenting with the things you know.

 Problem: Suppose you are dividing two numbers (in real project scenario it is used while converting amount from one currency to another currency) and there is a requirement to round off the result.

Easy solution: Suppose you need to round it off to 1 decimal position, just use a variable having data element having one decimal position while storing the result. It will be rounded off automatically.

 

Problem: When you try to assign value from character to amount variable or quantity variable, it gives short dump.

Easy solution: Before assigning value, just assign any number to the required amount variable or quantity variable. Then use the assign the character value to amount variable. It will take the value.

Keep it in mind that value in the character field should be in the same format as the variable.

 

Problem: In Sap script, sometime it is required to print values only in the last page or first page. For this we use variables like “SAPSCRIPT-FORMPAGES” or “NEXT-PAGE”. It works fine but yet people find that their script is not printing properly.

For this I don’t have any easy solution. You can only use some text element which is either called in the beginning or in the end. But I will tell you the reason why it does not work. This problem arises when you try to use these variables in MAIN window and sadly in main window these variables do not work. So even you check your form and it seems logically foolproof, you will not get desired result. It is pain taking to debug a SAP Script so we do not even check it in debug mode and keep banging our heads. This tip can be useful for them. :)

I can give you another tip like, if you want to print any line or box something like that in the end page only and that has to be a part of main window, then I will suggest, use a pseudo window, over lapping the main window. You can use the variable in that window and can use to print something like box or line at the page you desire.

Anyways if such requirement is needed, then do let me know in the comment section; will try my best to give you some alternative logic to do so.

 

Problem: In Sap script, when we do amount calculation in sub routine pool program (a z program which is called from the Sap script to do data manipulation), even we use ‘(<)’ operator to shift the negative sign to the left of the amount, it does not work.

Solution: This is again one problem which makes developers bang their heads. The problem occurs because the variable which returns the value from the Z program is type “char”.  So command like ‘(<)’ does not work. For this you have to whether the value is negative or not in the sub routine pool itself and then if it negative, then you have to remove negative sign from the right and have to concatenate minus sign in left of the value.

 

There are many tips like this which look small but are very effective. May be sometime later… and if you want to share something, please do in the comment section.

 

Expensive SQL statements

by vinaysingh | Wednesday, October 22, 2008 in | comments (0)

Expensive SQL statements:-

These are defined as sql statements that cause database to read many blocks from disk or buffer.

User point of view: when transactions using these statements are executed, the response time is large.

Systems point of view: A large number of Data Blocks are scanned to find the selected records.

Why checking Expensive SQL statements:

a. Work processes are blocked by reports, thereby increasing the wait time for other processes.

b. a.High CPU load on database server.

c. b.Many blocks are moved from database buffer which results into bad

cache hit rate for other SQL statement.

d. c.Data base busy reading large number of blocks.



so an Expensive SQL statement reduces the performance of SAP system

Finding out the culprits:-

1. SQL statements with higher number of buffer gets.

2. reports/transaction where t he database request time

of response time.

Once we are able to find out the statements, we need to find out following for each statement:-

a.Table name.

b.WHERE cluase

c.Index used

d. Name of transaction and report containing the statement.

To get the above details:-

  • Goto DBACOCKPIT ->performance->SQL statement Analysis->shared cursor cache [sap net weaver]
  • Goto ST04 -> Detailed Analysis Menu -> SQl Request -> Sort by disk reads/ buffer gets / executions.[for others]


SM 50/66, ST05 and ST03/STAD can also be used to find expensive SQL statement.

Expensive SQL statements can be categories under following heads:-

a) SQL statements which are used by ABAP programs. - These statements can be tuned.

b) SQL Statements used by database – cannot be tuned by us.

c) SQL statements selected from SAP Basis tables –can’ t be tuned by us

d) Recursive SQL statement - can’ t be tuned by us

Tuning the tunable statements

It is done under two heads, depending on the scenarios:-

a) Case 1:- you see many buffer gets * but only few records per execution.

We can speed up the execution of SQL statements in such case by:-

- Updating the optimizer statistics.

- Creating/extending/dropping existing indexes.

- Optimizing the user input.

a) Case 2:- you see many buffer gets* and many records per execution.

In such cases, we can speed up the execution by:-

- Adapting the ABAP code, replacing “* “from the statements [“SELECT* FROM…..”]

With list of fields that are actually used by the program.

- Optimizing the user input.

- Tuning the business process.

· * you can see the buffer get @ DBACOCKPIT->performance->SQL statement Analysis->shared cursor cache (double click here)->new screen for selection criteria, put your value in buffer gets field.


We are moving to a better and faster site SAPYard.com  (http://www.sapyard.com/).

The content has been moved to below link. Please visit it at your convenience. Thank you for all your cooperation.

http://www.sapyard.com/wsdl-file-in-sap/

Creating Dynamic Internal Table

by Chinu | Tuesday, October 21, 2008 in | comments (1)








We are moving to a better and faster site SAPYard.com  (http://www.sapyard.com/).

This content has been moved to the below link. Please visit it at your convenience. Thank you for your patience and cooperation.

http://www.sapyard.com/automatic-population-of-values-during-table-maintenance/

Maths in ABAP

by Voice | Monday, October 20, 2008 in | comments (1)

Being an Engineering student, I am bit inclined towards Mathematics. A few months ago when I wanted to write a program to find out prime numbers, I felt the need of ABAP command which can give me remainder (something like % in C). Finally I found it out and here are some compilations of such ABAP commands.

Finding the absolute value of a number: |a| -> ABS( a ).
Finding the lowest integer greater than a: CEIL( a ).
Finding the greatest integer less than a: FLOOR( a ).
For trigonometric operands, try ACOS, COS, etc
Finding the square root of a, a > 0: SQRT( a )
Finding the length of characters in the string: STRLEN( a )
Finding remainder a/b: a MOD b.

If you want to remove characters from any string which has both characters and numbers then there is an easy trick.

Suppose, you have an string like 12wer34op. Take a variable which is type NUMC and assign string to this variable and you will have only integers.

Data: v_string type char10,
v_num(10) type numc.

v_string = 12wer34op.
v_num = v_string.

Write: v_num.

Output: 1234.

Try it.

We all know ABAP is very simple language and help is present just with one click. Still I face problems now and then with all the help present on the net, I feel a quick tip from a friend/colleague is more helpful. We can help you with our experience. We can help and together we can learn.

Ask your Question

by Voice | Thursday, October 16, 2008 in | comments (65)




Please ask your questions in the comment section. We will try to answer them as quickly as possible.

Categories