0% found this document useful (0 votes)
127 views

SAP ABAP Interview Q&A - Part I

This document is made by Experienced SAP ABAP Consultant. SAP ABAP Interview Q&A , ABAP Fresher & Experienced Q&A , SAP WF ABAP Technical Interview Q&A

Uploaded by

Ahamed Kaleem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views

SAP ABAP Interview Q&A - Part I

This document is made by Experienced SAP ABAP Consultant. SAP ABAP Interview Q&A , ABAP Fresher & Experienced Q&A , SAP WF ABAP Technical Interview Q&A

Uploaded by

Ahamed Kaleem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

ABAP Interview Q&A

Technical Q&A:
1. Types of Function Modulesl
2. What is RFC function module
3. What is update FM
4. How to debug update FM
5. Difference between classic Badi & Kernel Badi
6. Difference Between Pooled Table & Transparent Table
7. What is the singleton method?
8. What is an instance of a class?
9. What is private,public,protected visibility in class?
10. Difference between instance and static method
11. What is polymorphism?
12. What is inheritance?
13. What is a constructor?
14. How to retrigger the failed IDOCs?
15. How to check the status of the outbound IDOCs?
16. What are the three major components of the IDOC?
17. Transaction for assigning message,port,distribution model in IDOC?
18. What is the difference between join & association
19. How will you map the CDS to the oData(mapping CDS view as data source in oData)
20. How to trigger the workflow using the Event?
21. How to retrigger the failed workflow?
22. How to debug the workflow in the production system on any issue?
23. How user exits are found?
24. How to find and implement Badi?
25. PO related Badi’s available in SAP
26. What are customer exits?how to find and implement?
27. What is lock Object and what are its types?
28. New ABAP syntax
29. What are CDS views?What are its types?
30. How to upload the long text using infotype in HR ABAP
Answers:
1. Types of Function Modules
3 types of function modules

1. Regular Function Module


2. Remote-Enabled Function Module ( RFC )
3. Update Module

Update Module is subdivided into 4 Category

1. Start Immediately
2. Immediate Start ( Not Updateable )
3. Start Delayed
4. Collective Run

2.What is the RFC function module?


Remote Function Call (RFC) is the standard SAP interface for communication between SAP
systems. RFC calls a function to be executed in a remote system.

There is now a whole series of different RFC variants, each of which has different properties
and is used for a specific purpose

Types of Remote function call

1.Synchronous RFC
2.Asynchronous RFC
3.Transactional RFC
4.Queued RFC
5.Background RFC

3.What is update FM?


An update function module generally performs modifying database accesses and the statement
CALL FUNCTION ... IN UPDATE TASK can be used to register it for execution later with the
statement COMMIT WORK. When an update function module is created it is assigned either a
high or low priority level.

4. How to debug update FM

Call function ‘functionname’ in update task

In Debugging Screen->Setting->Change Debugger Profile/Settings->Select Update Debugging


5.Difference between classic Badi & Kernel Badi
The old classic-BADI’s are implemented purely at the ABAP Workbench level; that is, both the
definition and implementation are realized as workbench repository objects (global classes and
interfaces). The Kernel BADI takes it to the ABAP language level with new commands ‘GET
BADI’ and ‘CALL BADI’.

Apart from Classic BADI’s which have been called by Proxy class cl_exithandler, Kernel BADI’s
are called directly with the reference to the BADI definition via GET BADI and CALL BADI
statements. That is one of the reasons why Kernel BADI is faster than classic BADI. Also in
Classic BADI, while we call it via cl_exithandler, we use the reference to the interface rather
than BADI definition.

6.Difference Between Pooled Table & Transparent Table


1.Transparent Table

Exists with the same structure both in dictionary as well as in database exactly with the same
data and fields.

2. Pooled Table

Pooled tables are logical tables that must be assigned to a table pool when they are defined.
Pooled tables are used to store control data. Several pooled tables can be combined in a table
pool. The data of these pooled tables are then sorted in a common table in the database.

3. Cluster Table

Cluster tables are logical tables that must be assigned to a table cluster when they are defined.
Cluster tables can be used to store control data. They can also be used to store temporary data
or texts, such as documentation.

The major difference between transparent tables, pooled tables and cluster Tables are:

A transparent table is a table that stores data directly. You can read these tables directly on the
database from outside SAP with for instance an SQL statement.

Transparent table is a one to one relation table i.e. when you create one transparent table then
exactly the same table will be created in the database and if it is basically used to store
transaction data.

A clustered and a pooled table cannot be read from outside SAP because certain data are
clustered and pooled in one field.

One of the possible reasons is for instance that their content can be variable in length and build
up. Database manipulations in Abap are limited as well.
But the pool and cluster table is a many to one relationship table. This means many pool table
store in a database table which is known as table pool.

All the pool tables stored in table pool do not need to have any foreign key relationship but in
the case of cluster tables it is a must. And pool and cluster tables are basically used to store
application data.

Table pool can contain 10 to 1000 small pool tables which have 10 to 100 records. But cluster
tables can contain very big but few (1 to 10) cluster tables.

For pool and cluster tables you can create a secondary index and you can use select distinct
groups for pool and cluster tables. You can use native SQL statements for pool and cluster
tables.

A structure is a table without data. It is only filled by program logic at the moment it is needed
starting from tables.

A view is a way of looking at the contents of tables. It only contains the combination of the
tables at the basis and the way the data needs to be represented. You actually call directly upon
the underlying tables.

7.What is the singleton method?


Singleton is basically a static instance creation. That means when you request the instance
creation of your object, in the same LUW, SAP will always propose the same instance.

You need to specify the creation of the instance is private, otherwise, someone will use the
statement NEW zcl_temp_singleton_001().

--> We specify CREATE PRIVATE

You need a static method to create the instance.

--> Static method is not describe by METHODS but by CLASS-METHODS

You need a static variable, containing the already created instance.

--> Like method, you have to use CLASS-DATA

The example:

CLASS zcl_temp_singleton_001 DEFINITION


PUBLIC
FINAL
CREATE PRIVATE .

PUBLIC SECTION.
CLASS-METHODS get_instance
RETURNING
VALUE(ro_instance) TYPE REF TO zcl_temp_singleton_001.
METHODS set_data
IMPORTING
iv_valeur TYPE string.
METHODS get_data
RETURNING
VALUE(rv_valeur) TYPE string.

PRIVATE SECTION.
CLASS-DATA go_instance TYPE REF TO zcl_temp_singleton_001.
DATA gv_valeur TYPE string.

ENDCLASS.

CLASS ZCL_TEMP_SINGLETON_001 IMPLEMENTATION.

METHOD get_data.
rv_valeur = gv_valeur.
ENDMETHOD.

METHOD get_instance.
ro_instance = COND #( WHEN go_instance IS BOUND
THEN go_instance
ELSE NEW zcl_temp_singleton_001( ) ).
go_instance = ro_instance.
ENDMETHOD.

METHOD set_data.
gv_valeur = iv_valeur.
ENDMETHOD.
ENDCLASS.
an example how to use this code:

REPORT ztest_fred_003.

PARAMETERS p_valeur TYPE string.

DATA(mon_singleton) = zcl_temp_singleton_001=>get_instance( ).
mon_singleton->set_data( p_valeur ).

PERFORM p_display_parameter IN PROGRAM ztest_fred_003b.


REPORT ztest_fred_003b.

FORM p_display_parameter.
DATA(mon_singleton) = zcl_temp_singleton_001=>get_instance( ).
WRITE /1 mon_singleton->get_data( ).
ENDFORM.

8.What is an instance of a class?


Objects are instances of classes. Each object has a unique identity and its own attributes. All
transient objects reside in the context of an internal session (memory area of an ABAP
program). Persistent objects in the database are not yet available. A class can have any number
of objects (instances).

9.What is private,public,protected visibility in class?


Public: Means you can access the attribute or method from anywhere.

Protected: Means you can access the attribute or method from the same class or from the sub
class you have inherited

Private: Means you can access the attribute or method from only to the same class.

10.Difference between instance and static method?


Static methods are methods which can be called irrespective of the class instance. Only static
attributes and static events can be accessed within the Static method. Memory is allocated
once. Instance methods are methods which can be ONLY called using the object reference.
Instance methods can access instance attributes and instance events. Memory is allocated for
each object instance.

11.What is polymorphism?
Using inheritance, the methods in the super class can be redefined in the subclass by using a
reference variable that addresses the superclass objects. The redefined methods can have
different implementations in subclass from base class. When the super class is addressed, the
method has an original implementation. When the subclass is addressed, the method has a new
and different implementation. Using a single reference variable to call the same named methods
that are behaving differently is called polymorphism.Polymorphism is a concept of assigning
additional or different behavior or value to the inherited component from the superclass that is in
the subclass.
Example : DPC_EXT class will be generated for each oData project which is a subclass of DPC
class.The entity method in the DPC_EXT has to be redefined to meet the business need.The
entity method in the Super class refers to different code .
This behavior of the same method taking many forms is called Polymorphism.

12.What is inheritance?
Inheritance

The concept of inheritance allows you to derive new classes from existing classes. To do this,
you use the INHERITING FROM addition of the CLASS ... DEFINITION. The new class adopts
or inherits all components of the existing class. The new class is called subclass, and the
existing class is called superclass.

13.What is a constructor?
Constructors are special methods that produce a defined initial state for objects and classes.
The state of an object is determined by its instance attributes and static attributes. Content can
be assigned to attributes using the additional VALUE of the statement DATA. Constructors are
necessary when the initial state of an object is to be defined dynamically.

Like normal methods, there are two types of constructor: instance constructors and static
constructors.

Special rules apply to constructors in inheritance. These rules are not described in this
document, but can be found here.

Instance Constructors
Static Constructors

14.How to retrigger the failed IDOCs?


Execute the program RBDMANI2 and give your IDoc number.

ReProcess the Failed IDOC ID:


Requirement:
Getting an Error in the existing IDOC ID while processing. To Find out the Error need to re
process and debug the IDOC ID the below steps as follows.
Steps to Reprocess the IDOC ID:
Step 1:
1. Go to the Transaction “WE02“. To display the IDOC information i.e existing IDOC.
2. Enter the Idoc
3.Click on the execute button then it will display the information of IDOC as shown in below
screen.
4. It shows the current status of IDOC, and current status is 51.

Error message with the description:


Status Description
51 Application document not posted
52 Application document not fully posted
Success message with the description:
Status Description
53 Application document posted
Step 2:
1. Go to the Transaction “WE19”. To get more information about the existing IDOC.
2. Enter the existing IDOC and execute as shown in the below.
3. Then click on Standard Inbound.
4. Then it will show the Function Module name and logical message
5. Then click on the OK button and it will generate the IDOC.
6. Copy that newly generated IDOC.

Step 3:
1. Then go to the Transaction “SE37” and enter the function module name found in the above
step and put a breakpoint in the function module as shown in the below.
Step 4:
1.Go the Transaction “BD20“, enter the newly generated IDOC and execute.
2. After clicking on the execute button, it will trigger into the function module as shown in the
below.
3.By debugging the function module,we are able to figure out the issue, why the Idoc is not
processed.
Conclusion:
After triggering into the Function module by giving the newly generated IDOC number, then we
can debug that function module, at some point we are able to figure out the issue with the
below messages and status.

15.How to check the status of the outbound IDOCs?


Go to the table EDIDD there is a field called sdata.

16.What are the three major components of the IDOC?


● Control Record contains administrative information such as the IDoc type, message
type, current status, sender and receiver.
● Data Record contains all the IDoc data, which is stored in groups called segments. Each
IDoc may contain standard segments and custom segments.
● Status Record provides information about the various stages the IDoc has passed
through.

17.Transaction for assigning message,port,distribution model in IDOC?

WE21 port definition


WE82 Assign Messages for idoc Type
The distribution model forms the basis of distribution and controls it directly. To create a
distribution model: Verify that you are logged on to the sending system/client. In SAP, enter
transaction code BD64.

18.What is the difference between join & association


Join:
Join is used to club two different data sources and give a single view as resultant.
Types of Joins:
Left Outer Join
All the entries of the left table and matching entries between left and right table
Right Outer Join
All the entries of the right table and matching entries between left and right table
Inner Join
Matching condition between two tables.
Cross Join
All entries on the left side are combined with all entries on the right side. The number of rows in
the results set is the number of rows on the left side multiplied by the number of rows on the
right side.

Association:
ASSOCIATIONS are kind of Joins to fetch data from multiple tables on Join Conditions but
these are ‘JOINS ON-DEMAND’ i.e. they will only be triggered when a user would access the
required data which needs the Association of tables. For example, your CDS view has 4
Associations configured and user is fetching data for only 2 tables, the ASSOCIATION on other
2 tables will not be triggered and the system would return the results quickly, so it enables really
high turn-around time as compared to regular SQL JOINS.
Associations are defined with ‘Cardinality’. Syntax : association[<cardinality>]
The Cardinality concept is not new and holds the same concept with CDS views as well. There
are 4 types of Cardinality possible based on the data and relationship in the tables joined;
0..1
0..n or 0..*
1..0
1..n or 1..*
19.How will you map the CDS to the oData(mapping CDS view as data source in oData)
There are 3 different ways you can expose CDS views as OData service:

1. Import DDIC structure using SEGW Netweaver Gateway service builder transaction.
2. Reference Data Source using SEGW Netweaver Gateway service builder transaction.
3. Using Generic Annotations. (@Odata.publish:true)
First way is supported from SAP ABAP NW 7.40 SP5, Second and third ways are supported
from SAP ABAP NW 7.50 and above. For the first two ways SAP NW Gateway is used and for
the third type without use of SAP NW Gateway odata services can be created using
annotations. Gateway is used only to add the service created using annotations.

How to Create CDS View:

Firstly as a prerequisite ABAP Development tools(ADT) needs to be installed in Eclipse to


create CDS Views.On installation of ADT in eclipse open ABAP perspective as shown below:

After opening ABAP perspective, In project explorer right click in the context menu select
New->ABAP Project. A popup appears asking for ABAP system details which you need to add
to create CDS views. Details like System-ID, Username, Password have to be given and click
on OK to add the system to eclipse. Note that the ABAP system which you add should support
SAP ABAP NW 7.40 package. find the attachment for how to add ABAP system to eclipse.

Once after adding the ABAP system project explorer looks like below:
Expand $TMP package, Select and right click on Dictionary folder in the context menu to create
DDL source ABAP Repository Object

Select DDL source, click on next and give below details to create sample CDS view:

Without clicking on finish, on click on next CDS view ask for transport:
since CDS view is create in local object no transport is required, click on next then sample
templates are populated to select:

You can use any of the templates as shown above to create a CDS view. Template helps you to
create different types of CDS views with syntax auto populated on selecting the type of view. Here I
am creating a simple CDS view so I select define view template and click on finish.
In the define view template core annotations are populated with basic syntax to create view,
define the view as below:

Here I defined the sql view name as ‘CDS_DDL_SAMPLE1’ and selected data from “snwd_so”
sales order data source with some columns. After defining the view, Activate the view as shown
above. On Activation two objects are created:

1. CDS Database View (CDS_DDL_SAMPLE1)

2. CDS entity. (ZCDS_SAMPLE1)

CDS Database view can be accessed using SE11 ABAP Dictionary as shown below:
Give CDS Database View name as shown above and click on display.

DDL SQL view is created in ABAP Dictionary. Here you can identify MANDT field in the view

definition though we didnt mention it explicitly while defining the view. CDS views are default
client dependent no need to mention client field while defining the view.

Right click on CDS View created to preview the data as shown below:
Generate OData service using CDS View:

Go to the SEGW transaction. Create project as shown below:

Give project details as below:

Save project in local object. Expand project node, right click on data model->import->DDIC structure:
Create entity type by importing ABAP structure. Here give CDS Dabase view
‘CDS_DDL_SAMPLE1’, select create default entity set flag and click on next:

follow the wizard where you select parameters and key fields respectively:
click on finish, then entity, entity set and corresponding properties are created. Expand node
service implementation right click on SalesOrderSet->Map to Data Source

Here you map your CDS Database view(CDS_DDL_SAMPLE1) and CDS


enity(ZCDS_SAMPLE1). on click on map to data source popup populates to select CDS
business entity:
select type as business entity and give CDS entity ZCDS_SAMPLE1 as Name:

click on OK.

click on OK. Drag and drop properties to map fields or click on generate mapping to
automatically map the fields.
After mapping is done save the changes and click on the generate icon as shown below to generate
run time artifacts.

20.How to trigger the workflow using the Event?

We have the structure.


This structure has to be used in the class method.

Step1. Go to Tx- SE24 and create a class.

Step2. Provide the description and save.

Step3. Go to the interfaces.

Step4. To enable a class to trigger workflow, it has to implement interface IF_WORKFLOW.


When it is implemented it also implements INTERFACE : BI_OBJECT and BI_PERSISTENT.
Step5. In the attribute section define two attributes and one choose as key attribute.

Step6. In the Events section, define an event. Now the goto methods section.

Step7. Define constructor.

Step8. Define constructor importing parameter.


Step9. Implement constructor method.

Step10. Do some coding.

Step11. Create another method.

Step12. Implement the method.

Call the standard class CL_SWF_EVT_EVENT=>RAISE to raise event.


Step13. Now define the method FIND_BY_LPOR.

Step14. Put below code.

Step15. Now define the method LPOR.

Step16. Put below coding.

All other methods of the class should be activated.


Step17. So here Users : Tx- SBWP.

Step18. Go to the workflow header in Tx- SWDD.

Step19. Here initially we triggered a business object event. Now we have to change with the
Class event.
Step20. provide the class, event and activate it. Go Back.

Step21. So here we have the final Workflow.

Step22. Create a report and call the method to raise the Class event.
Step23. So here is the report output.

Step24. In Tx- SBWP we have received an email. Double click on it.

Step25. So it's the mail body sent by the workflow.

Step26. Go to Tx- SWI1 to see the workflow log.


Step27. Select the workflow and see the log.

Step28. Click on the graphical view button.

Step29. The successful mail send step is displayed in the log.

21.How to retrigger the failed workflow?


During the execution of workflow it is possible that workflow instance execution is interrupted
due to an error. Usually this may be a programming error or any other unexpected situation. The
errors can be easily detected in workflow log transaction (SWI1)
In the detail view of the workflow log we can see the error details.

Here we got an error in the execution of a background task because of a syntax error in the
method of a class.
This situation is not desired and workflow hangs out with error. It’s possible to fix programming
errors for future runs of the workflow but what about the current erroneous ones? SAP provides
transaction SWPR in order to recover workflows that have errors.
In SWPR it’s possible to search by workflow definition or workitemid or by date

When we run the report in the second screen we see the list of workflows that got error

We can select the workflow instance(s) that we want to restart. When we click on “Restart
Workflow” workflow the workflows we selected are executed.

The good thing is that workflow is not started from the beginning. Only the step that got the error
is executed. This avoids the previous steps to be executed again and undesired result as a
result of repeated execution of steps.

22.How to debug the workflow in the production system on any issue?

Method 1
First Pick one Workflow Method that is executed in Background and pick the Respective Method that
is getting called and put the External Debug Point as mentioned below.

Now go To Transaction Code SE84

Go to Utilities->Settings

For SAP S/4HANA put the User id as SAP_WFRT and for SAP ECC provide WF-BATCH
Now go to the Workflow Log and Execute a step that will trigger the Background method

After executing the Dialog Task the Debugger stops.

Method 2:
Most ABAPers are dependent on debuggers more than code editors . In the same way when I
learnt workflow, I was wondering if I can debug workflow like R3 report/WDA. There are some
situations while executing the workflow where we need to check container values on runtime
and the data flow through the workflow.
So for all the ABAPers, refer below steps. This is the magic trick to debug workflow
1. Open the BOR method which you want to debug. Put below code in it. Save and
generate the BOR.
This is infinite loop code.

2. Trigger the workflow.


3. Go to SM50, you will observe one task is in Running state with the user as WF-BATCH.

4. Select that record and click Administration from the menu bar.
Go to Program and then click on Debugging, this will open a new session for debugger.

5. Terminate the infinite loop by clicking to ‘Go to Statement’.


23.How user exits are found?

Method 1:

● Enter the transaction code in the command bar, for which you would like to
search for an user exit and then click on enter, so that it would take you to the
initial screen of the transaction.
● Go to Menu bar – Click on ‘System‘ and then click on ‘Status‘ as shown in the
below screenshot.

○ Once you click on the ‘Status‘ below the screen will pop up. Here, double click
on the program name.
○ Once the program window is open, go to Menu Bar –> click on ‘Goto‘ and then
click on ‘Object Directory Entry‘.
○ The above step would take you to a pop up window and here copy the Package
Name as shown in the below screenshot.

○ Once you get the package number, execute the transaction code SE80 (We can
also try with SE84) and then click on ‘Repository Information System’.
○ As soon as you are done with the above step the system would display the
respective Objects list, here drill down Enhancements and then Customer
Exists.
○ Now, double click on Enhancements, which is under Customer Exists, so that
the selection screen would get displayed on the right side.
○ Here go to package field and paste the copied package number from the
previous step (program) and then execute the transaction as shown in the below
screenshot.
○ As soon as you execute the above step, it would display the list of user exits for
the relevant transaction / package number.

In order to find out the relevant BADi for a transaction code, follow the above steps but instead
of expanding Customer exits, expand Business Add-ins as shown below.

○ Drill down Business Add-ins and then double click on Definitions, so that the
selection window would open on the right side of the screen. Here enter the
copied package number in the Package field and then execute the transaction as
shown below.
○ As soon as you execute the above step, it would display the list of BADi’s for the
relevant transaction / package number.

Method 2:

○ Execute the transaction code SE93 –> enter the desired transaction code in
Transaction Code field and then click on Display button as shown in the below
screen shot.

○ Once you click on the Display button it would show the below screen, double
click on the program name.
○ Once the above step is done, go to Menu Bar–> click on ‘Goto‘ and then click on
‘Object Directory Entry‘.
○ As soon as you are done with the above step, the system would pop up with a
window as shown below, copy the Package name for the further process.

○ Once you get the package number execute the transaction code SMOD –> place
cursor on Enhancement field and then press F4.
○ It would take you to the below screen (Repository Info Systems). Enter the
package number, which has been copied from the previous step. And then click
on the enter button.
○ As soon as you execute the above step, it would display the list of user exits for
the relevant transaction / package number.

Method 3:

Along with above methods I would like to show the ways to find the Exist / BADi’s at
configuration / SPRO as well.

Example: If you would like to know the relevant user exits at the functionality level like,
‘Logistics Invoice Verification’, follow the below steps.

○ Execute the transaction code SPRO and click on SAP Reference IMG –> drill
down Materials Management –> Logistics Invoice Verification –> Maintain
Customer Exits and Business Add-Ins –> click on IMG Activity Document on
Maintain Customer Exits for Invoice Verification, so that it would show the list of
Customer / User Exits for the functionality.
In order to find out the relevant BADi at the functionality level, follow the above steps but
instead of clicking on click on IMG Activity Document for Maintain Customer Exits for Invoice
Verification, click on IMG Activity Document for Maintain Business Add-Ins for Invoice
Verification, so that it would display the , so that it would show the list of BADi’s for the
functionality.
Method 4:

If you find difficulty in finding the exact node, follow the below steps

○ Execute the transaction code SPRO and click on SAP Reference IMG–> click on
Find button or press Ctrl+F.
○ Once you click on the find button the below pop up window gets displayed –>
enter Customer Exits in the Search Term field and then press enter button.

Once you hit enter, the system would provide you the list of results for the search term, which
you have entered. You should be very patient in finding the right node as the list would be very
big. You can take the ‘In Area’ reference as that would provide the information about the
functionality of the node. Refer to the below screenshot for your info.
As soon as you find the right node, double click on it and it will take you to the configuration
node, for which it belongs.
● Now you can click on the IMG Activity Document for Maintain Customer Exits for
Invoice Verification to display the relevant Exits.
2. Follow the same steps to get relevant BADi’s.

24.How to find and implement Badi?

Why BADI?

In contrast to the earlier enhancement techniques, BADI follows an Object Oriented approach to
make them reusable. A BADI can be used any number of times whereas standard enhancement
techniques can be used only once.
For example if we assign an enhancement to one custom project, then that enhancement
cannot be assigned to any other custom projects. To overcome this drawback SAP has provided
a new enhancement technique called BADI.

Transaction code for BADI Definition:

SE18
When you create a BAdI definition, a class interface will be automatically created and you can
define your methods in the interface. The implementation of the methods can be done in SE19
transaction.
When a BAdi is created following are automatically generated:

● An interface with 'IF_EX_' inserted between the first and second characters of the BAdi
name
● An adapter class with 'CL_EX_' inserted between the first and second characters of the
BAdi name.

Transaction code to Implement BADI:

SE19

Types of BADI's:

While creating a BADI using the T-code SE18, it provides the pop-up screen to select the type
of BADI to be used as shown below.

There are two types of BADI's.

1) Multi use BADI:

With this option, any number of active implementations can be assigned to the same definition
BADI. By default this option is checked.
If we want the BADI for multiple use

If you have multiple-use BADI definitions, the sequence must not play any role.
The drawback in Multiple use BADI is, it is not possible to know which BADI is active especially
in country specific versions.

2) Filter dependent BADI:

Using this option we can define the BADI's according to the filter values to control the add-in
implementation on specific criteria.

Ex: Specific country value.

How to Find BADI's in SAP system:

Method 1:

Steps to find BADI:


1. Go to SE 24 transaction, type CL_EXITHANDLER and then click on display.
2. Double click on the GET_INSTANCE method.
3. Put a break-point on the class method
CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACE.

4. Run any transaction on which we want to find the BADI's say VA01.

5. Give the transaction name VA01 and press enter.


6. It will automatically take you to the break-point which we have set in the SE24 transaction.
Each time if you press F8 a list BADI names will be displayed.
7. You can find the BADI name in the field EXIT_NAME and if you double click on it, we can get
the corresponding BADI name before hitting the corresponding screen. Based on the
requirement find the BADI name and accordingly implement your functionality using the
transaction se19.

Method 2:
Go to transaction SE84 and click on Enhancements. Then double click on Business Add-Ins.
For example, if you want to find the BADI's for the standard transaction ME22n, the procedure is
as follows. This example shows finding the way of BADI names by providing the Package of
ME22n.
1) Go to transaction ME22n. Select the System option from the menu and then click on
Status. It displays the following information.

2) Double click on the program name i.e. SAPLMEGUI. It will take you into the program
and click on Go to tab from the Menu. There we can find the package name of the standard
transaction ME22n.Copy and paste it in the package field.

3) Now Press F8, a list of BADI names will be displayed as shown below. Select the
appropriate BADI name and implement it based on the business requirement using the
transaction SE19.

Method 3:

Finding the BADI names using SE18 transaction


1) Go to transaction SE 18. Select F4 help for the definition name and click on the
Information System button as shown below.
2) A pop-up screen will be displayed and give the package name for any standard
transaction, say VA02. Finding the package is explained above. Please refer to the above
method to find the package name. The package name for the VA02 transaction is 'VA.'

3) A list of BADI names will be displayed for the transaction VA02. Select the appropriate
BADI name and implement it using T-code SE19.

25.PO related Badi’s available in SAP


Below are the PO related Badi available in SAP
ME_PROCESS_PO_CUST

26.What are customer exits?how to find and implement?


Customer exits (aka user exits) are possibilities offered by SAP at strategic moments to call
customer ABAP code so as to enhance the standard. Hence, customer exits act as 'Hook' points
for the custom business functionality.

Go to system -Status.
Check and click on the program and open it.

Once program got open click on Goto – Attributes

Check the package and note it for the next execution.


Goto transaction SMOD to check the available enhancements.

Click on Find
Put the package as VB (which we got from the program) and execute.

Below is the list of different enhancements which are available for this Tcode

We have double-clicked on the SAPLV01Z here we get 2 function modules where we need to
check the documentation if available or we need to apply break-point and try to check if it is
getting triggered.
Double click on the Include and hit enter to get it into the include… and here you can write and
do the customization.

Conclusion:

By this way, we can find the right enhancement to enhance the SAP standard Tcode / Code.

27.What is lock Object and what are its types?


Lock Object is a feature offered by ABAP Dictionary that is used to synchronize access to the
same data by more than one program. Data records are accessed with the help of specific
programs. Lock objects are used in SAP to avoid the inconsistency when data is inserted into or
changed in the database. Tables whose data records are to be locked must be defined in a Lock
Object, along with their key fields

The database system automatically sets database locks when it receives change statements
(INSERT, UPDATE, MODIFY, DELETE) from a program. Database locks are physical locks on
the database entries affected by these statements. You can only set a lock for an existing
database entry, since the lock mechanism uses a lock flag in the entry. These flags are
automatically deleted in each database commit. Database locks are therefore never available
longer than for only one database LUW. That means that in ABAP application programming,
database locks can no longer exist for the duration of one dialog step.

Lock Types
There are four types of locks in the SAP System:

● Shared lock
● Exclusive lock
● Exclusive but not cumulative lock
● Optimistic lock

28.New ABAP syntax

Old Syntax New Syntax


DATA and FIELD-SYMBOLS Inline declarations
declarations
MOVE CORRESPONDING Constructor expression CORRESPONDING, or
CL_ABAP_CORRESPONDING
struc1-field1 = struc2-fielda Constructor expression CORRESPONDING, or
struc1-field2 = struc2-fieldb CL_ABAP_CORRESPONDING;

Constructor expression VALUE

CREATE DATA / CREATE OBJECT Constructor expression NEW


GET REFERENCE OF Constructor expression REF
variable only used once, e.g. parameter Constructor expression VALUE; Inline declarations
for a method call
helper variable for type conversion Constructor expression CONV
?= Constructor expression CAST
assigning a value to a single variable Constructor expressions SWITCH or COND
within several cases or if blocks, e.g. IF
cond. var = 1. ELSE. var = 2. ENDIF.

READ TABLE Table expressions; Note: throws exception, while


READ TABLE sets sy-subrc. Catch exception and
handle error case, or use a standard value
READ TABLE … TRANSPORTING NO line_exists( … ) or line_index( … )
FIELDS
internal table WITH DEFAULT KEY suitable key, or WITH EMPTY KEY
LOOP AT… FOR … IN in constructor expressions
[result of method call] IS (NOT) INITIAL, predicative method call ( omit the ” = abap_true”
or [result of method call] = part )
abap_true/abap_false
DO / WHILE FOR … UNTIL / WHILE in constructor expressions
calculating or otherwise assembling one Constructor expression REDUCE; Note: “one result”
result from input data, e.g. from table can be a value, but also a table or complex object
rows
LOOP AT … AT NEW, or other means LOOP AT … GROUP BY … / LOOP AT GROUP
of going through grouped data
LOOP + DELETE Constructor expression FILTER
type checking (?= with TRY/CATCH IS INSTANCE OF, CASE TYPE OF
block, or usage of
CL_ABAP_TYPEDESCR)
CONCATENATE; string literals String templates
SELECT new SQL expressions; use @ to escape host
variables

29.What are CDS views?What are their types?

Core Data Service (CDS) Views are virtual data models of SAP HANA which allows direct
access to underlying tables of the HANA database. SAP CDS Views came into being with SAP’s
new programming model. SAP CDS Views aim to push logic from the application server to the
client-side and database. This is defined by SAP as ‘Code -to-Data’ or ‘Code Pushdown’. An
SAP CDS View is what performs the ‘Code-to-Data’ or ‘Code Pushdown’. The SAP CDS View
picks up the logic from the ABAP application and executes it on the database rather than the
application server.
SAP CDS Views are of 2 types:
1,HANA CDS Views
2.ABAP CDS views.
Associations: These define the relationships between SAP CDS Views and annotations and
direct the use of CDS artifacts on specific domains. On a conceptual level, joins are replaced
with simple path expressions in queries. About SAP SLT Replication
Expressions: These are used in situations where specific CDS attributes are considered as
values to be aggregated. In the data model they are used for calculations and queries. SAP
ECC and Data Extraction from an LO Data Source
Annotations: These are code snippets for enabling specific functions or for adding metadata
that is component-specific to a CDS View. Depending on their placement, annotations can be
Header annotations (affect the entire view and placed in the header of the file) or Body
annotations (affect only the line of code in front of which they are placed) Annotations provide
domain-specific metadata to enhance the data models.

30.How to upload the long text using infotype in HR ABAP?


Prerequisite to update long text in infotype is to have field ITXEX = ‘X’ in the PA table for the
specific record which infotype text to be updated .
But you may find many employees in the system which do not have ITXEX = ‘X’ . So not able to
update the text in infotype using available standard methods or macros.
Before updating infotype text we must set this field ITXEX = ‘X’ in the PA table . To set this
field value standard FMs HR_INFOTYPE_OPERATION, HR_MAINTAIN_MASTERDTA, or
standard class will not work .
Here we have a standard method to update set ITXEX = X before inserting or modifying a
record. You must call this method and update the infotype record .After updating this field value
we can call a standard method or macro to update the text .
Method
CL_HRPA_INFOTYPE_CONTAINER=>modify_text_tab will update field ITXEX = ‘X if we pass a
text table with some text only.
Below is the process to update the ITXEX field in infotype . Here I am considering infotype
0194 (Garnishment document). Below code you can use in a loop of IT1094 records or LDB
loop.
Code :
Data Declaration
data: lo_0194 type ref to cl_hrpa_infotype_0194,
lw_pernr type p_pernr.
data : fr_msg_handler type ref to if_hrpa_message_handler,
ls_container type hrpad_infty_container_ref,
lt_old_container type hrpad_infty_container_tab,
lw_ok type boole_d.
data : lr_container_temp_0194 type ref to cl_hrpa_infotype_container.
data: lw_update_mode type hrpad_update_mode,
lw_message type char50,
ls_pskey type pskey,
lw_masterdata_buffer type ref to if_hrpa_masterdata_bl,

data ls_exp type ref to cx_hrpa_violated_assertion.


data : lr_message_list type ref to cl_hrpa_message_list.
data : fr_keyref type ref to data.
data:
lc_pgmid type old_prog value sy-repid,
lr_upd_cluster type ref to cl_hrpa_text_cluster.
*——–Internal table for Text———-**
data : lt_text_194 type hrpad_text_tab,

field-symbols : <lfs_0194> type p0194.


**—–Create Object for Message handling—–**
create object lr_message_list.
fr_msg_handler = lr_message_list.**Populate PSKEY
lw_pernr = p_ls_0194-pernr.
ls_pskey-pernr = p_ls_0194-pernr. “Personnel Number
ls_pskey-infty = p_ls_0194-infty.
ls_pskey-begda = p_ls_0194-begda.
ls_pskey-endda = p_ls_0194-endda.*Create instance
try.
create object lo_0194
exporting
tclas = zcl_c=>k_tclas_a
infty = zcl_c=>k_infty_0194.
catch cx_hrpa_violated_assertion into ls_exp.
lw_message = ls_exp->get_text( ).
endtry.
if lw_message is initial .**Read record from IT0194 to fill old container********
try.
lo_0194->if_hrpa_infty_bl~read(
exporting
tclas = zcl_c=>k_tclas_a
pernr = lw_pernr
infty = zcl_c=>k_infty_0194
subty = p_ls_0194-subty
begda = p_ls_0194-begda
endda = p_ls_0194-endda
no_auth_check = ‘ ‘
message_handler = fr_msg_handler
mode = gc_mode3
importing
container_tab = lt_old_container “Infty container
is_ok = lw_ok “OK flag
).
catch cx_hrpa_violated_assertion into ls_exp.
lw_message = ls_exp->get_text( ).
endtry.
if lw_ok eq gc_true and lw_message is initial.
*Update the status*Read the container for primary record***read the container for primary
record**************
read table lt_old_container into ls_container index 1.
if sy-subrc eq 0.
**Move container to temporary container
lr_container_temp_0194 ?= ls_container.*get primary record reference
try.
lr_container_temp_0194->primary_record_ref(
importing
pnnnn_ref = fr_keyref “Primary record reference variable
).
endtry.
**Assign key reference to 0194 work area
assign fr_keyref->* to <lfs_0194>.
**Change the status to 4 –Example we can change any field here
<lfs_0194>-gstat = gc_gstat_4.
**–Modify Primary record and get the updated container reference back
ls_container ?=
lr_container_temp_0194->modify_primary_record( <lfs_0194> ).
**—–For Text—****–Modify Primary record and get the updated container reference back
**Below method is to update ITXEX and table lt_text_0194 must have some text to update
ITXEX.
append ‘TEXT’ to lt_text_194.

try.
lr_container_temp_0194 ?= ls_container.
ls_container ?= lr_container_temp_0194->modify_text_tab( lt_text_194 ).
catch cx_hrpa_violated_assertion into ls_exp.
lw_message = ls_exp->get_text( ).
endtry.
*Modify the record -After this method check PA0194 for specific record ITXEX should be ‘X’
try.
lo_0194->if_hrpa_infty_bl~modify(
exporting
old_container = lr_container_temp_0194
massn = space
massg = space
update_mode = lw_update_mode
no_auth_check = ”
message_handler = fr_msg_handler “Message handler
importing
is_ok = lw_ok “Ok flag
changing
container = ls_container ).“Infty Container.
catch cx_hrpa_violated_assertion into ls_exp.
lw_message = ls_exp->get_text( ).
endtry.
if lw_ok ne gc_true and lw_message is not initial.

try.
cl_hrpa_masterdata_bl=>get_instance(
importing
masterdata_bl = lw_masterdata_buffer ).

catch cx_hrpa_violated_assertion into lw_exp.


endtry.
lw_masterdata_buffer->if_hrpa_buffer_control~flush( space ). “DB update
endif.
***Till here we updated ITXEX = ‘X’ in IT1094 and other fields of 194 if any field need to be
updated .Below method will update text in infoytpe
create object lr_upd_cluster.
try.
call method lr_upd_cluster->update
exporting
tclas = zcl_c=>k_tclas_a “‘A’
pskey = p_pskey
histo = abap_true “‘X’
uname = sy-uname
aedtm = sy-datum
pgmid = lc_pgmid
text_tab = lt_text_0194
no_auth_check = space. “‘X’
catch cx_hrpa_violated_assertion. “#EC NO_HANDLER
endtry.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy