Você está na página 1de 32

Awesome Link with basic FAQs:

http://wiki.scn.sap.com/wiki/display/ABAP/ABAP+Dictionary+FAQ
T codes
SM37 Job selection
SM59 Maintain RFC destinations
SM50 To cancel a background job
SM30 Maintain DB tables (TMG)
SM36 Scheduling a background job
SM12 Display / Delete lock entries
SMOD SAP Enhancement Management
SM51 List of SAP Systems
SM62 Display / Maintain events in SAP (also use FM: BP_EVENT_RAISE)
The T codes the starts with suffix M are Maintenance transaction codes in SAP.
STMS T code to find out which test system my current development system is
connected to
SE54 TMG or Utilities -> TMG
SE78 T code to store images (graphics)
Why SAP Scripts are client dependent and smart forms are client
independent?
Short Answer: Because SAP Scripts use text symbols to display stuff from driver
program and Smart forms do it via function modules. Smart forms will be executed
through a function module i.e., when a print program calls a Smart Form, the form
itself takes over to produce output, without any further direction from print
program. Unlike text symbols the FMs are client independent hence the proof.
http://www.saptechnical.com/Tutorials/Smartforms/Client/dependency.htm
Parallel processing in ABAP
http://sapignite.com/learn-parallel-processing-in-abap/
Useful questions for interview purposes
http://scn.sap.com/thread/268618
Creating search help views
We can also provide database table or database view name there, but suppose if we
want to get data as outer join then Help View is provided. It uses left outer join to
select the data while database view uses inner join.
SELECT-OPTIONS: so_werks FOR ekpo- werks MATCHCODE OBJECT ztest_help.

http://saptechnical.com/Tutorials/ABAP/View/Help.htm
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

Creating view cluster


http://www.saptechnical.com/Tutorials/ABAP/Viewcluster/Page4.htm
Difference between select single and select up to 1 row?
SELECT SINGLE returns the first matching record for the given condition and it may
not be unique, if there are more matching records for the given condition. No End
Select required. You need to mention all the key fields of the table.
SELECT ... UP TO 1 ROWS retrieves all the matching records and applies aggregation
and ordering and returns the first record. End Select is required. You can use if you
do not have all the primary key fields available.
According to SAP Performance course the SELECT UP TO 1 ROWS is faster than
SELECT SINGLE because you are not using all the primary key fields.
Difference between Type and Like?
Type direct reference to the SAP predefined data types (or Data elements) by the
data object.
Ex: DATA var1 TYPE i.
They do not occupy memory.
Like Indirect reference to SAP predefined data types (or Data elements) by the
source data object for the given target data object.
Ex: DATA var2 LIKE var1.
They occupy memory.
What is a field symbol?
Field symbols are place holders or pointers for other fields. They do not take up any
space but they point to its contents. A field symbol can point to any data object. The
data object to which a field symbol points is assigned to it after it has been declared
in the program.
Get and Set Parameter Example
DATA: var(10) TYPE c.

var = 'test'.
SET PARAMETER ID 'XYZ' VALUE var_1.

you set the parameter XYZ to the value test in the global memory.
You can then access this value in another program by getting it out of the memory
using
DATA: var(10) TYPE c.
GET PARAMETER ID 'XYZ' VALUE var_2.

Prepared By Nirmal Jain- Certified ABAP Developer


9620161251

So with this you can pass parameters from program to program. Check also the F1
help for the set/get parameter statement. Uses SAP Memory and generally SP is
used in PAI, GP is used in PBO.
Types of function modules
Broadly classified into three types namely: Normal FM, Remote enabled FM and
Update FM
Types of classes
Local classes, Global classes, Exception classes (CX_ROOT, CX_DYNAMIC_CHECK,
CX_STATIC_CHECK), Assistance classes (CL_WD_COMPONENT_ASSISTANCE),
Persistence classes, Data class, Delivery class.
Difference between Standard table, Sorted table and Hashed table?
Standard Table: These tables have a linear index and can be accessed using the
index or the key. The response time is in linear relationship with number of table
entries.
Where this is used?
These tables are useful when user wants to address individual table entries using
the index. (APPEND)
By default TYPE TABLE (it is of type standard table) and TYPE STANDARD TABLE are the
same.
Sorted Table: These tables also have an index and the key. But, the response time
is in logarithmic relationship with number of table entries, since it uses binary
search algorithm instead of linear search.
Where this is used?
These tables are useful when user wants the table to be sorted while additional
entries have to be added. (INSERT)
Hashed Table: These tables have no index, but have the key. The response time is
constant irrespective of number of table entries, since it uses a Hash algorithm.
Where this is used?
These tables are useful when user wants to access the entries with key
only. (INSERT)
INSERT wa INTO TABLE hs_itab

Difference between Transparent table, Cluster table and Pooled table?


Transparent table:
It has a one- to- one relationship with a table in the database
Table in the database has the same name as in the dictionary
Transparent tables are used to hold application data
Application data is the master data or transaction data used by an application
These tables can be buffered and also secondary indexes can be created
These tables can be accessed using a key field or without one
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

Examples: MARA (Material Master), EKKO (Purchase order transactional)

After making changes to a table, in order to reflect the changes go to transaction


SE14 and Choose Edit and then choose Activate and Adjust Database.
OR
You can directly activate it from the SE11. Go to Utilities-> Database Object ->
Database Utility -> Activate and Adjust Database.
Pooled table:
These 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 is then sorted in a
common table in the database.
The basic idea of the table pool is the storage of data records from the tables
defined in ABAP dictionary that are not dependent on one another. Intersection of
key fields of the tables which are combined is empty. Ex: RFCDOC
It has many-to-one relationship with a table in the database
Used to hold system data, such as System configuration information, or
historical and statistical data
It is a database table with a special structure that enables the data of many
R/3 tables to be stored within it. It can only hold pooled tables
Pooled tables are primarily used by SAP to hold customizing data
During initial implementation of the system the data in the customizing
tables is set up by a functional analyst
A table in the database in which all records from the pooled tables assigned
to the table pool are stored corresponds to a table pool
These tables should be accessed via primary key. They should be buffered and we
cannot create a secondary index for them.
Ex: Look up tables, match codes
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 idea of cluster tables is that you store functionally dependent data which is
divided among different tables in one database table. Ex: CDPOS
These tables can be accessed via primary key or without one but the catch is
without the primary key DB access will be slow. No secondary indexes can be
created (Index disabled in BSEG). Statistical SQL functions (SUM COUNT MAX AVG
MIN etc.) are not supported. These tables cannot be buffered.
Ex: BSEG
Views
Usually functionally depend data spread across multiple tables; we can be brought
together by means of a view. A view is a logical view on one or more tables i.e., a
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

view is not actually physically stored, instead being derived from one or more other
tables.
Benefits of View are:

Views can hide complexity


If you have a query that requires joining several tables, or has complex logic
or calculations, you can code all that logic into a view, then select from the
view just like you would a table.
Views can be used as a security mechanism
A view can select certain columns and/or rows from a table, and permissions
set on the view instead of the underlying tables. This allows surfacing only
the data that a user needs to see.

Types of Views in SAP


Database View:
Database views are implement an inner join, that is, only records of the primary
table (selected via the join operation) for which the corresponding records of the
secondary tables also exist are fetched. Inconsistencies between primary and
secondary table could, therefore, lead to a reduced selection set.
In database views, the join conditions can be formulated using equality relationships
between any base fields. In the other types of view, they must be taken from
existing foreign keys. That is, tables can only be collected in maintenance or help
view if they are linked to one another via foreign keys.
Projection View:
Projection views are used to suppress or mask certain fields in a table (projection),
thus minimizing the number of interfaces. This means that only the data that is
actually required is exchanged when the database is accessed.
A projection view can draw upon only one table. Selection conditions cannot be
specified for projection views.
Help View
Help views are used to output additional information when the online help system is
called.
When the F4 button is pressed for a screen field, a check is first made on whether a
matchcode is defined for this field. If this is not the case, the help view is displayed
in which the check table of the field is the primary table. Thus, for each table no
more than one help view can be created, that is, a table can only be primary table
in at most one help view. Uses left Outer Join
Maintenance View
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

Maintenance views enable a business-oriented approach to looking at data, while at


the same time, making it possible to maintain the data involved. Data from several
tables can be summarized in a maintenance view and maintained collectively via
this view. That is, the data is entered via the view and then distributed to the
underlying tables by the system. Uses Outer Join
How to display table entries in an adobe form?
Depending upon the structure of the table create that many text textboxes. Bind
these text boxes with table-column and that many text boxes will get automatically
created depending upon the entries in the internal table.
Ex: Internal table itab_person contains two fields namely name and age, this table
consists of 5 entries.
Now create two text fields in adobe text_field_1 (choose multiline)and
text_field_2 (choose multiline). Bind the first field with name and the second
with age. On execution of the form, five entries will get automatically created .
How to display layout based on conditions?
By making use of a special interface object called ALTERNATIVES and binding the UI
elements to either TRUE or FALSE. Based on the outcome of this parameter the
respective UI element gets displayed.
Hidden fields in DB tables?
They can be enabled by Goto -> Text Table. (Ex: T458A)
Difference between methods and events?
Event Handler: Event handler is a special method that is designed to be called
when a User Interface Action occurs. It gets parameters that supply more
information about the event. For example when you place a button on the screen,
there is an action for when the button is pressed. The method that responds to this
action is the event handler.
Methods: Method is a normal object oriented construct for encapsulating
programming logic. It is a general term that refers to different types of groups of
code. Both Supply Functions and Event Handlers are technically methods as well.
Note:
We cannot call Form Endform (Subroutine) in a method because you are mixing up
Procedural programing and object oriented programming. But we can call methods
in Form Endform given only when the class is global.
But there is a way in which we can call this subroutine and that is by using
PERFORM <subroutine_name> IN PROGRAM testprogram USING....CHANGING .....
FM can be called in subroutines and vice versa is also possible given that subroutine
include is in function group.
Methods can be called inside FM and FM can be called in methods.
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

FM to pop up dialog box in reports?


FM: POPUP_TO_CONFIRM

Other FMs are POPUP_TO_CONFIRM_WITH_MESSAGE


Difference between customizing and workbench request?
Short Answer:
Workbench requests (Client Independent) are those that involve changes to crossclient customizing and repository objects. The objects are independent of the client.
Hence the requests are used for transferring and transporting changed repository
objects and changed system settings from cross-client tables. (Ex: code changes)

Customizing requests (Client Dependent) involve changes recorded to client-specific


customizing objects .These client specific requests are used for copying and
transporting changed system settings from client-specific tables. (Ex: SM30 TMG,
SAP Scripts, OOP Events, SPRO)

http://scn.sap.com/thread/1289150
Enhancements
Customer exits and BADIs refer to all modules like MM, SD, PP, FICO etc., where as
User exits generally refer to SD module
User Exits: User Exit is an ABAP form that is called by SAP standard programs. It is
identified with a three character code that tells the SAP system that a custom chunk
of code needs to be executed at a predefined point of a standard SAP program. The
character codes look like SXX or UXX where XX represents a two-digit number. If a
code starts with S letter, it is a standard user exit delivered by SAP. If a code starts
with U letter, it is a custom user exit defined by a user. Inside a user exit it is
possible to read and change almost any data (local or global) from the host SAP
program. Therefore, user exits give you a lot of flexibility but this flexibility comes at
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

a price of the higher risk to make a critical error that would lead to an ABAP dump or
inconsistency in database records.
User Exits are subroutine based (i.e, Form End form) and it is not preferred mainly
because when we update the system (Ex: ERP 6.0 to 7.0) then all these
implementations will be lost (or broken), and since we will directly touch the source
code of the standard programs we will need an Access key to make changes in the
system. User exits are also called MODIFICATIONS and are created in SAP
namespace. Multiple implementations are not possible. USEREXIT_XXX
Basic Exit Name: MV45AFOA
Customer Exits: Customer Exit is an ABAP function that is called by SAP standard
programs. It serves the same purpose as User Exit: enabling users to add their own
functionality to the standard SAP transactions. There are several types of Customer
Exits: Menu Exits, Screen Exits, Function Module Exits, and Field Exits. Unlike User
Exits, Customer Exits are more restrictive in terms of what you can do with them
because inside a Customer Exit you can only access and manipulate the parameters
specified with keywords import, export, changing, and tables. At the same time it is
much safer to use Customer Exits than User Exits because the risk to break
something or create inconsistent database entries is low.
Customer exits on the other hand are completely function module based and can be
upgraded. They are easy to find and implement and you do not require an access
key. They are also called ENHANCEMENTS and are created in Customer
namespace i.e., FM holds the include in customer namespace and hence standard
SAP code is not affected. Multiple implementations are not possible. CALL
CUSTOMER FUNCTON
BADIs (Business Add-In): BADIs (Business Add-Ins) are custom enhancements to
the standard SAP system. You can insert them into the system to accommodate
user requirements that are not very common and should not be present in the
standard configuration of SAP. For instance, in a particular industry, you may have a
specific requirement in a business process that cannot be covered by the standard
functionality of SAP. This requirement can be addressed by creating a
special BADI that will implement the missing functionality. BADI provides similar
customizing
opportunities
as Customer
Exit but
it
is
more
powerful
because BADI does not assume a two-level infrastructure (SAP system and
customer developments) like Customer Exit. BADI allows more complex system
infrastructure that can include SAP, country-specific versions, industry solutions,
customer developments, and so on.

Prepared By Nirmal Jain- Certified ABAP Developer


9620161251

BADIs are powerful and can also have multiple implementations (execution of these
are unknown i.e., not they get executed however they want, not in order). BADIs
have OOPS based and can also have filters (i.e., we can specify execution conditions
ex: if we set location as ZH then the BADI gets executed only in China)

What is the difference between them and when to use what?


Probably, some differences between BADI, BAPI, User Exits, and Customer Exits are
already clear based on the descriptions that we provided above. Nevertheless, let
us elaborate a little bit. If you need to enhance the standard functionality of SAP,
you should be looking at BADI, User Exits, or Customer Exits. They all are created
with the purpose of enabling a convenient plugging of new (custom) functions in the
standard SAP programs using predefined hooks. These three enhancement
interfaces offer more or less similar capabilities but BADI is currently the most
advanced approach towards creating custom enhancements in the standard SAP
functionality. On the other hand, BAPI serves more general purpose and simply
provides an interface for accessing data and processes inside an SAP system. One
of the most common applications of BAPI is to enable connections between SAP and
non-SAP system.
Method to Find out Exits: http://scn.sap.com/docs/DOC-54384
Wiki SCN link: http://wiki.scn.sap.com/wiki/pages/viewpage.action?
pageId=189893877
Understanding concepts:
http://sap-certification.info/badi-vs-bapi-vs-user-exits-vs-customer-exits/
How to find Customer Exits?
http://scn.sap.com/thread/568493
Demo on Screen, Menu, FM exits in once example (all customer exits)
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c062ce36-24782c10-6b93-d6f3ec85883f?QuickLink=index&overridelayout=true&44929653158267
One more awesome example for Enhancements
http://sapignite.com/menu-exit-in-sap-abap-with-tutorial/
Interactive, Classical and Module Pool events
Interactive:
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

AT
AT
AT
AT

LINE SELECTION
PF
PF STATUS
USER COMMAND

Classical:
LOAD OF PROGRAM
INITILIZATION
AT SELECTION-SCREEN OUTPUT
AT SELECTION-SCREEN ON <variable> (Can be SO, parameter, radio button etc.)
usually authority check coding, validations, making stuff visible/invisible etc. can be
done here.
AT SELECTION-SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR <variable> (i.e., parameter)
START-OF SELECTION
END-OF SELECTION
Module Pool:
PROCESS
PROCESS
PROCESS
PROCESS

BEFORE OUTPUT (PBO)


AFTER INPUT (PAI)
ON VALUE REQUEST (POV) F4
ON HELP (POH) F1

Range Tables
Contains 4 columns namely: Sign, Option, Low and High
Sign can be either E (Exclusive) or I (Inclusive). Option can be GT, LT, BT, EQ etc
BAPI chain execution is not possible (i.e., multiple BAPI execution in ONE
LUW isnt possible)
http://scn.sap.com/thread/2004950
Imagine you are having a scenario where u will create a PO -> Once PO gets
creating successfully then you create a GR (if GR fails then PO shouldnt be created
-> Once PO, GR gets successfully created then you create an IV (If IV fails then PO,
GR shouldnt be created). In order to achieve such a scenario:
BAPI_PO_CREATE1
IF.OK
BAPI_TRANSACTION_COMMIT * Always BAPI COMMIT AND WAIT is a good practice
BAPI_GOODSMVT_CREATE
IF OK
BAPI_TRANSACTION_COMMIT
BAPI_INCOMINGINVOICE_CREATE
IF OK
BAPI_TRANSACTION_COMMIT
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

ELSE.
* Cancel material document
BAPI_GOODSMVT_CANCEL
BAPI_TRANSACTION_COMMIT
* Cancel PO
BAPI_PO_CHANGE
BAPI_TRANSACTION_COMMIT
ENDIF.
ELSE,
* Cancel PO
BAPI_PO_CHANGE
BAPI_TRANSACTION_COMMIT
ENDIF.
ENDIF.

Difference between Update task and Background task?


http://scn.sap.com/thread/1476663

Update task No return, asynchronous call i.e., gets called when COMMIT WORK
statement gets encountered, debugging possible by switching on Update debugging
(debugger options), majorly used to update databases at the end.
We can call multiple function modules with suffix update task and they get executed
in sequence.
Why do we use this In Update Task ?
The main update technique for bundling database changes in a single database
LUW is to use CALL FUNCTION... IN UPDATE TASK.
How do we Use?
A typical R/3 installation contains dialog work processes and at least one update
work process. The update work processes are responsible for updating the
database. When an ABAP program reaches a COMMIT WORK statement, any
function modules from CALL FUNCTION... IN UPDATE TASK statements are released
for processing in an update work process. The dialog process does not wait for the
update to finish. This kind of update is called asynchronous update.
What is the Use?
Asynchronous update is useful when response time from the transaction is critical,
and the database updates themselves are so complex that they justify the extra
system load
Background task Can return parameters, synchronous call to FM, debugging can
be possible by switching on System debugging (debugging options), not specific to
updating DB tables.
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

FMs can be CALLED synchronously or asynchronously ONLY. There is no option


of background work process. It will work only with dialog work process.
For background work process, we NECESSARILY have to use a SEPARATE Z
PROGRAM, and inside that call the FM.
We can BACKGROUND a Z Program, not the FM.
http://scn.sap.com/thread/1079684
Debug Background Job: http://scn.sap.com/thread/122992
SM51, SM58
Difference between COMMIT WORK and ROLLBACK WORK?
COMMIT WORK - The function modules registered for the current SAP LUW are
started at the COMMIT WORK statement in the sequence, in which they were
registered.
ROLLBACK WORK - The statement ROLLBACK WORK deletes all previous
registrations of the current SAP LUW.
Implicit Enhancements
We can achieve this by clicking on the spiral button. Implicit enhancements are
mainly used to overwrite default SAP standard code which is provided by SAP and
but customized code based on our requirements. Implicit enhancements can be
done on FMs, reports, includes, methods, attributes etc.
Sales and Distribution (SD module)
SD module completely runs on the basis of company code (BUKRS). Now, what is
this company code ?
For example: Let us consider Roche Pharma, now this company manufactures drugs
and tablets and in order to manufacture them they need raw materials. Raw
materials should be purchased (procured) from various other companies and these
companies will be maintained by means of company code in our SAP system.
Next thing which we need to understand is Ship to party and Shipping party, now
ship to party is to whom we are trying to sell our products to (i.e., distributors and
they will further sell it to retailers) and shipping party is the one who ships the
goods to ship to party. SAP software stands in the intermediate level between
shipping party and ship to party of any organization.
We can get to know Shipping party, Ship to Party and Sold to party via company
codes. Also note that ship to party can be either customer or distributor but sold to
party is always customer i.e., retailers.

Prepared By Nirmal Jain- Certified ABAP Developer


9620161251

For Example: Let us consider Roche Pharma once again, as a major pharma player
roche has offices and manufacturing units across world like Roche Austria, Roche
UK, Roche India, Roche USA etc. Again each one of them will have their own
associated company codes. If an order for tablets comes from a distributor in India
then the distributor will create what is called a purchase order (PO) and the
company processes these orders via., background jobs or manually during some
point in a day. Doing so these POs will become sales order (SO) for Roche India,
which contains details like quantity, shipping date etc. And a quick inventory check
happens here and based on availability goods will be dispatched. In such a scenario
the shipping party is Roche India Sold to party is Distributor (XYZ).
Another good example for understanding purposes would be Flipkart or Amazon. If
they use SAP as a business platform then WS retail will be shipping party and
Naresh will be sold to party in sales order VA01. SAP will be intermediate between
the two.
Lets take a look at some basic definitions:
In my example of enhancing VL01N transaction code requirement was like changing
delivery date to +5 days (display day too using FM: DATE_TO_DAY) than the system
generated date and also to incorporate subsequent document number in this new
tab called details. Delivery mapped to sales order (VBFA)
Inbound delivery: It does not necessarily mean goods receipt. INBOUND DELIVERY
in SAP pertains to all incoming goods, which may refer to either a vendor delivery or
a return of a rejected delivery to a customer. It may cover the schedules of
deliveries from your vendors/suppliers or even a rejected delivery to a customer.
Outbound delivery: You use this process in order to support all shipping activities
like picking, packing, transport and goods issue. All information regarding shipping
planning is stored in outbound delivery, the status of shipping activities is
monitored, and data gathered during the course of shipping processing is recorded.
By creating outbound delivery, shipping activities are started and data is transferred
that is generated during shipping processing.
Order: This refers to Sales order in SAP. A sales order is an electronic document
that captures and records your customers request for goods or services. The sales
order contains all pertinent information to process the customers request
throughout the whole process cycle. This is an external document.
Production Order: Suppose we are producing some product in house. So when the
production department requires the raw material for production they will raise a
production order for the same. This is an internal document.

Prepared By Nirmal Jain- Certified ABAP Developer


9620161251

Sold to party: Who places an order to supply the materials treats him as sold to
party. Order can be given by only one person. Can't be given by many persons. So
always sold to party will be only one.
Ship to party: Who receives the materials. Goods can be supplied to many
parties.

Take this example:- Your GF asks you for a iPhone and she places the order
online,
you receive the invoice
since she is working, the iPhone is delivered to her mother at home
Once you receive the invoice you ask your brother to pay the bill in bank
so for one transaction there are multiple person involved
you, your GF, her mother and your brother
these are called as Business Partners in SAP
GF - Sold to Party as she orders
Her mother - Ship to Party as she receives the goods
You - Bill to Party as you receive the bill
Your brother - Payer as he pays the bill
Basic SD scenario:
Inquiry --> Quotation --> Sales Order --> Delivery --> Billing
VA11 --> VA21 --> VA01 --> VL01n --> VF01
Order --> Delivery --> Billing is called as OTC (Order to Cash) or O2C cycle
Take this Example:
In SD it should be the other side of the table.... Let me say that I need an iPhone
So I contact you through mail "Mr. Naresh, do you have iPhone, with this much
quantity"
you record this mail and it becomes your "INQUIRY"
you respond to me back saying that "I have 100 iPhones available and I charge 50k
per piece"
this document is "QUOTATION"
I send you an email "OK.... Bring it on"... this is my PO
You refer your Quotation for price and my PO for number of days and create "SALES
ORDER"
Once you create SALES ORDER, your assistant delivers the pieces, so he creates a
delivery document "This piece, these many days, delivered from this center". This is
"DELIVERY"
Once he sends the pieces to me, he has "ISSUED" the goods
I receive the pieces and you send me "INVOICE" for the pieces / service provided
a.k.a., "BILLING"
I transfer money to you for your services. This is "ACCOUNT RECEIVABLE" for you
but this will be taken care by your accountant, so receiving money doesnt come in
SD
DB Tables: VBAK VBAP (VA01), LIKP LIPS (VL01), VBRK, VBRP (VF01)
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

Basic MM scenario:
Purchase Requisition -->Purchase Order --> Goods Receipt --> Invoice
ME51N --> ME21N --> MIGO --> MIRO
Purchase Requisition: Document generated by a user department or storeroompersonnel to notify the purchasing department of items it needs to order,
their quantity, and the timeframe.
Purchase Order: A purchase order is a formal request to a vendor to supply you
with goods or services with the conditions stated in the purchase order. This is an
external document.
Goods Receipt: A goods receipt is the physical inbound movement of goods or
materials into the warehouse. It is a goods movement that is used to post goods
received from external vendors or from in-plant production. All goods receipts result
in an increase of stock in the warehouse.
Invoice: Invoice is like a bill once all the goods are delivered to your location.
DB Tables: EBAN (ME51N), EKKO EKPO (ME21N)
One more thing about transport requests
If two developers (NRN, MEHRM) have made changes to the same report then their
individual tasks will be logged under one transport requests (IKT90002369).
One case to note down will be
F4 help popup and Uploading Excel sheet or Flat file
This can be achieved in two ways namely by class methods or by FMs
Upload: Can be done via FM: GUI_UPLOAD, or FM: TEXT_CONVERT_XLS_TO_SAP or by
using class method cl_gui_frontend_services=>gui_upload. (File type: ASC) data will
be stored in internal table and manually you should parse it w.r.t. comma ,
operator. If it doesnt work then change type from .xls to .xsv.
F4 help popup: Can be done via FM: F4_FILENAME or by using class method
cl_gui_frontend_services=>file_open_dialog.

How to display progress bar data in a report?

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'


EXPORTING
percentage = iv_percentage
text
= iv_text.

Top-Of-Page in ALVs?
Firstly ALVs can be called into a report by four ways:
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

REUSE_ALV_LIST_DISPLAY ALV List, Display only, does not use ActiveX


controls
REUSE_ALV_GRID_DISPLAY ALV Grid, Editable, Uses ActiveX controls
CL_GUI_ALV_GRID ALV Grid, we can create more than one ALVs as we create
a screen
CL_SALV_TABLE ALV List, Cannot be editable
To display Top-Of-Page in report using CL_SALV_TABLE, the following are the below
steps:
Create an object of type cl_salv_table (lo_table)
Call the factory method by passing the table which you want to display and
get the instance of lo_table
Use the events class cl_salv_events_table to method lo_table->get_event( ) to
get the events
Then you will set handler for top_of_page for this created event object
Create header object of type cl_salv_form_layout_grid
Using this you can create header information, label, text etc using row
column attributes and in case if you want to add picture u can do that too
(cl_salv_form_picture)
Also implement handler top_of_page with content (cl_salv_form_element),
header (cl_salv_form_layout_grid) and flow (cl_salv_form_layout_flow)
Using r_top_of_page event parameter (cl_salv_form) set the content using
set_content of the ALV (lo_content = lo_header).
Using the main table object (lo_table) you call method set_top_of_list and pass this
header reference into it
To use a Hot-Spot in a SALV
Create an object of type cl_salv_table (lo_table)
Call the method lo_table->get_cloumns () and save the reference in
cl_salv_columns_table
Create one more object of type cl_salv_columns_table and get the column for
which you want to create a hotspot from first reference of
cl_salv_columns_table
Set hotpot by calling the method set_cell_type
Then set handler method
Function Module: You declare it in the FM and write the Form End Form for the
same.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM
= GD_REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE' "see FORM
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT
= FIELDCATALOG[]
I_SAVE
= 'X'
IS_VARIANT
= G_VARIANT
TABLES
T_OUTTAB
= IT_SFLIGHT
EXCEPTIONS
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

PROGRAM_ERROR
= 1
OTHERS
= 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FORM TOP-OF-PAGE.
*ALV Header declarations
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER,
T_LINE LIKE WA_HEADER-INFO,
LD_LINES TYPE I,
LD_LINESC(10) TYPE C.
* Title
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'SFLIGHT Table Report'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
* Date
WA_HEADER-TYP = 'S'.
WA_HEADER-KEY = 'Date: '.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO WA_HEADER-INFO.
APPEND WA_HEADER TO T_HEADER.
CLEAR: WA_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM.

"todays date

ABAP Technical Properties for field (F1 help)

When you use watch points for debugging then use VBKD-BSTKD which is the
program field and not DB field BSTKD i.e., watch points cannot be created for field
data.
What is BDC? (Batch Data Communication)

Prepared By Nirmal Jain- Certified ABAP Developer


9620161251

When SAP is implemented, we need data to be migrated from non-SAP system


i.e., legacy system to SAP system. One way of doing this is via BDC. There are two
methods through which we can implement BDC:
1. Session Method

2.

Synchronous processing
Can transfer large amount of data
Processing is slower
Error log is created
Data is not updated until session is processed
Transaction Method

Asynchronous processing
Can transfer small amount of data
Processing is faster
Errors need to be handled explicitly
Data is updated automatically

In Session Method following function Modules are used.


BDC_OPEN_GROUP
BDC_INSERT
BDC_CLOSE_GROUP
In BDC we use structure BDCDATA for Batch Input, Which has following components.
PROGRAM
DYNPRO
DYNBEGIN
FNAM
FVAL

BDC module pool


BDC Screen number
BDC screen start
Field name
BDC field value

BDC modes to be used while doing a call transaction method is:


A Foreground mode
N Background mode
To call BDC using call transaction method:
DATA it_messtab TYPE STANDARD TABLE OF bdcmsgcoll WITH HEADER LINE.
CALL TRANSACTION 'CS01' USING it_bdcdata MODE N UPDATE 'S' MESSAGES INTO

it_messtab.
Dynamic Adobe Form creation

Prepared By Nirmal Jain- Certified ABAP Developer


9620161251

Use the following FMs i.e., FP_FUNCTION_MODULE_NAME, FP_JOB_OPEN, CALL


FUNCTION <dynamically generated>, FP_JOB_CLOSE.
NAST_PROTOCOL_UPDATE
This FM is generally used in the Print programs that are attached to an output type
in a transaction. This is used in order to update the processing log . provide
message ID, number, type (I,E,W,S) and text.
CHAIN END CHAIN
In PAI if you want to validate group of fields then you put in chain and End chain
statement. You can declare fields in the chain enchain.
CHAIN.
FIELD NUM1.
FIELD NUM2.
MODULE USER_COMMAND_0100.
ENDCHAIN.
MODULE USER_COMMAND_0100 INPUT.
CLEAR okcode.
okcode = sy-ucomm.
CASE okcode.
WHEN 'ENTER' OR 'EXECUTE'.
IF NUM1 IS INITIAL OR NUM2 IS INITIAL .
MESSAGE e398(00) WITH 'PLEASE FILL THE FIELDS'. " Enter VALUES'
ELSE.
.....
ENDIF.
ENDIF.
ENDMODULE.
When an error is found inside a chain, the screen is re-displayed and all the fields
found anywhere in the CHAIN are input enabled. All non chain fields remain
disabled.
Create a global class from a local class
SE24 -> Object Type -> Import -> Local classes in a program
Control Break Statements
AT FIRST END AT: Will get triggered at the first run of the loop
AT NEW END AT: Will get triggered whenever there is any change in any of the
fields from the left to that of the particular field. The trigger point will be at the
first occurrence of the new value for the field.

Prepared By Nirmal Jain- Certified ABAP Developer


9620161251

AT END OF END AT: Will get triggered whenever there is any change in any of the
fields from the left to that of the particular field. The trigger point will be at the
last occurrence of the same value for the field.
ON CHANGE OF: Will get triggered whenever there is any change in the particular
field. This statement can be used outside loop to.
AT LAST END AT: Will get triggered at the last run of the loop
http://www.newtosap.info/2012/07/control-break-statements-in-sap-abap.html
Authorization Object

Go to T code: SU21
Select a class from the list of classes and right click -> create authorization
object
Provide the Field name and create a role in T code: PFCG.
In program use syntax,
AUTHORITY-CHECK OBJECT 'ZV57REPACC'
ID 'ACTVT' FIELD '01'.

Check Table and Value Table

The basic difference between value table and check table is check table can be
used as a input help for a field on which check table is assigned. Value table
contents are never used for input help.
A value table will become a check table only when a foreign key relationship is
established. Check table resides at the DB level and value table resides at the
Domain level.
Steps to implement a SAP NOTE

Go to T code SNOTE
Go to -> SAP Note Download and enter the note number and execute you will
get .pdf file with correction instructions and manual steps to be implemented.
Make sure that you do the correction instructions before implementing the
note
Go to -> SAP Note Browser, enter note number and execute. Check the status
if it says Can be implemented then proceed by clicking on execute again
Lastly after the note gets implemented do the manual changes
Note: You will require SAP Access key to make CI as well as manual changes.
SAP Script
We mainly use three function modules here namely:
OPEN_FORM
WRITE_FORM
CLOSE_FORM
Reference program: http://scn.sap.com/thread/747566
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

Subroutine Structures used in SAP Script


ITCSY contains two fields namely name and value.
Table Maintenance Generator
Mainly used to create / change DB entries using the SM30 transaction code.

Standard recording routine creates customizing TR for entries created in SM30


transaction. These can be moved from development test production. Auth group
by default will be &NC& (without auth).
No, or user, recording routine - does not create any TR for entries created in SM30
transaction. So what is the advantage of this is that the entries are maintained only
in this system + client (I57 010 only and no other clients) and hence cannot be
transported to other systems.
TMG Events can be accessed via menu, Environment -> Modifications -> Events
Now click on F4 which displays all the available events such as:

Before saving data in the DB

After saving data in the DB


Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

Before deleting the data displayed

After deleting the data displayed

Creating new entries

Single step: Only overview screen is created i.e. the Table Maintenance Program
will have only one screen where you can add, delete or edit records.
Two step: Two screens namely the overview screen and Single screen are created.
The user can see the key fields in the first screen and can further go on to edit
further details.
Disable table entries (SE11)
We can disable table entries by making Table View Maintenance as N i.e.,
maintenance not allowed.
X is display maintenance allowed, N is maintenance not allowed and SPACE is
allowed with restrictions.
So when you go to Utilities -> Table Contents -> Create entries will be disabled.
What is the difference between a Parameter and a Select Option? If you
remove the Sign, Option & High from a Select Option will it become a
Parameter?
No it will not become a parameter because Select Options are of type internal table.
Radio button by default will be TICKED (only in reports)
Locks
http://www.erpgreat.com/abap/type-and-uses-of-lock-objects-in-sap.htm
Adobe binding of screen elements
Adobe binding is done by activating the data view (in case if not activated then do it
by Palette -> Data view) this data view will contain the structure of all the interface
elements which are present in context.
Now the last thing left is to start binding these elements into the corresponding UI
elements on the screen. Drag and drop

Prepared By Nirmal Jain- Certified ABAP Developer


9620161251

Interactive Online Adobe Call


Important T Codes: SOA Manager, WSCONFIG, SICF
On click of Submit button, the following java script has to be called for the form to
get triggered.
var sap_usr = "&sap-user=c5190270&sap-password=initial_1";
var ServerPath = "ciec3.wdf.sap.corp:50080";
var client = "800";
var Soap_PreServerPort = "http://";
var Soap_PostServerPort = "/sap/bc/soap/rfc?sap-client=";
var SoapAddress = Soap_PreServerPort + ServerPath + Soap_PostServerPort +
client + sap_usr;
var Wsdl_PreServerPort = "http://";
var Wsdl_PostServerPort1 = "/sap/bc/soap/wsdl11?
services=ZN_VENDOR_CREATE&amp;sap-client=";
var wsdlAddress = Wsdl_PreServerPort + ServerPath + Wsdl_PostServerPort1 +
client + sap_usr ;
var conn = xfa.connectionSet.DataConnection.clone(true);
conn.soapAddress.value = SoapAddress;
conn.wsdlAddress.value = wsdlAddress;
try{
conn.execute(0);
}
catch(e)
{
app.alert(e);
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

So RFC connection protocol link to SAP system would actually look like this:
http://ciec3.wdf.sap.corp:50080/sap/bc/soap/rfc?sap-client=800&sapuser=c5190270&sap-password=initial_1

Connection link to FM via WSDL would look like this:

http://ciec3.wdf.sap.corp:50080/sap/bc/soap/wsdl11?
services=ZN_VENDOR_CREATE&amp;sap-client=800&sap-user=c5190270&sappassword=initial_1

The FM that gets executed once the form gets called should always be remote
enabled FM.
Now you should establish data source connection -> new connection -> connect via
WSDL (this contains the FM name along with import/export parameters) -> Displays
all the imports and exports parameter. Now start binding those parameters to the
form parameters either by dragging and dropping or by choosing data connection
and binding them.
We have to create a web service for ZN_VENDOR_CREATE in order to get the WSDL
link (Utilities -> Create web service -> From the FM) choose SOAP profile, and check
release service for runtime.
In case if it is not released then go to T code: WSCONFIG to release it.
Go to T code: SOAMANAGER search for your FM name, go to configuration tab, enter
the details there and bottom below you can get WSDL URL.
Good Example: http://scn.sap.com/docs/DOC-38805
WDSL Creation and Test:
http://saptechnical.com/Tutorials/Others/ABAPWebservices/create.htm
To display based on radio button check in reports
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
PARAMETERS: p1 RADIOBUTTON GROUP r1 USER-COMMAND flag,
p2 RADIOBUTTON GROUP r1 .
SELECTION-SCREEN END OF BLOCK a1.
SELECTION-SCREEN BEGIN OF BLOCK a2 WITH FRAME TITLE text-002.
PARAMETERS: emp TYPE char10 MODIF ID m1,
desig TYPE char30 MODIF ID m1.
SELECTION-SCREEN END OF BLOCK a2.
AT SELECTION-SCREEN OUTPUT.
IF p2 EQ 'X'.
LOOP AT SCREEN.
if screen-group1 = 'M1'.
screen-active = 0.
MODIFY SCREEN.
endif.
MODIFY SCREEN.
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

ENDLOOP.
ENDIF.

The most important thing to note down here is the keyword USER-COMMAND, if you
miss this then the functionality does not work.

WORKFLOWS
What is a Workflow?
A workflow is a step by step process which includes multiple stakeholders and
assigns work to them, typically a piece of work passes from initiation to completion.
What is the use of T-Code SWU_OBUF?
This transaction is mainly used to clear the buffers when you develop a lot of
workflows and activate. It can be run as a background job on a daily basis.
T Codes:
SWDD Standard T Code for Workflow creation
SWELS To turn on the event trace
SWEL To see if the event was created for that particular scenario
SWE2 Linkage between the event and the workflow
PFTC Maintaining tasks and agent assignment
SBWP Workflow Inbox (Work Items)
SWU3 SAP WF customization settings
SWO6 Delegate custom business object (created using subtype) to standard one
(i.e., table entry)
SWUE Used to trigger the workflow manually
SWIA / SWI1 Process the work item
SOST To check the status of a work item
SWEC Document change object (i.e., table entry)
SCOT Email configuration
Process to be followed while creating a Z Object:
Go to T code SWO1

Enter the standard object type BUS2032

Click on subtype button and enter the required fields (ZBUS2032)

Go ahead and create the required events, parameters, methods etc.

Save and activate the ZBUS2032

Go to T code SWO6 in order to delegate your custom Z object to standard


object
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

Go to T code SWEC enter the change document object

Once you delegate your custom BO with the standard BO, you can call your custom
methods / events in your workflow using standard BO (BUS2032 for PO) or custom
BO (ZBUS2032) too.
Awesome Example for Wait activity in a WF
http://www.an-sap-consultant.com/2014/05/SAP-Business-Workflow-Wait-StepType.html
In fork step give number of parallel branches as 2, in one branch create user
decision and in another create wait. WAIT step is just like start events (CAP button)
provide with the business object name, event name. The fork will execute two or
more steps at the same time without any hassle but if any one WF step gets
completed then the other remaining step will logically be cancelled.
To raise an event use FM: SWE_EVENT_CREATE (pass BO, object key, event, and
event container table) contains element and value. To instantiate a BO FM:
SWO_CREATE and to call a method FM: SWO_INVOKE. To start a WF FM:
SAP_WAPI_START_WORKFLOW
Please make sure that Terminate if rule resolution has no result checkbox has
been checked

WEBDYNPRO
Dynamic ALVs
Add the component SALV_WD_TABLE to your view

Create components table (cl_abap_structdescr) for all the columns which you
want to display

Create a structure for this components table. (components table contain


name and type)

Create a dynamic root node (if_wd_context_node_info ~add_new_child_node),


give the node name and structure that you just created for this method

Bind the table containing data against this newly created root node (use the
below interface)

Create a component (if_wd_component_usage), create a model for ALV


(cl_salv_wd_config_table)

Now last part is to display it to the view using if_wd_view_controller.


Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

In case if you want to manipulate the column data (Ex: by making fields read only,
invisible etc.) then get the model first by using class cl_salv_wd_config_table and
use class cl_salv_wd_column for further manipulations. Main interfaces
If_wd_context_node, if_wd_context_element
Send Mail FM: SO_DOCUMENT_SEND_API1
Select Options
Custom Controllers snapshot

How to capture URLs for a given component?


CALL METHOD cl_wd_utilities=>construct_wd_url
EXPORTING
application_name
IMPORTING
out_absolute_url

= '<component_name>
= w_url.

Maintain texts by using T Code SOTR_EDIT for webdynpro


Pass values via outbound plug?

Prepared By Nirmal Jain- Certified ABAP Developer


9620161251

When you fire this plug from first view (MAIN) via., method action then the fire
method is as shown below:

l_ref_main_window->fire_ob_window_plg(
p_city
=
stru_node_emp1-city
p_name
=
stru_node_emp1-name
p_state
=
stru_node_emp1-state
).

The corresponding event handler method (HANDLEFROM_MAIN) in second view


(TABLE_DISPLAY) will be given as shown below:
data: lv_name type string.
wdevent->get_data(
exporting
name = 'P_NAME'
importing
value = lv_name
).
Note: The event handler method HANDLEFROM_MAIN will get created
automatically.
http://scn.sap.com/docs/DOC-27936
What are the different types of layout available in webdynpro?
Prepared By Nirmal Jain- Certified ABAP Developer
9620161251

There are 4 types of layout namely:


Flow Layout

Grid Layout

Matrix Layout

Row Layout

Important Interface: IF_WD_COMPONENT


SOTR_EDIT Tutorial
Step 1: Go to your webdynpro application, Goto -> Online text repository
Step 2: Enter the text for which you want to translate (text field)

Step 3: Click on F4 help and click on the create button there.


Step 4: Enter the alias name which is of format: package/name

Prepared By Nirmal Jain- Certified ABAP Developer


9620161251

Step 5: Click on tick button (if in case it doesnt show up then close and click on F4
at text field level)
Step 6: Go to T code: sotr_edit and enter the language in which you created your
text along with alias mentioned above i.e., $TMP/ZNC_OTR_NAME and click on
Display.
Step 7: Click on edit -> context -> change, click on cancel when the pop up
appears.
Step 8: Now select language as German from drop down and enter your German
text.
Step 9: The texts are maintained in the same alias name change the URL and
check, it works.
Select Options
Use component WDR_SELECT_OPTIONS
Make sure that you create an attribute of type IF_WD_SELECT_OPTIONS
Create an active component by using interface if_wd_component_usage
Using this newly created attribute call method wd_this-> <attr_name> ->
set_global_options( ) which contains some additional functionality like cancel, check
etc.
Now create a range table wd_this-> <attr_name> ->create_range_table (KUNNR)
and add the selection field i.e., wd_this-> <attr_name> -> add_selection_field.
Create a view container UI element to add this select options and make sure to
embed in window

Prepared By Nirmal Jain- Certified ABAP Developer


9620161251

Now in order to pull data off of it we will have to create a field symbol of type ANY
TABLE> and an internal table of type ANY
Lt_range_table = wd_this-> <attr_name> -> get_range_table_of_sel_field (id =
KUNNR)
This lt_range_table will contain the data but itll be locked and hence has to be dereferenced
So, Assign lt_range_table ->* TO <Field_Symbol>.
This field symbol will contain the range table.
Just like Constructors even Supply functions get triggered when we try to access the
Node
Mug it up:
Utilities -> TMGs, Table Contents, function module as service
Goto -> OVS,
To display based on radio button check in reports
Create a UI element radio button group index in the layout screen

Create a Node with one attribute with cardinality (0..n), this table will contain
the text names of the radio button

Bind this node to the UI element radio button group index

Now on selection of radio button a text should get displayed. This can be
achieved by creating an action for the radio button group index

Put this text in a transparent container and bind the visibility property with a
separate attribute created separately.

In order to read the index of the radio button use this

DATA lv_index TYPE sy-tabix.


lv_index = lo_nd_radiergummi->get_lead_selection_index( ).

How do you check which view you are on via the WD application? i.e.,
given a scenario where the FE has given a snapshot of a view; how can
you find the component name, view name etc. from it?
Simple right click and choose More field help

Prepared By Nirmal Jain- Certified ABAP Developer


9620161251

Code wizard snapshot

http://saptechnical.com/Tutorials/WebDynproABAP/PassingValues/Page1.htm

Prepared By Nirmal Jain- Certified ABAP Developer


9620161251

Você também pode gostar