Real Time Classes SP RAO

You are on page 1of 65

Performance issues / coding standards: -

When ever we read the single record from the internal table based on the condition, then we must use
binary search because binary search is faster than linear search.
Note: - Before applying the binary search we must sort the internal table based on the condition field.
Syntax: -
Read table <internal table> into <work area> with key <condition> binary search.
Ex: -
Sort it_ekko by ebeln.
Loop at it_ekpo into wa_ekpo.
----
----
Read table it_ekko into wa_ekko with key ebeln = wa_ekpo-ebeln binary search.
--- -
---
Endloop.
Avoid the dead code: -
After completion of the program we perform the extended program check to avoid the unnecessary
declarations of the program.

Steps to identify the unnecessary declarations: -


Open the program in SE38. In the menu bar click on program  check  extend program. Check.
Execute. Identify the warnings & errors. Double click on it. Absorb the unnecessary declarations from the
code.
We must maintain the order of the fields in the work area as well as order of the fields in the select query
must be the similar order of the fields in the table.

Select butxt ort01 bukrs from t001 into table it_t001.


( in this case we aren’t follow the order of the fields in the table. So it takes extra time to execute).

Select bukrs butxt ort01 from t001 into table it_t001.

Steps to identify the order of the field in the table: -


Execute SE11. Open the table (KNA1). Click on contents. In the menu bar click on settings  format list 
choose fields. Click on deselect all. Select the required fields check box by using find function key. Enter.
Provide the minimum number of hits (2). Execute. Identify the order of the fields.
Instead of Inner join we always use for all entries when we fetch the data from more than two tables. Inner
join picks the data, based on the ‘ON’ condition first, next it based on where condition. For all entries pick
the data based on where condition first, next it based on ‘ON’ condition.
Note: - At the time of implementing the SAP the data bases contains fewer amounts of data then the
performance of inner join & for all entries is same. Day by day the size of the data base table is increased.
The performance of the inner join is decreased & for all entries performance is same.

When ever we are working with for all entries, then we must consider following things.
1. Check the higher-level internal table having the data or not.
2. Sort the higher level internal table
3. Delete adjacent duplicates from higher level internal table, if it’s required.
4. consider all the possible conditions in the where condition of the next level select query

सतीष Kumar రెడ్ి డ Page No: 1


1. If you aren’t higher level internal table having the data or not. If higher level internal table having no data
then it’ll fetch entire data of data base for the next level.

Select ebeln bedat lifnr from ekko into table it_ekko where ebeln in s_ebeln.
It_ekko where ebeln in s_eblen.
If not it_ekko is initial.
Select ebeln ebelp - - - from ekpo into table it_ekpo for all entries
In it_ekko where ebeln – it_ekko-ebeln.
Endif.

In the For all entries when ever we fetch the master data based on the transactional data. When ever we
fetch the header data based on the item data then we must apply delete adjacent duplicate in the higher level
internal table.

Note: - Before using delete adjacent duplicates we must sort the internal table based on comparing fields.
Select EBELN BEDAT LIFNR from EKKO into table it_ekko where Ebeln in s_ebeln.
It_ekko1 = it_ekko.
Sort it_ekko1 by lifnr.
Delete adjacent duplicates from it_ekko1 comparing lifnr.
If it_ekko1 is not initial.
Select lifnr name1 ort01 from lfa1 into table it_ekko1 where lifnr = it_ekko1-lifnr.

EX: -
Select vbeln posnr matnr kwmeng meins netwr from vbap into table it_vbap where vbeln in s_vbeln.
It_vbap1 = it_vbap.
Sort it_vbap1 by matnr.
Delete adjacent duplicates from it_vbap1 comparing matnr.
If it_vbap1 is not initial.
Select matnr maktx from makt into table it_makt where matnr = it_vbap1-matnr and spras = sy-langu.
Endif.
Consider all the possible conditions in the next level select query: -

If not it_bkpf is initial.


Select BUKRS BELNR GJAHR - - - - from BSEG into table it_BSEG
For all entries in it_bkpf where bukrs = wa_bseg-bukrs and
Belnr = wa_bseg-belnr and gjahr = wa_bseg-gjahr.

6. We always use select single if you know entire primary key combination of data base table.
Select single bukrs kunnr akont from knb1 into table it_knb1 where bukrs = ____ and kunnr = _______ .

सतीष Kumar రెడ్ి డ Page No: 2


We always use select up to 1 rows. If you know part of the primary key combination of data base table.
Select bukrs kunnr akont from knb1 into table it_knb1 up to 1 rows where bukrs = ____ .
Endselect.

Note: - Select single is faster than select up to 1 rows. Because select singe hits the data base once & up to
1 rows hits twice.

7. We never use ranges, instead of ranges we use select-options with no display.

Tables t001.
Select-options s_bukrs for t001-bukrs.

Tables t001.
Select-options s_bukrs for t001-bukrs no display.

8. We always use list display instead of grid display. Because list display is faster than grid display.

9. We never write select *. Instead of this we use select fields (field 1, field 2, - - field n).

Select * from ekko into table it_ekko where Ebeln in s_eblen.

Select Ebeln bedat lifnr - - - from ekko into table it_ekko where Ebeln in s_eblen.
10. We never write a select query with out where condition.

Select bukrs butxt ort01 from t001 into table it_t001.

11. We never write a select query into corresponding fields.

Select butxt ort01 bukrs from t001 into corresponding fields of table it_t001 where bukrs in s_bukrs.

Select bukrs butxt ort01 from t001 into table it_t001 where bukrs in s_bukrs.
12. We never write a select query with in a select query. (we never write nested selected query).

Select bukrs butxt from t001 into wa_t01 where bukrs in s_bukrs.

Select bukrs kunnr from knb1 into wa_knb1 where bukrs = wa_t001-bukrs.
Endselect.

Endselect.

Output:-
1000 TCS 241
1000 TCS 291
2000 IBM 116

13. We never write a select query with I a loop.


Loop at it_vbap into wa_vbap.
Wa_final-vbeln = wa_vbap-vbeln.
Wa_final-matnr = wa_vbap-matnr.

सतीष Kumar రెడ్ి డ Page No: 3


Select single matnr maktx from makt into wa_makt where matnr = wa_vbap-matnr and spras = sy-langu.
Wa-final-maktx = wa_makt-maktx.
Append wa_final to it_final.
Endloop.

14. Instead of nested loops we use parallel cursor technique / model


In the real time some times we must use loop inside a loop to fill the final internal table. If the internal
table data is increased then the performance of the system is decreased or it takes more time to execute the
program. To avoid this or to over come this we use parallel cursor method.
Sort it_ekpo by Ebeln
Loop at it_ekko into wa_ekko with key Ebeln = wa_ekko-ebeln.
If sy-subrc = 0.
V_no = sy-tabix.
Loop at it_ekpo into wa_ekpo from v_no.
If wa_ekko-ebeln <> wa_ekpo-ebeln.
Exit.
Else
----
----
Endif.
Endloop.
Endif.
Endloop.

15. We always use assignment (=) operator instead of move corresponding.

Move-corresponding wa to wa1.

Wa1-bukrs = wa-bukrs.
Wa1-ort01 = wa-ort01.

Note: - We never use the sort inside the loop.


Loop at it_ekko into wa_ekko.
---
Sort it_lfa1 by lifnr.
Read table it_lfa1 into wa_lfa1 with key lifnr = wa_ekko-lifnr binary search.
---
Endloop.
16. We always use the events. We always avoid the (LDBs).

सतीष Kumar రెడ్ి డ Page No: 4


We always avoid the fetching the data from LDB s (Logical Database). LDB is the collection of data base
tables. LDB s are used in HR ABAP not in ABAP. LDB s are created through SE36.
17. We always use ‘WHILE’ instead of ‘DO’ because ‘WHILE’ is faster as well as clearer than ‘DO’.
18. We always use case instead of nested if. Because case is faster than ‘IF’.
19. Before writing the select query its better to use ‘SAPGUI_PROGRESS_INDICATOR’ function module
to know the execution process.
EX: -
Data it_bseg like table of it_bseg.
Call function ‘SAPGUI_PROGRESS_INDICATOR’
Exporting
Percentage = ‘100’.
Text = ‘Fetching data from BSEG tale’.
Select * from BSEG into table it_bseg.
Call function ‘SAPGUI_PROGRESS_INDICATOR’
Exporting
Percentage = ‘100’
Text = ‘Display the output’.
Call function ‘REUSE_ALV_GRID_DISPLAY’
Exporting
I_structure_name = ‘BSEG’
Tables
T_outtab = IT_BSEG.
Types of project:-
1. Implementation project
2. Up gradation project
3. Maintenance / Support project
4. Roll out project
Implementation project: - When ever we want to develop the SAP from fundamental on wards then
we go for implementation project.

Phases of Implementation Project:-


1. Project preparation phase
2. Business Blue Print phase
3. Realization phase
4. Final preparation phase
5. Go-live & support phase
Project preparation phase: -
During this phase the following activities are happened or performed.
 The offshore as well as onsite companies identified their project team members.

सतीष Kumar రెడ్ి డ Page No: 5


 Provide the necessary training to the employees.
 Design or prepare the project pipeline path to reach the destination.

 Kickoff (Project actual start date)

Business Blue Print phase: -


During this phase the functional people interact with process leads & collect the requirements &
prepares the business blueprints & later offshore & onsite people sign off in the business blue
prints.
Realization phase: -
During this phase functional people prepares the FD documents based on the business blue prints.
These FS documents are send to technical team leader via E-mail or client website. After the
technical team leader, receivers the FS (Functional Specification) documents. They convert the FS
documents to detailed technical specifications (TS). These TS documents are assigned to AAP
consultant. Based on the TS documents the ABAPer develop the object in the development screen
& prepares the unit test plan (UTP) & transport the objects to quality server.
All the Business Blue Prints are convert into FS. All the FS are converted into TS. All the TS are
developed as objects. All the objects are moved into development server / quality server.
Final Preparation phase: -
During this phase the functional people test the each & every object in the quality server & prepare
the test scripts (they prepare a document to execute the program) & provide the trainings to the end
users.

Go live & support phase: -


Go-live means all the objects are moved from quality to live server. After Go-live the company
provides the support in day to today activities of client until a period.
Up gradation project: -
When ever the version is changed if you want to implement the new technologies into our
existing systems then we go for up gradation project. These are two types of up gradations.
1. Technical Up gradation
2. Functional Up gradation
In the technical up gradation more ABAPer s & BASIS people are involved & very few functional
people are involved. It can take 30 days to 3 months time. In the technical up gradation first the
basis people install the new SAP version later they copy the objects from existing production
system to new development system.

सतीष Kumar రెడ్ి డ Page No: 6


Phases on up gradation project:-
1. SPDD Phase
2. SPAU Phase
3. DBACOCKPIT
4. UCCHECK
5. Replace the function module

Note: - The ABAPer perform the above phases in the development of new server.
SPDD phase: -
During this phase, it compares the dictionary objects (tables, domains, etc) from old version to new version.
After executing SPDD transaction some of the objects are displayed in green colour some of the objects are
displayed in pink colour. Open the each & every pink colour object & activate the either old one or new one
with the help of functional people.

SPAU phase: -
During this phase we compare the work bench objects (function module, programs) from old version to new
version. After executing SPAU transaction some of the objects are displayed in green colour some of the
objects are displayed in pink colour. Open the each & every pink colour object activate the either old one or
new one.

DBACOCKPIT: -
During this phase we identify the all the data base tables which secondary index is in active. After executing
the DBACOCKPIT transaction if displays the data base tables which secondary index is inactive.
Open the each & every table in ‘SE11’. Click on indexes in the application tool bar. Activate the
secondary index.

UCCHECK phase: -
In the old, each & ever character is identified by 32 bit. Now a day it identifies through 64 bit. After executing
the UCCHECK transaction it displays the all the programs which unique code is inactive. Then open the each
& every program in SE38 in change mode. In the menu bar click on go to  attributes. Select the check box
unique code. Check activated.

Replace the function modules: -


When ever the version is changed, some times some function modules are absolute (don’t use). Instead of this
function module we use new function module (Remove the old function module code & replace the new
function module).
Steps to identify the programs which contains absolute function module: -
Execute SE37. Provide the function module (upload). Click on where used list (Ctrl + Shift + F3) in the
application tool bar. Select the check box only programs. Enter. Select the program which contains the
function module code. Remove this code & replace the new code in all the programs.

Maintaince / Support project: -


After Go-live & support phase in the implementation project each & every company requires 24/7 support.
Then they go for support project. In the support project each & every company uses ticketing tools (remedy
tools). If any issues are occurs or raised in the onsite then the process leads login into ticketing tools and raise
the ticket & send offsite company.
After receiving the ticket the offshore front office person forward that ticket to their respective functional
people based on the ticketing category. After receiving the ticket the functional people discuss with core team
members / process leads and prepares the FS document & sends the FS document to technical team leader.

सतीष Kumar రెడ్ి డ Page No: 7


After receiving the FS document then technical team leader converts the FS to detail technical spect and
provide the estimated time based on the complexity of the object & assign the TS document to ABAP
consultant.
After receiving the TS document the ABAP consultant develop the object in development server and
prepare the UTP (Unit Test Plant) & send to quality server. In quality server the functional people test the
object & prepare the UAT (Unit Acceptance Test) & transport the object to live server.
In the live server the process leads test the object if it’s ok and close the ticket.
The entire ticketing tool against the ticketing number the progress details are updated by function people.

Roll out project: -


When ever we want to implement the new model in existing SAP system or when ever we purchase a new
company if we want to extend the same SAP to that company then we go for roll out project. Roll out projects
are also called on type of implementation of project.

Note: - In the real time at the time of implementation project we use ASAP methodology.

SAP notes: -
When ever the company implements the new technologies (Support packs, SAP patches) in the existing
system some times damages any where in the SAP. If you want to overcome those damages we identify the
right note & implement.

EX: -
In my company at the time of implementing the HR support packs it damages the all other layout lines here
we identify the SAP note based on the documentation which provided by SAP. We download the SAP note
from service through SAP.Com website with the help of basis people. Later we implement the note in the
development note through ‘SNOTE’ transaction. (We manually also apply the note & create the request
number & transported the request number from development server to quality & live server).
SAP NOTE contains which programs are changed & which lines are comment and which new lines or
code added in the program.
At the time of implementing the note manually then we need to open the program in change mode then it will
ask access key take this screen shot and send a mail to BASIS people then the BASIS people provide the
access key.

Real time system landscape: -

सतीष Kumar రెడ్ి డ Page No: 8


In the development server the ABAPer having create, change, display access of ABAP transaction codes
(SE11, SE12, SE16, SE38, SE93, SE91, SE80, SE41, SE51, SE09, SE10, - -) & only display access of
transactional t.codes (XK03, XD03, MM03, ME23N, - -). When ever we develop any conversion programs,
enhancements if we need create access of any transactional t.codes then we put a mail to security people (Part
of BASIS) then the security people take conversion from technical team leader & provide access.
In the real time after we receive the logon details of development server we login in the development client
then navigated to change password. Then change the password. After change the pass word we create a test
program in ABAP editor then it’ll ask developer key at the first time. Then take a screen short & sends to
BASIS people. Then the BASIS people develop the developer key. Based on this develop key we logon into
the system & implement the program. From next time onwards it won’t ask any developer key. When ever we
execute any ABAP related t.code if you get the error message i.e. you aren’t authorized for the transaction
t.code (xyz). Then we execute ‘/OSU53’ transaction. Take a print screen & put a mail to BASIS people then
they provide access based on the screen sort.

Sand box server: -


Sand box contains configuration settings as well as master & transactional data. We can develop any object in
the Sand box for testing purpose.

Golden server / golden client: -


Golden server is the sensitive client only. It contains configuration steps. It won’t contain any master &
transactional data. Golden server is directly connected to quality server. Only functional people have the
access in golden server.

Based on the technical spect (TS), the ABAP consultants develop the object n de4velopment server based on
the coding standards & naming standards & save in our own package & create a new request number. In the
real time packages are already created by BASIS people based on the object category or module.
After completion of object the ABAP consultant prepares the Unit Test Plant (UTP).

If the ABAP consultant gets the expected output & actual output is same then they informed to BASIS people
to transport the request number of the object from development server to quality / test server.
The BASIS people release the request & transfer the request from development server to quality server &
inform to ABAP consultant. (In some companies ABAPer release the request through SE09 / SE10 & BASIS
people transport the request from development server to quality server through ‘STMS’ transaction).
After receive a mail the ABAP consultant forward the mail to functional people & technical team leader to
test the object in quality server. After receive a mail the functional people test the object in the quality server
along with process leads & prepares the user acceptance test (UAT).

सतीष Kumar రెడ్ి డ Page No: 9


If the functional people get the expected output & actual output is same then they informed to BASIS people
to transport the same request from quality to live server. Otherwise they informed to ABAP consultant to
provide the changes in the code.
In the live server the end users use the object if any changes are needed they informed to functional &
technical people. If any changes are coming then we do the changes in development server create a new
request & transported to quality & live server.
Note: - The object is copied from development server to quality server & copied from quality to live server
(the object is available in all servers).
Note: - We can create any umber of request numbers to the object.
After completion of the object in the development server we perform the following activities.
1. Extended program check (SLIN)
2. SQL trace (ST05)
3. Runtime analysis (SE30)
Extended program check: -
This is used to identify the unnecessary declarations of the program. The transaction code for extended
program check is ‘SLIN’.

SQL trace: -
This is used to identify the execution time of a particular select query. The transaction code for SQL trace is
(ST05).

Steps to perform the SQL trace: -


Open the program in ‘SE38’. Place the cursor on select query which select query execution time we want.
Click on stop button in the application tool bar. Execute the program. Provide the input, execute. Now the
cursor is stops at select query. Execute the ST05 transaction in separate session. Click on activate trace. Now
go to debuggers screen. Click on F5 button. (Select query execution completed). Now go to SQL trace screen.
Click on deactivate the trace in right side. Click on display trace. Enter. Identify the total execution time of the
select query in micro seconds.

Runtime analysis: -
This is used to identify the total execution time of the function module. The transaction code for runtime
analysis is SE30.

Steps to work with runtime analysis: -


Execute SE30. Select the radio button program. Provide the program name & provide the variant if it’s
available. Click on execute. Provide the input. Execute. Click on back to SE30 screen. Click on evaluate in the
bottom. Then we identify the total execution time in micro seconds.

Note: - Runtime analysis also contains trip & tricks to identify which statements we use which we dot use.

Note: - After completion of the program we click on pretty printer in the application toolbar to align the
code.

Note: - In the real time the maximum program execution time in the four ground is 600 seconds or 10
minutes. If the program exceeds 10 minutes the it goes to dump. If you want to know the total execution time
of these types of programs then we run the program in background & identify the total execution time ‘SM37’
transaction.

सतीष Kumar రెడ్ి డ Page No: 10


Note: - ‘ST22’ is the transaction code to identify the all dumps.

Note: - There is no time limit for the background scheduling jobs.


When ever we execute the program in background then we get the output in a spool request (SP01)
transaction.
Steps to execute the program in background: -
Execute ‘SE38’. Provide the program name. Execute. Provide the input. In the menu bar click on program 
execute in background. Click on continue. If you want to run the program in a particular date & time then
click on date & time button, & provide the date & time. Save. If you want execute the program immediate
then click on immediate button. Save it. If you want run the program period wise (daily, monthly, weekly,
yearly) then click on period values in the bottom. Select the required filed. Click on save.

Steps to identify the status of the program which is running background: -


Execute ‘SM37’. Execute. Identify the status & also identify the total execution time.
When ever we execute any program in background then it’s called as a job. There are different
types of job status.
1. Schedule
2. Released
3. Ready
4. Active
5. Finished
If the job status is finished then only we get the output in spoon. If the job status is active, then the program is
currently executed.

Note: - ‘SM36’ is the transaction code to schedule the program in background


Steps to schedule the program in background by using SM36: -
Execute ‘SM36’. Provide the job name (SPRAO). Select the job class is ‘C’ (low priority). Click on ‘STEP’ in
the application tool bar. Provide the program name (ZSP_ALV6). Click on save. Click on back. Click on start
condition in the application tool bar. Click on immediate or provide the date / time. Click on save. Save. If
you want to check the status of job & execution time then we go to ‘SM37’.
Steps to check / open the output: -
Execute SP01. Execute. Click on type & identify the output.
‘SE16’  Data browser
‘SE12’  Display ABAP dictionary
‘SE38’  execute the program

Note: - ‘SYST’ is the structure which contains all the system variables.
‘TSTC’ is the data base table which contains all the transaction codes & program names.
‘DD02L’ is standard data base table which contains the all standard data base tables.
‘DD03L’ is the standard data base table which contains all SAP table fields.

सतीष Kumar రెడ్ి డ Page No: 11


Purchase Requision (PR): -
The warehouse or inventory department creates the purchase Requision with the required materials & sends to
purchasing department.
Request for quotation (RFQ): -
The purchasing department shall ask the vendors to provide the quotation for the materials which are
requested by warehouse.
Quotation: -
The vendor sends the quotation to purchasing department.
Purchase order: -
After receiving the quotations from the vendor the purchasing department compare those quotations based on
the quality and pricing parameters & identify the best vendor & provide the purchase order to that vendor.
Delivery Challan: -
The vendor people supply the goods to warehouse with delivery Challan.
Goods Receipt (GR): -
Against the purchase order the warehouse people create the goods receipt with ‘MIGO’ transaction & 101
movement time.
Invoice receipt (IR): -
Against the goods receipt the plant finance people physically verify the stock & prepares the invoice receipt.
Payment document: -
Against the invoice receipt the account payable department the amount to the vendor.

सतीष Kumar రెడ్ి డ Page No: 12


सतीष Kumar రెడ్డి Page No: 13
Some of the standard code related to MM: -

1. Create purchase Requision  ME51N


2. Create Request of quotation  ME41N
3. Create Quotation -- --  ME47
4. Comparing the quotation --  ME49
5. Create purchaser order (PO)  ME21N
6. Create Automatic purchase order  ME59
7. Release the purchase order  ME28 / ME29
8. Release the purchase Requision  ME54N
9. Create the goods receipt --  MIGO
10. Create the invoice receipt --  MIR7 / MIRO
11. Create the payment doc --  F110
Steps to get the GR number based on PO number: -
Method1 – Pass the PO number & item number to the ‘MSEG’ table & get the MBLNR as GR number.
Method2 – Pass the PO number & item number to EKBE table & also pass BEWTP ‘E’ then we get the
BELNR as GR document number.
Steps to get the IR document number based on the PO number: -
Pass the PO number & item number to the ‘EKBE’ table & also pass BEWTP = ‘Q’ then we get BELNR as
IR document number.
Steps to get payment document number based on PO number: -
Pass the PO number & item number to the EKBE table & also pass ‘BEWTP’ = ‘Q’ then we get the BELNR
(IR document) & GJAHR (IR year).
Concatenate the IR document with year & pass this value to ‘AWKEY’ filed in the BKPF table then we
get the BELNR as payment document number.

PO number : 3000000008
GR number : 5000002445
IR document : 5105604171
Payment doc : 5100000026
Vendor : 3910

Payment cleared (BSAK)

सतीष Kumar రెడ్ి డ Page No: 14


Inquery: - Customer enquiry about the product & their services.
Quotation: - Against the customer query the sales people provide the quotation to the customer.
Sales order: - Against customer purchase order the sales people generate the saled order & given to customer.
Delivery: - Against the sales order the delivery people pick the goods from warehouse & packing with
handling unit (Boxes, Bags, drums) & ship to customer ship to party address.
Billing: - Against the delivery document the billing people generate the bill or invoice & sends to customer
sold to party address.
Payment document: - Against the billing document the account receivable department collects the money
from the customer.

सतीष Kumar రెడ్ి డ Page No: 15


सतीष Kumar రెడ్డి Page No: 16
Note: - VBFA (sales flow table)

Sample document in IDES


SO number : 5323
Delivery no : 80003721
Billing doc / Invoice : 0090005594
Accounting doc : 0100007824
Customer : 2004
Company : 1000

सतीष Kumar రెడ్ి డ Page No: 17


The PPC
department
creates the
requirement
plan in a
particular period
based on the
requirement
plan. They
create the plant
order. Then the
plant order
(system) check
the requirement
plant &
warehouse stock
& generate some of the process orders & some of the purchase Requision. Purchase Requision later converted
into purchase orders and goods receipts.
The production department or PPC department generate the process order with the required materials &
sends to warehouse department. When ever the process order is created then automatically one reservation
number is generated & reserved the stock. Against the process order the warehouse people issue the goods to
the production with MIGO transaction with 261 movement (and also issue the goods against cost center with
MIGO transaction & 201 movement to calculate the cost).
After receiving the materials the production people prepares the finished product based on the recipe
(procedure) & sends to warehouse department. The warehouse department creates the goods receipt against
process order with MIGO & 101 movement type.
When ever the warehouse people create the GR against process order then automatically one inspection lot
number is generated.
Based on the inspection lot number the quality control people came to warehouse & take some samples &
conduct the tests based on QA people instruction & prepares the sampling check list & sends to ware house.
Based on the check list the ware house people maintained the finished products either in accepted area or
rejected area.

Some of the Transaction codes in PPC

1. Create process order  C0R1


2. Crete BOM (Bill of Material)  CS01
3. Create Batch  MSC1N
4. Create Recipe  C201
5. Create goods issue against process order  MIGO / 261
6. Create goods issue against cost center  MIGO / 201
7. Create goods receipt  MIGO / 101
सतीष Kumar రెడ్ి డ Page No: 18
सतीष Kumar రెడ్డి Page No: 19
1. Create the vendor / employee  FK01
2. Advance payments to the vendor  F_48
3. Credit note to the party (vendor)  FS60
4. Debit not to the party (vendor)  FB65
5. Partial payments to the vendor  F-53
6. Insert calculation over the items  F-24
7. Automatic payment to the vendor  F110
8. Bill of exchange (comp  bank  vendor)  F-40
9. TDS (Tax Deduction at Source) ca  MIRO
Amount Receivable (AR)
1. Create the customer master  FD01 / XD01
2. Security / deposits  F-49
3. Advance payments from customer – F-29
4. Adjustment of advance payments from customer  F-39
5. Credit note the party (customer)  FB75
6. Debit note to the party (customer)  FB70
7. Payment from the customer  F-28
8. Bill of exchange (customer  Bank  company)  F-36, F-33

General ledger (GL)


1. Cash payments  F-02
2. Cash receipts  F-03
3. Bank payments  F-04
4. Bank receipt  F-05

K  Vendor
D  Customer
S  G/L
T  Open
A  Cleared

सतीष Kumar రెడ్ి డ Page No: 20


सतीष Kumar రెడ్డి Page No: 21
सतीष Kumar రెడ్ి డ Page No: 22
The following things are maintained in TS.
 Maintain the selection screen output fields, description & technical information
 Maintain the output fields or displayed fields, short descriptions & technical names.
 Maintain the pseudo code of the object.
 Prepare the Ven diagrams if it’s needed.
 Provide the input screen shorts & output screen shorts after developed the object.
 Maintain all the parameters fields selection fields & mandatory fields.
Note: - If the selection screen contains at least one header field then we starts the select query of header
level.

Internal table contains input fields + link fields + output fields

सतीष Kumar రెడ్ి డ Page No: 23


REPORT ZPORJECT.

******************************************************
* PROGRAM : ZVR001-SPT_SALES_REGISTER *
* AUTHOR : SATISH *
* PURPOSE : TO DISPLAY SALES TAXEX & INSURENCES *
* START DATE : 28.02.2015 *
* FINISH DATE: 06.03.2015 *
* SUPPLIER : SPRAO TECHNOLOGIES *
* PACKAGE : *
* REQUEST NUM: SRYK900117 *
******************************************************

DATA w_cops TYPE I.

TYPES: BEGIN OF TY_FINAL,


VKORG TYPE VBRK-VKORG,
VTWEG TYPE VBRK-VTWEG,
VKGRP TYPE VBAK-VKGRP,
BEZEI TYPE TVGRT-BEZEI,
WERKS TYPE VBRP-WERKS,
NAME1 TYPE T001W-NAME1,

सतीष Kumar రెడ్ి డ Page No: 24


BZIRK TYPE VBRK-BZIRK,
BZTXT TYPE T171T-BZTXT,
SPC TYPE T005T-LANDX,
SHC TYPE T005T-LANDX,
KUNAG TYPE VBRK-KUNAG,
SPN TYPE KNA1-NAME1,
SHN TYPE KNA1-NAME1,
EMPST TYPE VBKD-EMPST,
BSTKD TYPE VBKD-BSTKD,
BSTDK TYPE VBKD-BSTDK,
AUBEL TYPE VBRP-AUBEL,
POSNR TYPE VBAP-POSNR,
AUDAT TYPE VBAK-AUDAT,
VBELN TYPE VBRK-VBELN,
FKDAT TYPE VBRK-FKDAT,
MATNR TYPE VBRP-MATNR,
MAKTX TYPE MAKT-MAKTX,
CHARG TYPE VBRP-CHARG,
FKIMG TYPE VBRP-FKIMG,
VRKME TYPE VBRP-VRKME,
WAERK TYPE VBRK-WAERK,
BP TYPE KONV-KBETR,
BED TYPE KONV-KBETR,
ECESS TYPE KONV-KBETR,
SHCESS TYPE KONV-KBETR,
VAT TYPE KONV-KBETR,
KZWI3 TYPE VBRP-KZWI3,
KZWI4 TYPE VBRP-KZWI4,
KZWI6 TYPE VBRP-KZWI6,
INCO1 TYPE VBKD-INCO1,
INCO2 TYPE VBKD-INCO2,
END OF TY_FINAL.
DATA: WA_FINAL TYPE TY_FINAL,
IT_FINAL TYPE TABLE OF TY_FINAL.

* DECLARE WA_VBRK AND IT_VBRK


TYPES : BEGIN OF TY_VBRK,
VBELN TYPE VBRK-VBELN,
FKART TYPE VBRK-FKART,
WAERK TYPE VBRK-WAERK,
VKORG TYPE VBRK-VKORG,
VTWEG TYPE VBRK-VTWEG,
KURRF TYPE VBRK-KURRF,
KNUMV TYPE VBRK-KNUMV,
FKDAT TYPE VBRK-FKDAT,
BZIRK TYPE VBRK-BZIRK,
LAND1 TYPE VBRK-LAND1,
KUNAG TYPE VBRK-KUNAG,
END OF TY_VBRK.
DATA: WA_VBRK TYPE TY_VBRK,

सतीष Kumar రెడ్ి డ Page No: 25


IT_VBRK TYPE TABLE OF TY_VBRK.

* DECLARE WA_T171T, IT_T171T


TYPES : BEGIN OF TY_T171T,
BZIRK TYPE T171T-BZIRK,
BZTXT TYPE T171T-BZTXT,
END OF TY_T171T.
DATA: WA_T171T TYPE TY_T171T,
IT_T171T TYPE TABLE OF TY_T171T.

* DECLARE WA_VBRP, IT_VBRP


TYPES : BEGIN OF TY_VBRP,
VBELN TYPE VBRP-VBELN,
POSNR TYPE VBRP-POSNR,
FKIMG TYPE VBRP-FKIMG,
VRKME TYPE VBRP-VRKME,
VGBEL TYPE VBRP-VGBEL,
AUBEL TYPE VBRP-AUBEL,
AUPOS TYPE VBRP-AUPOS,
MATNR TYPE VBRP-MATNR,
CHARG TYPE VBRP-CHARG,
WERKS TYPE VBRP-WERKS,
KZWI3 TYPE VBRP-KZWI3,
KZWI4 TYPE VBRP-KZWI4,
KZWI6 TYPE VBRP-KZWI6,
END OF TY_VBRP.
DATA: WA_VBRP TYPE TY_VBRP,
IT_VBRP TYPE TABLE OF TY_VBRP.

* DECLARE WA_KONV, IT_KONV


TYPES : BEGIN OF TY_KONV,
KNUMV TYPE KONV-KNUMV,
KPOSN TYPE KONV-KPOSN,
KSCHL TYPE KONV-KSCHL,
KAWRT TYPE KONV-KAWRT,
KBETR TYPE KONV-KBETR,
END OF TY_KONV.
DATA: WA_KONV TYPE TY_KONV,
IT_KONV TYPE TABLE OF TY_KONV.

* DECLARE THE WA_MAKT AND IT_MAKT


TYPES : BEGIN OF TY_MAKT,
MATNR TYPE MAKT-MATNR,
MAKTX TYPE MAKT-MAKTX,
END OF TY_MAKT.
DATA: WA_MAKT TYPE TY_MAKT,
IT_MAKT TYPE TABLE OF TY_MAKT.

TYPES : BEGIN OF TY_T001W,


WERKS TYPE T001W-WERKS,

सतीष Kumar రెడ్ి డ Page No: 26


NAME1 TYPE T001W-NAME1,
END OF TY_T001W.
DATA: WA_T001W TYPE TY_T001W,
IT_T001W TYPE TABLE OF TY_T001W.

TYPES : BEGIN OF TY_VBAP,


VBELN TYPE VBAP-VBELN,
POSNR TYPE VBAP-POSNR,
SPART TYPE VBAP-SPART,
END OF TY_VBAP.
DATA: WA_VBAP TYPE TY_VBAP,
IT_VBAP TYPE TABLE OF TY_VBAP.

TYPES : BEGIN OF TY_VBKD,


VBELN TYPE VBKD-VBELN,
POSNR TYPE VBKD-POSNR,
INCO1 TYPE VBKD-INCO1,
INCO2 TYPE VBKD-INCO2,
EMPST TYPE VBKD-EMPST,
BSTKD TYPE VBKD-BSTKD,
BSTDK TYPE VBKD-BSTDK,
END OF TY_VBKD.
DATA: WA_VBKD TYPE TY_VBKD,
IT_VBKD TYPE TABLE OF TY_VBKD.

TYPES : BEGIN OF TY_VBAK,


VBELN TYPE VBAK-VBELN,
AUDAT TYPE VBAK-AUDAT,
VKGRP TYPE VBAK-VKGRP,
END OF TY_VBAK.
DATA: WA_VBAK TYPE TY_VBAK,
IT_VBAK TYPE TABLE OF TY_VBAK.

TYPES : BEGIN OF TY_TVGRT,


VKGRP TYPE TVGRT-VKGRP,
BEZEI TYPE TVGRT-BEZEI,
END OF TY_TVGRT.
DATA: WA_TVGRT TYPE TY_TVGRT,
IT_TVGRT TYPE TABLE OF TY_TVGRT.

TYPES : BEGIN OF TY_VBPA,


VBELN TYPE VBPA-VBELN,
POSNR TYPE VBPA-POSNR,
PARVW TYPE VBPA-PARVW,
KUNNR TYPE VBPA-KUNNR,
END OF TY_VBPA.
DATA: WA_VBPA TYPE TY_VBPA,
IT_VBPA TYPE TABLE OF TY_VBPA.

TYPES : BEGIN OF TY_KNA1,

सतीष Kumar రెడ్ి డ Page No: 27


KUNNR TYPE KNA1-KUNNR,
LAND1 TYPE KNA1-LAND1,
NAME1 TYPE KNA1-NAME1,
END OF TY_KNA1.
DATA: WA_KNA1 TYPE TY_KNA1,
IT_KNA1 TYPE TABLE OF TY_KNA1.

TYPES : BEGIN OF TY_T005T,


LAND1 TYPE T005T-LAND1,
LANDX TYPE T005T-LANDX,
END OF TY_T005T.
DATA: WA_T005T TYPE TY_T005T,
IT_T005T TYPE TABLE OF TY_T005T.

DATA: IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,


WA_FCAT LIKE LINE OF IT_FCAT.

TABLES: VBRK, VBRP, VBAP, VBAK.


SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: SO_VKORG FOR VBRK-VKORG,
SO_VTWEG FOR VBRK-VTWEG,
SO_WERKS FOR VBRP-WERKS,
SO_WAERK FOR VBRK-WAERK,
SO_LAND1 FOR VBRK-LAND1,
SO_FKART FOR VBRK-FKART,
SO_KUNAG FOR VBRK-KUNAG,
SO_VBELN FOR VBRK-VBELN,
SO_FKDAT FOR VBRK-FKDAT,
SO_MATNR FOR VBRP-MATNR,
SO_CHARG FOR VBRP-CHARG,
SO_AUBEL FOR VBRP-AUBEL,
SO_VGBEL FOR VBRP-VGBEL,
SO_SPART FOR VBAP-SPART,
SO_AUDAT FOR VBAK-AUDAT.
SELECTION-SCREEN END OF BLOCK A.

**** ALL PERFORMS **********


PERFORM GET_DATA.
PERFORM POPULATE_FINAL_TABLE.
PERFORM FILL_FCAT.
PERFORM DISPLAY.
*****************************

******* FORM GET_DATA **********


FORM GET_DATA.
SELECT VBELN FKART WAERK VKORG VTWEG KURRF KNUMV FKDAT BZIRK LAND1
KUNAG FROM VBRK INTO TABLE IT_VBRK WHERE VKORG IN SO_VKORG

सतीष Kumar రెడ్ి డ Page No: 28


AND VTWEG IN SO_VTWEG AND WAERK IN SO_WAERK AND LAND1 IN SO_LAND1 AND
FKART IN SO_FKART AND KUNAG IN SO_KUNAG AND VBELN IN SO_VBELN
AND FKDAT IN SO_FKDAT.

IF IT_VBRK IS NOT INITIAL.


SELECT BZIRK BZTXT FROM T171T INTO TABLE IT_T171T FOR ALL ENTRIES IN
IT_VBRK WHERE BZIRK = IT_VBRK-BZIRK AND SPRAS = SY-LANGU.
SELECT KNUMV KPOSN KSCHL KAWRT KBETR FROM KONV INTO TABLE IT_KONV FOR
ALL ENTRIES IN IT_VBRK WHERE KNUMV = IT_VBRK-KNUMV.
SELECT VBELN POSNR FKIMG VRKME VGBEL AUBEL AUPOS MATNR CHARG WERKS
KZWI3 KZWI4 KZWI6 FROM VBRP INTO TABLE IT_VBRP FOR ALL
ENTRIES IN IT_VBRK WHERE VBELN = IT_VBRK-VBELN AND WERKS IN SO_WERKS
AND MATNR IN SO_MATNR AND CHARG IN SO_CHARG AND
AUBEL IN SO_AUBEL AND VGBEL IN SO_VGBEL.
ENDIF.

IF VBRP IS NOT INITIAL.


SELECT MATNR MAKTX FROM MAKT INTO TABLE IT_MAKT FOR ALL ENTRIES IN
IT_VBRP WHERE MATNR = IT_VBRP-MATNR AND SPRAS = SY-LANGU.
SELECT WERKS NAME1 FROM T001W INTO TABLE IT_T001W FOR ALL ENTRIES IN
IT_VBRP WHERE WERKS = IT_VBRP-WERKS.
SELECT VBELN POSNR SPART FROM VBAP INTO TABLE IT_VBAP FOR ALL ENTRIES
IN IT_VBRP WHERE VBELN = IT_VBRP-VBELN AND SPART IN SO_SPART.
ENDIF.

IF VBAP IS NOT INITIAL.


SELECT VBELN POSNR INCO1 INCO2 EMPST BSTKD BSTDK FROM VBKD INTO TABLE
IT_VBKD FOR ALL ENTRIES IN IT_VBAP WHERE
VBELN = IT_VBAP-VBELN AND POSNR = IT_VBAP-POSNR.
SELECT VBELN AUDAT VKGRP FROM VBAK INTO TABLE IT_VBAK FOR ALL ENTRIES
IN IT_VBAP WHERE VBELN = IT_VBAP-VBELN AND AUDAT IN SO_AUDAT.
SELECT VBELN POSNR PARVW KUNNR FROM VBPA INTO TABLE IT_VBPA FOR ALL
ENTRIES IN IT_VBAP WHERE VBELN = IT_VBAP-VBELN.
ENDIF.

IF IT_VBAK IS NOT INITIAL.


SELECT VKGRP BEZEI FROM TVGRT INTO TABLE IT_TVGRT FOR ALL ENTRIES IN
IT_VBAK WHERE VKGRP = IT_VBAK-VKGRP AND SPRAS = SY-LANGU.
ENDIF.

IF IT_VBPA IS NOT INITIAL.


SELECT KUNNR LAND1 NAME1 FROM KNA1 INTO TABLE IT_KNA1 FOR ALL ENTRIES
IN IT_VBPA WHERE KUNNR = IT_VBPA-KUNNR.
ENDIF.

IF IT_KNA1 IS NOT INITIAL.


SELECT LAND1 LANDX FROM T005T INTO TABLE IT_T005T FOR ALL ENTRIES IN
IT_KNA1 WHERE LAND1 = IT_KNA1-LAND1.
ENDIF.
ENDFORM.

सतीष Kumar రెడ్ి డ Page No: 29


****************************************

******** FORM POPULATE_FINAL_TABLE ************


FORM POPULATE_FINAL_TABLE.
LOOP AT IT_VBRP INTO WA_VBRP.
WA_FINAL-WERKS = WA_VBRP-WERKS.
WA_FINAL-AUBEL = WA_VBRP-AUBEL.
WA_FINAL-MATNR = WA_VBRP-MATNR.
WA_FINAL-CHARG = WA_VBRP-CHARG.
WA_FINAL-FKIMG = WA_VBRP-FKIMG.
WA_FINAL-VRKME = WA_VBRP-VRKME.
WA_FINAL-KZWI3 = WA_VBRP-KZWI3.
WA_FINAL-KZWI4 = WA_VBRP-KZWI4.
WA_FINAL-KZWI6 = WA_VBRP-KZWI6.

READ TABLE IT_MAKT INTO WA_MAKT WITH KEY MATNR = WA_VBRP-MATNR.


IF SY-SUBRC = 0.
WA_FINAL-MAKTX = WA_MAKT-MAKTX.
ENDIF.

READ TABLE IT_T001W INTO WA_T001W WITH KEY WERKS = WA_VBRP-WERKS.


IF SY-SUBRC = 0.
WA_FINAL-NAME1 = WA_T001W-NAME1.
ENDIF.

READ TABLE IT_VBAP INTO WA_VBAP WITH KEY VBELN = WA_VBRP-AUBEL POSNR
= WA_VBRP-AUPOS.
IF SY-SUBRC = 0.
WA_FINAL-POSNR = WA_VBAP-POSNR.

READ TABLE IT_VBKD INTO WA_VBKD WITH KEY VBELN = WA_VBAP-VBELN


POSNR = WA_VBAP-POSNR.
IF SY-SUBRC = 0.
WA_FINAL-EMPST = WA_VBKD-EMPST.
WA_FINAL-BSTKD = WA_VBKD-BSTKD.
WA_FINAL-BSTDK = WA_VBKD-BSTDK.
WA_FINAL-INCO1 = WA_VBKD-INCO1.
WA_FINAL-INCO2 = WA_VBKD-INCO2.
ENDIF.

READ TABLE IT_VBAK INTO WA_VBAK WITH KEY VBELN = WA_VBAP-VBELN.


IF SY-SUBRC = 0.
WA_FINAL-VKGRP = WA_VBAK-VKGRP.
WA_FINAL-AUDAT = WA_VBAK-AUDAT.

READ TABLE IT_TVGRT INTO WA_TVGRT WITH KEY VKGRP = WA_VBAK-VKGRP.


IF SY-SUBRC = 0.
WA_FINAL-BEZEI = WA_TVGRT-BEZEI.
ENDIF.
ENDIF.

सतीष Kumar రెడ్ి డ Page No: 30


READ TABLE IT_VBPA INTO WA_VBPA WITH KEY VBELN = WA_VBAP-VBELN
POSNR = WA_VBAP-POSNR PARVW = 'SP'.
IF SY-SUBRC = 0.

READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_VBPA-KUNNR.


IF SY-SUBRC = 0.
WA_FINAL-SPN = WA_KNA1-NAME1.

READ TABLE IT_T005T INTO WA_T005T WITH KEY LAND1 = WA_KNA1-


LAND1.
IF SY-SUBRC = 0.
WA_FINAL-SPC = WA_T005T-LANDX.
ENDIF.
ENDIF.
ENDIF.

READ TABLE IT_VBPA INTO WA_VBPA WITH KEY VBELN = WA_VBAP-VBELN


POSNR = WA_VBAP-POSNR PARVW = 'SH'.
IF SY-SUBRC = 0.

READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_VBPA-KUNNR.


IF SY-SUBRC = 0.
WA_FINAL-SHN = WA_KNA1-NAME1.

READ TABLE IT_T005T INTO WA_T005T WITH KEY LAND1 = WA_KNA1-


LAND1.
IF SY-SUBRC = 0.
WA_FINAL-SHC = WA_T005T-LANDX.
ENDIF.
ENDIF.
ENDIF.
ENDIF.

READ TABLE IT_VBRK INTO WA_VBRK WITH KEY VBELN = WA_VBRP-VBELN.


IF SY-SUBRC = 0.
WA_FINAL-VKORG = WA_VBRK-VKORG.
WA_FINAL-VTWEG = WA_VBRK-VTWEG.
WA_FINAL-BZIRK = WA_VBRK-BZIRK.
WA_FINAL-KUNAG = WA_VBRK-KUNAG.
WA_FINAL-VBELN = WA_VBRK-VBELN.
WA_FINAL-FKDAT = WA_VBRK-FKDAT.
WA_FINAL-WAERK = WA_VBRK-WAERK.

READ TABLE IT_T171T INTO WA_T171T WITH KEY BZIRK = WA_VBRK-BZIRK.


IF SY-SUBRC = 0.
WA_FINAL-BZTXT = WA_T171T-BZTXT.
ENDIF.

सतीष Kumar రెడ్ి డ Page No: 31


LOOP AT IT_KONV INTO WA_KONV WHERE KNUMV = WA_VBRK-KNUMV AND KPOSN
= WA_VBRP-POSNR.
IF WA_KONV-KSCHL = 'PR00'.
WA_FINAL-BP = WA_KONV-KAWRT / 10 * WA_KONV-KBETR * WA_VBRK-
KURRF.
ELSEIF WA_KONV-KSCHL = 'JEXP' OR WA_KONV-KSCHL = 'JEXQ'.
WA_FINAL-BED = WA_KONV-KBETR * WA_VBRK-KURRF.
ELSEIF WA_KONV-KSCHL = 'JCEP' OR WA_KONV-KSCHL = 'JCEQ'.
WA_FINAL-ECESS = WA_KONV-KBETR * WA_VBRK-KURRF.
ELSEIF WA_KONV-KSCHL = 'JCPE' OR WA_KONV-KSCHL = 'JCPQ'.
WA_FINAL-SHCESS = WA_KONV-KBETR * WA_VBRK-KURRF.
ELSEIF WA_KONV-KSCHL = 'JLST' OR WA_KONV-KSCHL = 'JCST'.
WA_FINAL-VAT = WA_KONV-KBETR * WA_VBRK-KURRF.
ENDIF.
ENDLOOP.
ENDIF.
APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.
ENDLOOP.
ENDFORM.
**********************************
****** FORM FILL_FCAT *******
FORM FILL_FCAT.
w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'VKORG'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Sales Organization'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'VTWEG'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Distribution Channel'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'VKGRP'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Sales Group'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'BEZEI'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Description'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

सतीष Kumar రెడ్ి డ Page No: 32


w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'WERKS'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Plant'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'NAME1'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Plant Desctiption'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'BZIRK'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Sales District'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'BZTXT'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'District name'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'SPC'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'SOLD TO COUNTRY'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'SHC'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'DEST.COUNTRY'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'KUNAG'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Sold to party'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

सतीष Kumar రెడ్ి డ Page No: 33


w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'SPN'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'SOLD TO PARTY NAME'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'SHN'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'SHIP TO PARTY NAME'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'EMPST'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Final Customer'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'BSTKD'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'PO Number'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'BSTDK'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'PO Date'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'AUBEL'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Sales Order'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'POSNR'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Item Number'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.

सतीष Kumar రెడ్ి డ Page No: 34


WA_FCAT-FIELDNAME = 'AUDAT'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'SO Date'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'VBELN'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Billing Document'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'FKDAT'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Billing date'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'MATNR'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Material Number'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'MAKTX'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Material Description'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'CHARG'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Batch'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'FKIMG'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Billed Quantity'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'VRKME'.

सतीष Kumar రెడ్ి డ Page No: 35


WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Sales Unit'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'WAERK'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Invoice Currency'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'BP'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'BASE PRICE IN INR'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'BED'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'BED IN INR'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'ECESS'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'ECESS IN INR'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'SHCESS'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'SHCESS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'VAT'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'VAT'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'KZWI3'.
WA_FCAT-COL_POS = w_cops.

सतीष Kumar రెడ్ి డ Page No: 36


WA_FCAT-SELTEXT_M = 'Insurance'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'KZWI4'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Freight'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'KZWI6'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'Commission Amount'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'INCO1'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'INCO1'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.

w_cops = w_cops + 1.
WA_FCAT-FIELDNAME = 'INCO2'.
WA_FCAT-COL_POS = w_cops.
WA_FCAT-SELTEXT_M = 'INCO2'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR wa_fcat.
ENDFORM.
***************************************
********** FORM DISPLAY *************
FORM DISPLAY.
DATA WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
WA_LAYOUT-ZEBRA = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'


EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FCAT
I_SAVE = 'X'
TABLES
T_OUTTAB = IT_FINAL.
ENDFORM.
*******************************************

सतीष Kumar రెడ్ి డ Page No: 37


Standard MM reports

1.MMBE (STOCK OVER VIEW): - This report is used to display the company wise plant wise, batch wise,
storage location wise.
There are 4 types of stocks
1. Un restricted stock
2. Quality inspection stock
3. Blocked stock
4. Reserved stock
2. MC50 (DEAD STOCK): -This report is used to display the dead stock details in a particular period.
3. ME5A (LIST OF PURCHASE REQUISION): - This report is used to display the purchase requisition
detailed information based on plant, material, user and date.
4. ME1P (PURCHASE ORDER PRICE HISTORY): - This report is used display the vendor wise material
price history & also used to evaluate the vendor ranking.
5. ME2L (PURCHASE ORDERS BY VENDOR):- This report is used to display the purchase order details
vendor wise in a particular period.

6. ME2M (PURCHASE ORDER BY MATERIAL): - This report is used to display the purchase order details
based on the material in particular period.

7. MB51 (MATERIAL DOC LIST): - This report is used to display te material document details (GR/GI)
based on the given date, movement type, plant, material, vendor. . .

8. MB52 (LIST OF WARE HOUSE STOCK): - This report is used to display the material stock & their cost
based on the given material plant, batch & storage location.

Standard FI Reports

1. FK10N (VENDOR BALANCE DISPLAY): - This report is used to display the vendor wise, period wise
debits & credits in a particular year.

2. FD10N (CUSTOMER BALANCE DISPLAY): - This report is used to display the customer wise, period
wise debits & credits in a particular year.

3. FS10 (GL BALANCE DISPLAY): - This report is used to display the GL account wise, period wise debits
& credits in a particular year.

4. FBL1N (VENDOR LINE ITEMS): - This report is used to display the vendor wise open items cleared
items as well as the item details in a particular period.

5. FBL3N (G/L ACCOUNT LINE ITEMS): - This report is used to display the GL account wise open items
cleared items as well as all the item details in a particular period.

6. FBL5N (CUSTOMER LINE ITEMS): -


FI

AP AR GL
FK10N FD10N FS10N
FBL1N FBL5N FBL3N

सतीष Kumar రెడ్ి డ Page No: 38


This report is used to display the customer wise open items, cleared items, as well as all the items in a
particular period.

SD Standard Reports: -

1. VA15(INQUIRIES LIST): - This report is used to display the open inquiries, all the inquiries in a particular
date.
2. VA25 (QUOTATION LIST)
3. VA05 (LIST OF SALES ORDER)
4. VL04 (PROCESS DELIVERY DUE LIST)
5. VL06 (DELIVERY MONITOR)
6. VF05 (LIST OF BILLING DOCUMENTS)

Note: - Open sales means sales is completed, delivery is pending. Open delivery means delivery is
completed, billing is pending. Open billing means billing is completed payment is pending.

Sno Field name / Technical SAP table Select-options/ Mandatory /


Description Field name Reference parameter Optional
1 Current Date BUDAT BSID-BUDAT P M
2 Company Code BUKRS BSID-BUKRS S
3 Customer KUNNR BSID-KUNNR S
4 G/L Account HKONT BSID-HKONT S

सतीष Kumar రెడ్ి డ Page No: 39


PPC Reports: -
CS11 (DISPLAY BOM LEVEL BY LEVEL): - This report is used to display the BOM components & their
quantities base on the given material.
COID (LIST OF PROCESS ORDERS): - This report is used display the process orders and plant orders
based on the given material and plant - - -

Project 2
Details TS
The report will have the following selection criteria: -

The report will have the following displayed fields

BSID
BUDAT
KUNNR Input fields
BUKRS
HKONT
+
KUNNR
BUKRS Link fields
HKONT
+
UMSKZ
DMBTR
BUKRS Output fields
KUNNR
HKONT
SHKZG

KNA1
KUNNR
NAME1
NAME2

KNB1
KUNNR
BUKRS
AKONT

SKAT
SAKNR
TXT50

Arrange the fields in order as in data base table


Create the selection criteria.

सतीष Kumar రెడ్ి డ Page No: 40


KUNN BU HKO NY AGE AGE AGE AGE AGE AGE AGE AGE AGE
R KRS NT D 30 60 90 120 180 365 2Y 3Y 3YA

REPORT ZPORGRAM2.
**********************************************************
* PROGRAM : ZVR001-SPT_ACCOUNT RECEIVABLE AGING REPORT*
* AUTHOR : SATISH *
* PURPOSE : ACCOUNT RECEIVABLE AGING REPORT *
* START DATE : 19.03.2015 *
* FINISH DATE: 22.03.2015 *
* SUPPLIER : SPRAO TECHNOLOGIES *
* PACKAGE : *
* REQUEST NUM: SRYK900117 *
**********************************************************

सतीष Kumar రెడ్ి డ Page No: 41


TYPE-POOLS SLIS.
DATA W_CPOS TYPE I.
DATA V_DAYS(10) TYPE C.
TYPES : BEGIN OF TY_BSID,
BUKRS TYPE BSID-BUKRS,
KUNNR TYPE BSID-KUNNR,
UMSKZ TYPE BSID-UMSKZ,
BELNR TYPE BSID-BELNR,
BUDAT TYPE BSID-BUDAT,
SHKZG TYPE BSID-SHKZG,
DMBTR TYPE BSID-DMBTR,
HKONT TYPE BSID-HKONT,
END OF TY_BSID.
DATA: WA_BSID TYPE TY_BSID,
IT_BSID TYPE TABLE OF TY_BSID.

TYPES : BEGIN OF TY_KNA1,


KUNNR TYPE KNA1-KUNNR,
NAME1 TYPE KNA1-NAME1,
NAME2 TYPE KNA1-NAME2,
END OF TY_KNA1.
DATA: WA_KNA1 TYPE TY_KNA1,
IT_KNA1 TYPE TABLE OF TY_KNA1.

TYPES : BEGIN OF TY_KNB1,


KUNNR TYPE KNB1-KUNNR,
BUKRS TYPE KNB1-BUKRS,
AKONT TYPE KNB1-AKONT,
END OF TY_KNB1.
DATA: WA_KNB1 TYPE TY_KNB1,
IT_KNB1 TYPE TABLE OF TY_KNB1.

TYPES : BEGIN OF TY_SKAT,


SAKNR TYPE SKAT-SAKNR,
TXT50 TYPE SKAT-TXT50,
END OF TY_SKAT.
DATA: WA_SKAT TYPE TY_SKAT,
IT_SKAT TYPE TABLE OF TY_SKAT,
WA_SKAT1 TYPE TY_SKAT,
IT_SKAT1 TYPE TABLE OF TY_SKAT.

* DELCATE IT_FINAL1, WA_FINAL1


DATA: BEGIN OF WA_FINAL1,
KUNNR TYPE KNA1-KUNNR,
NAME1 TYPE KNA1-NAME1,
NAME2 TYPE KNA1-NAME2,
BUKRS TYPE KNB1-BUKRS,
AKONT TYPE KNB1-AKONT,
RDES TYPE SKAT-TXT50,
HKONT TYPE BSID-HKONT,

सतीष Kumar రెడ్ి డ Page No: 42


TXT50 TYPE SKAT-TXT50,
UMSKZ TYPE BSID-UMSKZ,
NYD TYPE BSID-DMBTR,
AGE30 TYPE BSID-DMBTR,
AGE60 TYPE BSID-DMBTR,
AGE90 TYPE BSID-DMBTR,
AGE120 TYPE BSID-DMBTR,
AGE180 TYPE BSID-DMBTR,
AGE365 TYPE BSID-DMBTR,
AGE2Y TYPE BSID-DMBTR,
AGE3Y TYPE BSID-DMBTR,
AGE3YA TYPE BSID-DMBTR,
TOTAL TYPE BSID-DMBTR,
END OF WA_FINAL1.
DATA IT_FINAL1 LIKE TABLE OF WA_FINAL1.
********************************************

* SELECTION-SCREEN
TABLES BSID.
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME.
PARAMETER PR_BUDAT TYPE BSID-BUDAT.
SELECT-OPTIONS: SO_BUKRS FOR BSID-BUKRS,
SO_KUNNR FOR BSID-KUNNR,
SO_HKONT FOR BSID-HKONT.
SELECTION-SCREEN END OF BLOCK A.

* Declare the field catalog.


DATA: IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT LIKE LINE OF IT_FCAT.

DATA WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

* LOGIC
SELECT BUKRS KUNNR UMSKZ BELNR BUDAT SHKZG DMBTR HKONT FROM BSID INTO
TABLE IT_BSID WHERE BUKRS IN SO_BUKRS AND KUNNR IN SO_KUNNR
AND HKONT IN SO_HKONT AND BUDAT <= PR_BUDAT.

IF IT_BSID IS NOT INITIAL.


SELECT KUNNR NAME1 NAME2 FROM KNA1 INTO TABLE IT_KNA1 FOR ALL ENTRIES
IN IT_BSID WHERE KUNNR = IT_BSID-KUNNR.
SELECT KUNNR BUKRS AKONT FROM KNB1 INTO TABLE IT_KNB1 FOR ALL ENTRIES
IN IT_BSID WHERE KUNNR = IT_BSID-KUNNR AND BUKRS = IT_BSID-BUKRS.
SELECT SAKNR TXT50 FROM SKAT INTO TABLE IT_SKAT FOR ALL ENTRIES IN
IT_BSID WHERE SAKNR = IT_BSID-HKONT AND SPRAS = SY-LANGU.
ENDIF.

IF IT_KNB1 IS NOT INITIAL.


SELECT SAKNR TXT50 FROM SKAT INTO TABLE IT_SKAT1 FOR ALL ENTRIES IN
IT_KNB1 WHERE SAKNR = IT_KNB1-AKONT AND SPRAS = SY-LANGU.
ENDIF.

सतीष Kumar రెడ్ి డ Page No: 43


* End logic

DATA: BEGIN OF WA_FINAL,


BUKRS TYPE BSID-BUKRS,
KUNNR TYPE BSID-KUNNR,
HKONT TYPE BSID-HKONT,
NYD TYPE BSID-DMBTR,
AGE30 TYPE BSID-DMBTR,
AGE60 TYPE BSID-DMBTR,
AGE90 TYPE BSID-DMBTR,
AGE120 TYPE BSID-DMBTR,
AGE180 TYPE BSID-DMBTR,
AGE365 TYPE BSID-DMBTR,
AGE2Y TYPE BSID-DMBTR,
AGE3Y TYPE BSID-DMBTR,
AGE3YA TYPE BSID-DMBTR,
END OF WA_FINAL.
DATA IT_FINAL LIKE HASHED TABLE OF WA_FINAL WITH UNIQUE KEY BUKRS KUNNR
HKONT.

LOOP AT IT_BSID INTO WA_BSID.


WA_FINAL-BUKRS = WA_BSID-BUKRS.
WA_FINAL-KUNNR = WA_BSID-KUNNR.
WA_FINAL-HKONT = WA_BSID-HKONT.
IF BSID-SHKZG = 'H'.
WA_BSID-DMBTR = 0 - WA_BSID-DMBTR.
ENDIF.
V_DAYS = PR_BUDAT - WA_BSID-BUDAT.
IF V_DAYS = 0.
WA_FINAL-NYD = WA_BSID-DMBTR.
ELSEIF V_DAYS > 0 AND V_DAYS <= 30.
WA_FINAL-AGE30 = WA_BSID-DMBTR.
ELSEIF V_DAYS > 30 AND V_DAYS <= 60.
WA_FINAL-AGE60 = WA_BSID-DMBTR.
ELSEIF V_DAYS > 60 AND V_DAYS <= 90.
WA_FINAL-AGE90 = WA_BSID-DMBTR.
ELSEIF V_DAYS > 90 AND V_DAYS <= 120.
WA_FINAL-AGE120 = WA_BSID-DMBTR.
ELSEIF V_DAYS > 120 AND V_DAYS <= 180.
WA_FINAL-AGE180 = WA_BSID-DMBTR.
ELSEIF V_DAYS > 180 AND V_DAYS <= 365.
WA_FINAL-AGE365 = WA_BSID-DMBTR.
ELSEIF V_DAYS > 365 AND V_DAYS <= 730.
WA_FINAL-AGE2Y = WA_BSID-DMBTR.
ELSEIF V_DAYS > 730 AND V_DAYS <= 1095.
WA_FINAL-AGE3Y = WA_BSID-DMBTR.
ELSE.
WA_FINAL-AGE3YA = WA_BSID-DMBTR.
ENDIF.
COLLECT WA_FINAL INTO IT_FINAL.

सतीष Kumar రెడ్ి డ Page No: 44


CLEAR WA_FINAL.
ENDLOOP.

*FILLING IT_FINAL1
LOOP AT IT_FINAL INTO WA_FINAL.
MOVE-CORRESPONDING WA_FINAL TO WA_FINAL1.
READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_FINAL-KUNNR.
IF SY-SUBRC = 0.
WA_FINAL1-NAME1 = WA_KNA1-NAME1.
WA_FINAL1-NAME2 = WA_KNA1-NAME2.
ENDIF.
READ TABLE IT_KNB1 INTO WA_KNB1 WITH KEY KUNNR = WA_FINAL-KUNNR BUKRS
= WA_FINAL-BUKRS.
IF SY-SUBRC = 0.
WA_FINAL1-AKONT = WA_KNB1-AKONT.
READ TABLE IT_SKAT1 INTO WA_SKAT1 WITH KEY WA_KNB1-AKONT.
IF SY-SUBRC = 0.
WA_FINAL1-RDES = WA_SKAT1-TXT50.
ENDIF.
ENDIF.
READ TABLE IT_SKAT INTO WA_SKAT WITH KEY SAKNR = WA_FINAL-HKONT.
IF SY-SUBRC = 0.
WA_FINAL1-TXT50 = WA_SKAT-TXT50.
ENDIF.
READ TABLE IT_BSID INTO WA_BSID WITH KEY KUNNR = WA_FINAL-KUNNR BUKRS
= WA_FINAL-BUKRS HKONT = WA_FINAL-HKONT.
IF SY-SUBRC = 0.
WA_FINAL1-UMSKZ = WA_BSID-UMSKZ.
ENDIF.
WA_FINAL1-TOTAL = WA_FINAL-NYD + WA_FINAL-AGE30 + WA_FINAL-AGE60 +
WA_FINAL-AGE90 + WA_FINAL-AGE120 + WA_FINAL-AGE180 + WA_FINAL-AGE365
+ WA_FINAL-AGE2Y + WA_FINAL-AGE3Y + WA_FINAL-AGE3YA.
APPEND WA_FINAL1 TO IT_FINAL1.
CLEAR WA_FINAL1.
ENDLOOP.

**************************************
*PERFORM STATEMENTS.
PERFORM FCAT.
PERFORM DISPLAY.

**********************

*Fillng the field catalog


FORM FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'KUNNR'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'CUSTOMER'.
APPEND WA_FCAT TO IT_FCAT.

सतीष Kumar రెడ్ి డ Page No: 45


CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'NAME1'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'NAME1'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'NAME2'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'NAME2'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'BUKRS'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'COMPANY'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'AKONT'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'RECON'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'RDES'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'RECON DESCRIPTION'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'HKONT'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'G/L ACCOUNT'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'TXT50'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'G/L LONG DES'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

सतीष Kumar రెడ్ి డ Page No: 46


W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'UMSKZ'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'SPECIAL G/L IND'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'NYD'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'NOT YET DUE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'AGE30'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '0-30 DAYS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'AGE60'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '30-60 DAYS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'AGE90'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '60-90 DAYS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'AGE120'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '90-120 DAYS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'AGE180'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '120-180 DAYS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

सतीष Kumar రెడ్ి డ Page No: 47


W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'AGE365'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '180 DAYS-1 YEAR'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'AGE2Y'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '1-2 YEARS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'AGE3Y'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '2-3 YEARS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'AGE3YA'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '3 YEARS ABOVE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'TOTAL'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'TOTAL'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
ENDFORM.
* DISPALY THE FIELD CATALOG.
FORM DISPLAY.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FCAT
I_SAVE = 'X'
TABLES
T_OUTTAB = IT_FINAL1.
ENDFORM.

सतीष Kumar రెడ్ి డ Page No: 48


 Develop a ALV Report to display the account payable aging based on document date

Output fields
LIFNR, NAME1, NAME2, STREET1, STREET2, STREET3, BUKRS, AKONT, RECON
DESCRIPTION, G/L ACC, G/L ACC DES, NOT YET DUE, 0-30 DAYS, 30-60 DAYS, 60-90 DAYS,
90-120 DAYS, 120-180 DAYS, 180-365 DAYS, >1Y <2Y, >2Y, TOTAL

TYPE-POOLS SLIS.
DATA W_CPOS TYPE I.
DATA V_DAYS TYPE I.
TABLES BSIK.
* SELECTION-SCREEN
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME.
PARAMETER: PR_BUKRS TYPE BSIK-BUKRS,
PR_BUDAT TYPE BSIK-BUDAT DEFAULT SY-DATUM.
SELECT-OPTIONS: SO_LIFNR FOR BSIK-LIFNR,
SO_HKONT FOR BSIK-HKONT.
SELECTION-SCREEN END OF BLOCK A.

TYPES: BEGIN OF TY_BSIK,


BUKRS TYPE BSIK-BUKRS,
LIFNR TYPE BSIK-LIFNR,
BELNR TYPE BSIK-BELNR,
BUDAT TYPE BSIK-BUDAT,
BLDAT TYPE BSIK-BLDAT,
SHKZG TYPE BSIK-SHKZG,
DMBTR TYPE BSIK-DMBTR,
HKONT TYPE BSIK-HKONT,
END OF TY_BSIK.
DATA: WA_BSIK TYPE TY_BSIK,
IT_BSIK TYPE TABLE OF TY_BSIK.

TYPES : BEGIN OF TY_LFB1,


LIFNR TYPE LFB1-LIFNR,
BUKRS TYPE LFB1-BUKRS,
AKONT TYPE LFB1-AKONT,
END OF TY_LFB1.
DATA: WA_LFB1 TYPE TY_LFB1,
IT_LFB1 TYPE TABLE OF TY_LFB1.

TYPES : BEGIN OF TY_SKAT,


SAKNR TYPE SKAT-SAKNR,
TXT50 TYPE SKAT-TXT50,
END OF TY_SKAT.
DATA: WA_SKAT TYPE TY_SKAT,
IT_SKAT TYPE TABLE OF TY_SKAT.

TYPES : BEGIN OF TY_SKAT1,


SAKNR TYPE SKAT-SAKNR,
TXT50 TYPE SKAT-TXT50,

सतीष Kumar రెడ్ి డ Page No: 49


END OF TY_SKAT1.
DATA: WA_SKAT1 TYPE TY_SKAT1,
IT_SKAT1 TYPE TABLE OF TY_SKAT1.

TYPES : BEGIN OF TY_ADRC,


ADDRNUMBER TYPE ADRC-ADDRNUMBER,
STREET TYPE ADRC-STREET,
DONT_USE_S TYPE ADRC-DONT_USE_S,
STREETCODE TYPE ADRC-STREETCODE,
END OF TY_ADRC.
DATA: WA_ADRC TYPE TY_ADRC,
IT_ADRC TYPE TABLE OF TY_ADRC.

TYPES : BEGIN OF TY_LFA1,


LIFNR TYPE LFA1-LIFNR,
NAME1 TYPE LFA1-NAME1,
NAME2 TYPE LFA1-NAME2,
ADRNR TYPE LFA1-ADRNR,
END OF TY_LFA1.
DATA: WA_LFA1 TYPE TY_LFA1,
IT_LFA1 TYPE TABLE OF TY_LFA1.
* DECLARING IT_FINAL1

DATA: BEGIN OF WA_FINAL1,


LIFNR TYPE BSIK-LIFNR,
NAME1 TYPE LFA1-NAME1,
NAME2 TYPE LFA1-NAME2,
STREET1 TYPE ADRC-STREET,
STREET2 TYPE ADRC-DONT_USE_S,
STREET3 TYPE ADRC-STREETCODE,
BUKRS TYPE BSIK-BUKRS,
AKONT TYPE LFB1-AKONT,
RDES TYPE SKAT-TXT50,
HKONT TYPE BSIK-HKONT,
TXT50 TYPE SKAT-TXT50,
NYD TYPE BSIK-DMBTR,
30DAYS TYPE BSIK-DMBTR,
60DAYS TYPE BSIK-DMBTR,
90DAYS TYPE BSIK-DMBTR,
120DAYS TYPE BSIK-DMBTR,
180DAYS TYPE BSIK-DMBTR,
365DAYS TYPE BSIK-DMBTR,
2Y TYPE BSIK-DMBTR,
2YA TYPE BSIK-DMBTR,
TOTAL TYPE BSIK-DMBTR,
END OF WA_FINAL1.
DATA IT_FINAL1 LIKE TABLE OF WA_FINAL1.

* DECLARING THE IT_FINAL


DATA: BEGIN OF WA_FINAL,

सतीष Kumar రెడ్ి డ Page No: 50


LIFNR TYPE BSIK-LIFNR,
HKONT TYPE BSIK-LIFNR,
NYD TYPE BSIK-DMBTR,
30DAYS TYPE BSIK-DMBTR,
60DAYS TYPE BSIK-DMBTR,
90DAYS TYPE BSIK-DMBTR,
120DAYS TYPE BSIK-DMBTR,
180DAYS TYPE BSIK-DMBTR,
365DAYS TYPE BSIK-DMBTR,
2Y TYPE BSIK-DMBTR,
2YA TYPE BSIK-DMBTR,
END OF WA_FINAL.
DATA IT_FINAL LIKE HASHED TABLE OF WA_FINAL WITH UNIQUE KEY LIFNR HKONT.

* DECLARING THE FIELDCATALOG


DATA: IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT LIKE LINE OF IT_FCAT.

* DECLARING THE LAYOUT


DATA WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
WA_LAYOUT-ZEBRA = 'X'.
* SELECT QUERIES
SELECT BUKRS LIFNR BELNR BUDAT BLDAT SHKZG DMBTR HKONT FROM BSIK INTO
TABLE IT_BSIK WHERE BUKRS = PR_BUKRS AND BUDAT <= PR_BUDAT AND
LIFNR IN SO_LIFNR AND HKONT IN SO_HKONT.

IF IT_BSIK IS NOT INITIAL.


SELECT LIFNR NAME1 NAME2 ADRNR FROM LFA1 INTO TABLE IT_LFA1 FOR ALL
ENTRIES IN IT_BSIK WHERE LIFNR = IT_BSIK-LIFNR.
SELECT LIFNR BUKRS AKONT FROM LFB1 INTO TABLE IT_LFB1 FOR ALL ENTRIES
IN IT_BSIK WHERE LIFNR = IT_BSIK-LIFNR AND BUKRS = IT_BSIK-BUKRS.
SELECT SAKNR TXT50 FROM SKAT INTO TABLE IT_SKAT FOR ALL ENTRIES IN
IT_BSIK WHERE SAKNR = IT_BSIK-HKONT AND SPRAS = SY-LANGU.
ENDIF.

IF IT_LFA1 IS NOT INITIAL.


SELECT ADDRNUMBER STREET DONT_USE_S STREETCODE FROM ADRC INTO TABLE
IT_ADRC FOR ALL ENTRIES IN IT_LFA1 WHERE ADDRNUMBER = IT_LFA1-ADRNR.
ENDIF.

IF IT_LFB1 IS NOT INITIAL.


SELECT SAKNR TXT50 FROM SKAT INTO TABLE IT_SKAT1 FOR ALL ENTRIES IN
IT_LFB1 WHERE SAKNR = IT_LFB1-AKONT AND SPRAS = SY-LANGU.
ENDIF.

LOOP AT IT_BSIK INTO WA_BSIK.


WA_FINAL-LIFNR = WA_BSIK-LIFNR.
WA_FINAL-HKONT = WA_BSIK-HKONT.
IF WA_BSIK-SHKZG = 'H'.

सतीष Kumar రెడ్ి డ Page No: 51


WA_BSIK-DMBTR = 0 - WA_BSIK-DMBTR.
ENDIF.
V_DAYS = PR_BUDAT - WA_BSIK-BLDAT.
IF V_DAYS = 0.
WA_FINAL-NYD = WA_BSIK-DMBTR.
ELSEIF V_DAYS > 0 AND V_DAYS <= 30.
WA_FINAL-30DAYS = WA_BSIK-DMBTR.
ELSEIF V_DAYS > 30 AND V_DAYS <= 60.
WA_FINAL-60DAYS = WA_BSIK-DMBTR.
ELSEIF V_DAYS > 60 AND V_DAYS <= 90.
WA_FINAL-90DAYS = WA_BSIK-DMBTR.
ELSEIF V_DAYS > 90 AND V_DAYS <= 120.
WA_FINAL-120DAYS = WA_BSIK-DMBTR.
ELSEIF V_DAYS > 120 AND V_DAYS <= 180.
WA_FINAL-180DAYS = WA_BSIK-DMBTR.
ELSEIF V_DAYS > 180 AND V_DAYS <= 365.
WA_FINAL-365DAYS = WA_BSIK-DMBTR.
ELSEIF V_DAYS > 365 AND V_DAYS <= 730.
WA_FINAL-2Y = WA_BSIK-DMBTR.
ELSE.
WA_FINAL-2YA = WA_BSIK-DMBTR.
ENDIF.
COLLECT WA_FINAL INTO IT_FINAL.
CLEAR WA_FINAL.
ENDLOOP.

LOOP AT IT_FINAL INTO WA_FINAL.


MOVE-CORRESPONDING WA_FINAL TO WA_FINAL1.
READ TABLE IT_BSIK INTO WA_BSIK WITH KEY LIFNR = WA_FINAL-LIFNR HKONT
= WA_FINAL-HKONT.
IF SY-SUBRC = 0.
WA_FINAL1-BUKRS = WA_BSIK-BUKRS.
ENDIF.
READ TABLE IT_LFA1 INTO WA_LFA1 WITH KEY LIFNR = WA_FINAL-LIFNR.
IF SY-SUBRC = 0.
WA_FINAL1-NAME1 = WA_LFA1-NAME1.
WA_FINAL1-NAME2 = WA_LFA1-NAME2.
READ TABLE IT_ADRC INTO WA_ADRC WITH KEY ADDRNUMBER = WA_LFA1-ADRNR.
IF SY-SUBRC = 0.
WA_FINAL1-STREET1 = WA_ADRC-STREET.
WA_FINAL1-STREET2 = WA_ADRC-DONT_USE_S.
WA_FINAL1-STREET3 = WA_ADRC-STREETCODE.
ENDIF.
ENDIF.
READ TABLE IT_LFB1 INTO WA_LFB1 WITH KEY LIFNR = WA_FINAL-LIFNR BUKRS
= WA_BSIK-BUKRS.
IF SY-SUBRC = 0.
WA_FINAL1-AKONT = WA_LFB1-AKONT.
READ TABLE IT_SKAT1 INTO WA_SKAT1 WITH KEY SAKNR = WA_LFB1-AKONT.
IF SY-SUBRC = 0.

सतीष Kumar రెడ్ి డ Page No: 52


WA_FINAL1-RDES = WA_SKAT1-TXT50.
ENDIF.
ENDIF.
READ TABLE IT_SKAT INTO WA_SKAT WITH KEY SAKNR = WA_FINAL-HKONT.
IF SY-SUBRC = 0.
WA_FINAL1-TXT50 = WA_SKAT-TXT50.
ENDIF.

WA_FINAL1-TOTAL = WA_FINAL-NYD + WA_FINAL-30DAYS + WA_FINAL-60DAYS +


WA_FINAL-90DAYS + WA_FINAL-120DAYS + WA_FINAL-180DAYS +
WA_FINAL-365DAYS + WA_FINAL-2Y + WA_FINAL-2YA.
APPEND WA_FINAL1 TO IT_FINAL1.
CLEAR WA_FINAL1.
ENDLOOP.
* FILLING THE FIELD CATALOG
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'LIFNR'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'VENDOR'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'NAME1'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'NAME1'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'NAME2'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'NAME2'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'STREET1'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'STREET1'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'STREET2'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'STREET2'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'STREET3'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'VENDOR'.
APPEND WA_FCAT TO IT_FCAT.

सतीष Kumar రెడ్ి డ Page No: 53


CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'BUKRS'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'COMPANY CODE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'AKONT'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'RECON'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'RDES'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'RECON DES'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'HKONT'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'G/L ACC'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'TXT50'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'G/L ACC DES'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'NYD'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'NOT YET DUE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = '30DAYS'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '0-30 DAYS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = '60DAYS'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '30-60 DAYS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.

सतीष Kumar రెడ్ి డ Page No: 54


WA_FCAT-FIELDNAME = '90DAYS'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '60-90 DAYS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = '120DAYS'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '90-120 DAYS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = '180DAYS'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '120-180 DAYS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = '365DAYS'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '180-365 DAYS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = '2Y'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '1-2 YEARS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = '2YA'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = '2 YEARS ABOVE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
W_CPOS = W_CPOS + 1.
WA_FCAT-FIELDNAME = 'TOTAL'.
WA_FCAT-COL_POS = W_CPOS.
WA_FCAT-SELTEXT_M = 'TOTAL'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'


EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FCAT
I_SAVE = 'X'
TABLES
T_OUTTAB = IT_FINAL1.

सतीष Kumar రెడ్ి డ Page No: 55


GLT0: - It’s the standard data base table which contains period wise expenditures. Fields are
HSL01, HSL02, HSL03, ---- HSL16. the last month we consider as HSL12 + 4 grace periods
(HSL13, HSL14, HSL15, HSL15). HSLVT closing.

Field symbol: -Field symbol acts like pointers in ‘C’ language.


Syntax: -
Field-symbols (<field symbol name>) type any.
Field-symbols <FS> type any.
Data A(10) type C,
Data B(10) type C.
A = ‘B’.
B = ‘10’.
Assign (A) to <FS>.
Write A.
Write / <FS>.

SIMENS IBM US
W V GT Global internal table
PR P GS  Global work area
SO S LT  Local internal table
IT T LS  Local work area
WA IS
C C
R R
Note: - Get parameter ID is used to get the current open document value. If you want to get the current
purchase document which is opened.
Data V1 type EKKO-EBELN.
Get parameter ID ‘BES’ field V1.
Write V1.
Note: - After receiving the FS (Functional Specification), if we don’t know any field name and their table
name then ask the function people where they get data or feed the data. Then the functional people open the
screen and show the values. Then we place cursor on the field. Click on F1. Click on technical information.
Identify the table name and field name. Some times instead of table structure is there then we identify the
data element. Based on the data element we get the table field.
Steps to get the table name based on the data element: -
Execute SE11. Select the radio button data type. Provide the data element name. Click on where used list.
Select the check box table fields. Enter. Then we get the all the table names, which are used this data
element. Click on find. Provide the related short description. Enter. Identify our table.
Steps to identify the data base table based on the transaction code: -
Execute SE93. Provide the transaction code. Click on display. Click on display object list. Expand the
package. Expand the dictionary objects. Expand the data base tables. Identify the tables.

If you want to identify the vendor tables then go to SE11. select the radio button data base table. Provide the
table L* & click o F4 button. Then we get the all vendor related tables. The same way as follows.
Vendor tables  L*
Customer tables  K*
Material tables  M*
Company tables  T*
Purchase tables  E*

सतीष Kumar రెడ్ి డ Page No: 56


Sales tables  V*
Finance tables  B*

Steps to identify the call the link tables based on any table: -
Execute SE11. select the radio button data base table. Provide the table name (LFA1). Click on where used
list in the application tool bar (Ctrl + Shift + F3). Select only data base table check box. Enter. Then it
provides the all the related tables.
Steps to identify the tables based on idocs: -
Execute SE30. Provide related idoc name (CREMAS05). Click on display. In the each segment 3-6
characters are tables. Identify the all the tables.
EX
E I L F A 1 B
3 4 5 6
Table
Project 5: -
The report will have the following selection criteria

The report will have the following displayed fields.

सतीष Kumar రెడ్ి డ Page No: 57


REPORT ZP4.
TYPE-POOLS SLIS.
DATA W_CLP TYPE I.
TYPES : BEGIN OF TY_MSEG,
MBLNR TYPE MSEG-MBLNR,
MJAHR TYPE MSEG-MJAHR,
BWART TYPE MSEG-BWART,
MATNR TYPE MSEG-MATNR,
WERKS TYPE MSEG-WERKS,
LGORT TYPE MSEG-LGORT,
CHARG TYPE MSEG-CHARG,
BWTAR TYPE MSEG-BWTAR,
MEINS TYPE MSEG-MEINS,
KOSTL TYPE MSEG-KOSTL,
AUFNR TYPE MSEG-AUFNR,
END OF TY_MSEG.
DATA: WA_MSEG TYPE TY_MSEG,
IT_MSEG TYPE TABLE OF TY_MSEG.

TYPES : BEGIN OF TY_MKPF,


MBLNR TYPE MKPF-MBLNR,
MJAHR TYPE MKPF-MJAHR,
BUDAT TYPE MKPF-BUDAT,
END OF TY_MKPF.
DATA: WA_MKPF TYPE TY_MKPF,
IT_MKPF TYPE TABLE OF TY_MKPF.

TYPES : BEGIN OF TY_MAKT,


MATNR TYPE MAKT-MATNR,
MAKTX TYPE MAKT-MAKTX,
END OF TY_MAKT.
DATA: WA_MAKT TYPE TY_MAKT,
IT_MAKT TYPE TABLE OF TY_MAKT.

TYPES : BEGIN OF TY_MCHB,


MATNR TYPE MCHB-MATNR,
WERKS TYPE MCHB-WERKS,
LGORT TYPE MCHB-LGORT,
CHARG TYPE MCHB-CHARG,
CLABS TYPE MCHB-CLABS,
CINSM TYPE MCHB-CINSM,
CEINM TYPE MCHB-CEINM,
CSPEM TYPE MCHB-CSPEM,
END OF TY_MCHB.
DATA: WA_MCHB TYPE TY_MCHB,
IT_MCHB TYPE TABLE OF TY_MCHB.

TYPES : BEGIN OF TY_MCHA,


MATNR TYPE MCHA-MATNR,

सतीष Kumar రెడ్ి డ Page No: 58


WERKS TYPE MCHA-WERKS,
CHARG TYPE MCHA-CHARG,
VFDAT TYPE MCHA-VFDAT,
QNDAT TYPE MCHA-QNDAT,
HSDAT TYPE MCHA-HSDAT,
END OF TY_MCHA.
DATA: WA_MCHA TYPE TY_MCHA,
IT_MCHA TYPE TABLE OF TY_MCHA.

TYPES : BEGIN OF TY_MARA,


MATNR TYPE MARA-MATNR,
MATKL TYPE MARA-MATKL,
END OF TY_MARA.
DATA: WA_MARA TYPE TY_MARA,
IT_MARA TYPE TABLE OF TY_MARA.

TYPES : BEGIN OF TY_T001W,


WERKS TYPE T001W-WERKS,
NAME1 TYPE T001W-NAME1,
END OF TY_T001W.
DATA: WA_T001W TYPE TY_T001W,
IT_T001W TYPE TABLE OF TY_T001W.

TABLES MSEG.
SELECTION-SCREEN BEGIN OF BLOCK A WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: SO_MATNR FOR MSEG-MATNR OBLIGATORY,
SO_WERKS FOR MSEG-WERKS,
SO_LGORT FOR MSEG-LGORT,
SO_CHARG FOR MSEG-CHARG.
SELECTION-SCREEN END OF BLOCK A.
PARAMETER P_BS AS CHECKBOX.
RANGES R_BWART FOR MSEG-BWART.
R_BWART-LOW = '101'.
R_BWART-SIGN = 'I'.
R_BWART-OPTION = 'EQ'.
APPEND R_BWART.
R_BWART-LOW = '201'.
APPEND R_BWART.
R_BWART-LOW = '261'.
APPEND R_BWART.

SELECT MBLNR MJAHR BWART MATNR WERKS LGORT CHARG BWTAR MEINS KOSTL AUFNR
FROM MSEG INTO TABLE IT_MSEG WHERE MATNR IN SO_MATNR AND
WERKS IN SO_WERKS AND CHARG IN SO_CHARG AND LGORT IN SO_LGORT AND BWART
IN R_BWART.

IF IT_MSEG IS NOT INITIAL.


SELECT MATNR MAKTX FROM MAKT INTO TABLE IT_MAKT FOR ALL ENTRIES IN
IT_MSEG WHERE MATNR = IT_MSEG-MATNR.

सतीष Kumar రెడ్ి డ Page No: 59


SELECT MBLNR MJAHR BUDAT FROM MKPF INTO TABLE IT_MKPF FOR ALL ENTRIES
IN IT_MSEG WHERE MBLNR = IT_MSEG-MBLNR AND MJAHR = IT_MSEG-MJAHR.
SELECT MATNR WERKS CHARG VFDAT QNDAT HSDAT FROM MCHA INTO TABLE
IT_MCHA FOR ALL ENTRIES IN IT_MSEG WHERE
MATNR = IT_MSEG-MATNR AND CHARG = IT_MSEG-CHARG AND WERKS = IT_MSEG-
WERKS.

SELECT MATNR WERKS LGORT CHARG CLABS CINSM CEINM CSPEM FROM MCHB INTO
TABLE IT_MCHB FOR ALL ENTRIES IN IT_MSEG WHERE MATNR =
IT_MSEG-MATNR AND WERKS = IT_MSEG-WERKS AND CHARG = IT_MSEG-CHARG AND
LGORT = IT_MSEG-LGORT.
SELECT MATNR MATKL FROM MARA INTO TABLE IT_MARA FOR ALL ENTRIES IN
IT_MSEG WHERE MATNR = IT_MSEG-MATNR.
SELECT WERKS NAME1 FROM T001W INTO TABLE IT_T001W FOR ALL ENTRIES IN
IT_MSEG WHERE WERKS = IT_MSEG-WERKS.
ENDIF.

TYPES: BEGIN OF TY_FINAL,


MATNR TYPE MSEG-MATNR,
MAKTX TYPE MAKT-MAKTX,
WERKS TYPE MSEG-WERKS,
NAME1 TYPE T001W-NAME1,
LGORT TYPE MSEG-LGORT,
MEINS TYPE MSEG-MEINS,
CHARG TYPE MSEG-CHARG,
MATKL TYPE MARA-MATKL,
BWTAR TYPE MSEG-BWTAR,
HSDAT TYPE MCHA-HSDAT,
VFDAT TYPE MCHA-VFDAT,
QNDAT TYPE MCHA-QNDAT,
LRDT TYPE MKPF-BUDAT,
MBLNR TYPE MKPF-MBLNR,
LCDT TYPE MKPF-BUDAT,
PC TYPE MSEG-AUFNR,
NOD TYPE I,
CLABS TYPE MCHB-CLABS,
CINSM TYPE MCHB-CINSM,
CSPEM TYPE MCHB-CSPEM,
CEINM TYPE MCHB-CEINM,
TSTOCK TYPE MCHB-CLABS,
END OF TY_FINAL.
DATA: WA_FINAL TYPE TY_FINAL,
IT_FINAL TYPE TABLE OF TY_FINAL.
DATA IT_MSEG1 LIKE IT_MSEG.
DATA WA_MSEG1 LIKE LINE OF IT_MSEG1.

LOOP AT IT_MSEG INTO WA_MSEG.


WA_FINAL-MATNR = WA_MSEG-MATNR.
WA_FINAL-WERKS = WA_MSEG-WERKS.
WA_FINAL-LGORT = WA_MSEG-LGORT.

सतीष Kumar రెడ్ి డ Page No: 60


WA_FINAL-MEINS = WA_MSEG-MEINS.
WA_FINAL-CHARG = WA_MSEG-CHARG.
WA_FINAL-BWTAR = WA_MSEG-BWTAR.

* LAST GR DATE
IT_MSEG1 = IT_MSEG.
DELETE IT_MSEG1 WHERE BWART <> '101'.
DELETE IT_MSEG1 WHERE MATNR <> WA_MSEG-MATNR AND WERKS <> WA_MSEG-
WERKS AND LGORT <> WA_MSEG-LGORT AND CHARG <> WA_MSEG-CHARG.
SORT IT_MSEG1 BY MBLNR DESCENDING.
READ TABLE IT_MSEG1 INTO WA_MSEG1 INDEX 1.
IF SY-SUBRC = 0.
READ TABLE IT_MKPF INTO WA_MKPF WITH KEY MBLNR = WA_MSEG1-MBLNR
MJAHR = WA_MSEG1-MJAHR.
IF SY-SUBRC = 0.
WA_FINAL-LRDT = WA_MKPF-BUDAT.
ENDIF.
ENDIF.

* LAST CONSUMPTION DATE


IT_MSEG1 = IT_MSEG.
DELETE IT_MSEG1 WHERE BWART = '101'.
DELETE IT_MSEG1 WHERE MATNR <> WA_MSEG-MATNR AND WERKS <> WA_MSEG-
WERKS AND CHARG <> WA_MSEG-CHARG AND LGORT <> WA_MSEG-LGORT.
SORT IT_MSEG1 BY MBLNR DESCENDING.
READ TABLE IT_MSEG1 INTO WA_MSEG1 INDEX 1.
IF SY-SUBRC = 0.
READ TABLE IT_MKPF INTO WA_MKPF WITH KEY MBLNR = WA_MSEG1-MBLNR
MJAHR = WA_MSEG1-MJAHR.
IF SY-SUBRC = 0.
WA_FINAL-LCDT = WA_MKPF-BUDAT.
ENDIF.
IF WA_MSEG1-BWART = '201'.
WA_FINAL-PC = WA_MSEG1-KOSTL.
ELSE.
WA_FINAL-PC = WA_MSEG1-AUFNR.
ENDIF.
ENDIF.
READ TABLE IT_MCHA INTO WA_MCHA WITH KEY MATNR = WA_MSEG-MATNR WERKS =
WA_MSEG-WERKS CHARG = WA_MSEG-CHARG.
IF SY-SUBRC = 0.
WA_FINAL-HSDAT = WA_MCHA-HSDAT.
WA_FINAL-VFDAT = WA_MCHA-VFDAT.
WA_FINAL-QNDAT = WA_MCHA-QNDAT.
ENDIF.
READ TABLE IT_MCHB INTO WA_MCHB WITH KEY MATNR = WA_MSEG-MATNR WERKS =
WA_MSEG-WERKS LGORT = WA_MSEG-LGORT CHARG = WA_MSEG-CHARG.
IF SY-SUBRC = 0.
WA_FINAL-CLABS = WA_MCHB-CLABS.
WA_FINAL-CINSM = WA_MCHB-CINSM.

सतीष Kumar రెడ్ి డ Page No: 61


WA_FINAL-CSPEM = WA_MCHB-CSPEM.
WA_FINAL-CEINM = WA_MCHB-CEINM.
WA_FINAL-TSTOCK = WA_MCHB-CLABS + WA_MCHB-CINSM.
ENDIF.
READ TABLE IT_MARA INTO WA_MARA WITH KEY MATNR = WA_MSEG-MATNR.
IF SY-SUBRC = 0.
WA_FINAL-MATKL = WA_MARA-MATKL.
ENDIF.
READ TABLE IT_T001W INTO WA_T001W WITH KEY WERKS = WA_MSEG-WERKS.
IF SY-SUBRC = 0.
WA_FINAL-NAME1 = WA_T001W-NAME1.
ENDIF.
WA_FINAL-NOD = SY-DATUM - WA_FINAL-LCDT.
APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.
ENDLOOP.

DATA: IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,


WA_FCAT LIKE LINE OF IT_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'MATNR'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'MATERIAL'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'MAKTX'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'MATERIAL DES'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'WERKS'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'PLANT'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'NAME1'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'PLANT NAME'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.

सतीष Kumar రెడ్ి డ Page No: 62


WA_FCAT-FIELDNAME = 'LGORT'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'STORAGE LOCATION'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'MEINS'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'UOM'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'CHARG'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'BATCH'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'MATKL'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'MAT GROUP'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'BWTAR'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'VALUATION TYPE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'HSDAT'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'MFG DT'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'VFDAT'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'EXP DT'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'QNDAT'.

सतीष Kumar రెడ్ి డ Page No: 63


WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'NEXT INSPECTION DATE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'LRDT'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'LAST RECEPIT DATE'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'MBLNR'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'MATERIAL DOC'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'LCDT'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'LOST CONS DT'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'PC'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'ORDER / CC'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'NOD'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'NO OF DAYS'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'CLABS'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'UN REST STOCK'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'CINSM'.
WA_FCAT-COL_POS = W_CLP.

सतीष Kumar రెడ్ి డ Page No: 64


WA_FCAT-SELTEXT_M = 'QI STOCK'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'CSPEM'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'BLOCKED STOCK'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'CEINM'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'RESERVED STOCK'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

W_CLP = W_CLP + 1.
WA_FCAT-FIELDNAME = 'TSTOCK'.
WA_FCAT-COL_POS = W_CLP.
WA_FCAT-SELTEXT_M = 'TOTAL STOCK'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.

DATA WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'


EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FCAT
I_SAVE = 'X'
TABLES
T_OUTTAB = IT_FINAL.

Hi friends. This is satish. If you find any mistakes please send me mail to
satishkumarreddy.mn@gmail.com

सतीष Kumar రెడ్ి డ Page No: 65

You might also like