Oct 6, 2015

SAP ABAP FAQs- Part 2

Q: Steps to create Enhancement Spot/ BADI

1. Go to se18.
2. Enter the name enhancement spot and click create.
3. On next screen click on create new BADI.
4. Once the BADI is created then expand the tree on the left side.
5. Then double click on interface and give the name of the interface.
6. On the next screen it will ask for interface methods and its level ,that is it static or instance ?
7. Go to se19, and then click on enhancement spot ,enter the name of enhacement spot created above and click on  implement.
8. On next pop up give the name of enhancement implementation.
9. On next screen give the name of BADI implementation and its implementation class and also BADI definition just created above and save.
10. Now back to se18 and there activate both enhancement spot and BADI implementaion.And see both BADI interface and implementation.

Q: How to find BADI/Exit calls in any transaction?

Sometimes it is not so easy to find a BADI method or user exit to implement at an exact momment of the execution of a program. Here is one of the ways that can be used to spot which BADI method or user exit should be implemented.
1. Enter SE24;
2. Enter the class name CL_EXITHANDLER;
3. Double-click the method GET_INSTANCE;
5. Set a break-point at command line CASE sy-subrc (near line 25);
6. Execute the transaction you want to analyse; It will stop at the break-point you have just set on class CL_EXITHANDLER when it finds any BADI method/Exit call.
7. On debug screen, type the field name exit_name. This field contains the BADI method/Exit name which is being called in the program on that momment.
8. Press F8 to see the next calls.

Q: How can I solve dump due to insufficient memory (SELECT)?

I am using a SELECT query on a database table. Since the number of records in the table is very large,
the program dumps due to insufficient memory. How can I solve this?

In this case you could use the PACKAGE SIZE addition in the SELECT query to process in limited amount of data,
thus avoiding the memory overloads.
Ex: 
SELECT *
FROM 
INTO TABLE itab
PACKAGE SIZE .
IF sy-subrc EQ 0.
\*" Process the n records
ENDIF.
ENDSELECT.

Q: How can I convert numerals into the corresponding text?

Use the Function Module SPELL_AMOUNT to convert the integer into text.
Ex: 
DATA v_int TYPE i VALUE '1000'.
DATA words LIKE SPELL.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = v_int
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = words.
WRITE words-word.

Q: How to convert a date to internal or external format?
Use the functions modules CONVERT_DATE_TO_EXTERNAL or CONVERT_DATE_TO_INTERNAL
to convert the date. When converting to external format, the date format from the user's user profile will be used.
When converting to internal format, the result will be in YYYYMMDD format.
Q: What are indexes?
 Indexes are described as a copy of a database table reduced to specific fields. This data exists in sorted form. This sorting form ease fast access to the field of the tables. In order that other fields are also read, a pointer to the associated record of the actual table are included in the index. The indexes are activated along with the table and are created automatically with it in the database.

INDEXES are helpful for accessing data from the database tables.
PRIMARY INDEX: This is automatically generated the movement we create a database table.It is only for the key fields in the table.
SECONDARY INDEX : This is given in addition to the Primary Index already existing for the table ,so as to improve the data retrieval consistently, so as a result the performance is also increased.Secondary Index is also helpful in reducing the load on the Database.
Q: Difference between XVBAP and YVBAP in MV45AFZZ Include
YVBAP - Contains the line item data from Database VBAP
XVBAP - Contains the Current changes on the Line Items

Q:ABAP - how to read locked infotype records in HR ?

In HR master data maintenance, you can lock individual infotype datarecords. These data records are normally ignored during evaluationsusing PNPCE. If you set the PNP-SW-IGNORELOCKEDRECORDS switch to N (atthe INITIALIZATION or START-OF-SELECTION events), the report can howeverinstruct PNPCE to read locked data records too. Authorization Check: PNP_SW_SKIP_PERNR, PNP_GET_AUTH_SKIPPED_PERNRS.

INITIALIZATION.

pnp-sw-ignorelockedrecords = 'N'.

Q: How to test a RFC connection in Production?

In Production environment generally consultants do not have access to SM59. In that case use program RSRFCPIN to test the RFC destination. Most consultants must have SA38 authorization. 

Q: Enhancement section & Enhancement point 

Enhancement Point -
If you have written code using enhancement point your custom code will be executed along with the standard code.

Enhancement Section -

If you have written code using enhancement section, only your custom code will be executed replacing standard code. standard code will not be executed.

Q: What is 'Log data Changes' in Z-Table creation?


Table log history in SCU3 if the Table is logged for changes..> Technical settings-->Log data changes.

Q: Prerequisites for "For All Entries" ?

1.Duplicates are automatically removed from the resulting data set. Hence care should be taken that the unique key of the detail line items should be given in the select statement.

2.If the table on which the For All Entries IN clause is based is empty, all rows are selected into the destination table. Hence it is advisable to check before-hand that the first table is not empty.

3.If the table on which the For All Entries IN clause is based is very large, the performance will go down instead of improving. Hence attempt should be made to keep the table size to a moderate level.

Q: What are INDEX in a Table?

INDEXES are helpful for accessing data from the database tables.

PRIMARY INDEX: This is automatically generated the movement we create a database table.It is only for the key fields in the table.

SECONDARY INDEX : This is given in addition to the Primary Index already existing for the table ,so as to improve the data retrieval consistently, so as a result the performance is also increased.Secondary Index is also helpful in reducing the load on the Database.


Q: Advantages of Domains and Data Elements :
a)      Re-usability

b)      Foreign Key Relationships Can be maintained Because the Foreign Key Fields and Check table fields should have the Same Domain.

Q: Which is the better - JOINS or SELECT... FOR ALL ENTRIES...?

In most scenarios INNER JOIN performs better than FOR ALL ENTRIES, and should be used first. Only if there are performance issues should FOR ALL ENTRIES be considered, and careful measurements taken before and after to validate whether there really are performance gains. 
The effect of FOR ALL ENTRIES needs to be observed first by running a test program and analyzing SQL trace. Certain options set by BASIS can cause FOR ALL ENTRIES to execute as an 'OR' condition. This means if the table being used FOR ALL ENTRIES has 3 records, SQL Trace will show 3 SQL's getting executed. In such a case using FOR ALL ENTRIES is useless. However of the SQL Trace shows 1 SQL statement it's beneficial since in this case FOR ALL ENTRIES is actually getting executed as an IN List.
JOINS are recommended over FOR ALL ENTRIES. There is no real limit to the number of tables that can be joined; however greater complexity can make maintenance harder, and if there are problems with the join, make it harder to resolve them. If the JOIN is being made on fields which are key fields in both the tables, it reduced program overhead and increases performance. 

In some scenarios, you are presented with an internal table. In these situations, you may have no choice but to use FOR ALL ENTRIES.



Q: FAQ on OOP ABAP
http://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=281773094

1 comment:

Oracle Fusion said...

Thanks for posting the blog. I am new to this site but I felt comfortable while reading the post. Keep posting on topics like this. Wow, this blog is very nice I really like your blog and Impressive thank you very much for posting this blog.
Oracle Fusion HCM Technical Training

How to change Transport request from Released to Modifiable

Step 1: Go to SE38 – Execute Program RDDIT076.  Step 2: Give your released requests number and execute again. Step 3: After executing, yo...