why SAP ?
+SAP Software is a ERP( Enterprise
Resource Planing) solution, through
which large and medium scale companies
can manage their business.SAP Software is
produced by a German based company SAP.
SAP Company: SAP Company founded in
1972 in Germany by five former employes
of IBM and they released standard versions
called R1 and R2 in early days, and they
released 3-tier architecture R3 in 1990`s
which was very successful.
In 2000 SAP released ECC (Enterprise Core
Component), latest version in market is ECC
6.0 and they are adding additions to this in
the form of enhancement packs.
Why SAP?
Through SAP software a company can plan
their business in different aspects like
Supply Chain Solutions, Material
Management, Sales and Distribution,
Finance controlling, Human Resource
planing, etc.
The total SAP Software is built using ABAP
Programing Language, which is a standard
programing language developed by SAP it
self, we call ABAP as 4th Generation
Programing Language (ABAP/4)
Some of Modules in SAP are :
SAP FI module: FI stands for Financial
Accounting.
SAP CO module: CO stands for
Controlling.
SAP Consultants
+SAP is a huge software and in order to
implement SAP ERP for a Organization, it
needs lot of man power, the SAP
implementation is done by different type of
consultants .
Technical
Network
Consulta
Consultan
Administrat
nts
ts
ors
Functional
consultants are
responsible for
configuring the real
world business
scenarios into SAP
software .
Ex: Configurations
like Plants
Configurations,
Business Countries
Configurations,
Sales Organizations
configuration etc
Technical consultants
are responsible for
coustomizing SAP
ABAP software as per
customer
specifications i:e
Developing New SAP
Business Applications,
Enhansing SAP
Software, Creating
SAP Tables etc
ABAP Consultant
Roles and
Responsibilities
+SAP ABAP Consultants are responsible for
developing SAP business applications using
SAP Standard programming language ABAP,
the main roles and responsibilities of SAP
ABAP Consultant are...
SAP ABAP Consultants plays crucial role
in implementation of SAP software for a
organization .
Total SAP software is developed using
ABAP, ABAP consultants are needed in
every SAP module.
Implementation Process
Getting the business Requirement document from functional consultant / functional analyst .
Ticket system in
support projects
SAP ABAP
Consultants
+Handling tickets is called Issue Tracking
system. The errors or bugs forwarded by
the end user to the support team are
prioritized under three priorities High,
Medium and Low. Each and every priority as
got its time limits before that we have to fix
the error.
The main job of the supporting consultant is
to provide assistance on line to the
customer or the organization where SAP is
already implemented for which the person
should be very strong in the subject and the
process which are implemented in SAP at
SAP System
landscape
+SAP System landscape is the group of
systems you have installed, all the systems
are linked to different transport routs to
main system, system landscape may vary
from company to company or business to
business, SAP recommended landscape is
explained below.
DEV
Development system, where all custom
developments, enhancements and
configurations will be done. Once
development is completed the objects will
be moved to testing system (QAS).It may
have more than one client that is one for
development and one is for configurations.
QAS
Quality Assurance System where all the
developed objects will be tested with
different test cases.
PRD
This is alive business system, where
business users will be using the objects with
real-time data, this is where the developed
Data Type
Possible Value
I include
E exclude
EQ Equal
NE Not Equal
GE Greater Than or Equal
GT Greater Than
LE Less Than or Equal
LT Less Than
CP Contains Pattern
NP LOW Data type of selection field
Data value. Can also contain wildcards
Data type of selection field, same Data value in case of range criteria. Can also
HIGH
as LOW
contain wildcards
*&--------------------------------------------------------------------*
REPORT ZALV_STR.
TABLES: MARA.
DATA : IT_MARA TYPE TABLE OF MARA .
START-OF-SELECTION .
PERFORM GET_MARA_DATA . "Double click to
create below form
END-OF-SELECTION .
PERFORM DISP_MARA_ALV . "Double click to
create below form
*&--------------------------------------------------------------------*
*&
Form GET_MARA_DATA
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*---------------------------------------------------------------------*
FORM GET_MARA_DATA .
SELECT * FROM MARA
INTO TABLE IT_MARA
WHERE MATNR IN S_MATNR
.
ENDFORM.
" GET__MARA_DATA
*&--------------------------------------------------------------------*
*&
Form DISP_MARA_ALV
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*---------------------------------------------------------------------*
FORM DISP_MARA_ALV .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_STRUCTURE_NAME = 'MARA'
TABLES
T_OUTTAB
ENDFORM.
= IT_MARA.
" DISP_MARA_ALV
Field Catalog
Field catalog is an internal table which is
used to pass list of fields to display in ALV
report, we can set different properties to
fields which are going to display in ALV.
Type Group
It is a data dictionary objects which
contains all the reusable user-defined types.
Example for a type group is SLIS, which
contains all the user-defined types for
developing ALV reports.
TYPE-POOLS SLIS .
START-OF-SELECTION .
PERFORM GET_DATA .
PERFORM CREATE_FCAT.
END-OF-SELECTION .
PERFORM DISP_ALV .
*&--------------------------------------------------------------------*
*&
Form GET_DATA
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*---------------------------------------------------------------------*
FORM GET_DATA .
SELECT MATNR MTART MBRSH MEINS FROM
MARA
INTO TABLE IT_MARA
WHERE MATNR IN S_MATNR.
.
ENDFORM.
" GET_DATA
*&--------------------------------------------------------------------*
*&
Form DISP_ALV
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*---------------------------------------------------------------------*
FORM DISP_ALV .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT
CATALOG TO ALV
TABLES
T_OUTTAB
ENDFORM.
= IT_MARA.
" DISP_ALV
*&--------------------------------------------------------------------*
*&
Form CREATE_FCAT
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*---------------------------------------------------------------------*
FORM CREATE_FCAT .
WA_FCAT-COL_POS = '1' .
WA_FCAT-FIELDNAME = 'MATNR' .
WA_FCAT-TABNAME = 'IT_MARA' .
WA_FCAT-SELTEXT_M = 'MATERIALNO' .
WA_FCAT-KEY = 'X' .
APPEND WA_FCAT TO IT_FCAT .
CLEAR WA_FCAT .
WA_FCAT-COL_POS = '2' .
WA_FCAT-FIELDNAME = 'MTART' .
WA_FCAT-TABNAME = 'IT_MARA' .
WA_FCAT-SELTEXT_M = 'MATERIALTYPE' .
* WA_FCAT-NO_OUT = 'X' .
WA_FCAT-HOTSPOT = 'X' .
APPEND WA_FCAT TO IT_FCAT .
CLEAR WA_FCAT .
WA_FCAT-COL_POS = '3' .
WA_FCAT-FIELDNAME = 'MBRSH' .
WA_FCAT-REF_FIELDNAME = 'MBRSH' .
WA_FCAT-REF_TABNAME = 'MARA' .
* WA_FCAT-TABNAME = 'IT_MARA' .
* WA_FCAT-SELTEXT_M = 'INDSECTOR' .
* WA_FCAT-EDIT = 'X' .
APPEND WA_FCAT TO IT_FCAT .
CLEAR WA_FCAT .
WA_FCAT-COL_POS = '4' .
WA_FCAT-FIELDNAME = 'MEINS' .
WA_FCAT-TABNAME = 'IT_MARA' .
WA_FCAT-SELTEXT_M = 'MAT.UNITS' .
WA_FCAT-EMPHASIZE = 'C610'.
APPEND WA_FCAT TO IT_FCAT .
CLEAR WA_FCAT .
ENDFORM.
" CREATE_FCAT
REPORT ZALV_WITH_FCAT_MERGE.
TYPE-POOLS SLIS .
START-OF-SELECTION .
PERFORM GET_DATA .
PERFORM CREATE_FCAT_MERGE .
END-OF-SELECTION .
PERFORM DISP_ALV .
*&--------------------------------------------------------------------*
*&
Form GET_DATA
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*---------------------------------------------------------------------*
FORM GET_DATA .
SELECT * FROM MARA
INTO CORRESPONDING FIELDS OF TABLE
I_MARA
.
ENDFORM.
" GET_DATA
*&--------------------------------------------------------------------*
*&
Form DISP_ALV
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*---------------------------------------------------------------------*
FORM DISP_ALV .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT
= I_FCAT
TABLES
T_OUTTAB
ENDFORM.
= I_MARA.
" DISP_ALV
*&--------------------------------------------------------------------*
*&
Form CREATE_FCAT_MERGE
*&--------------------------------------------------------------------*
text
*---------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*---------------------------------------------------------------------*
FORM CREATE_FCAT_MERGE .
CALL FUNCTION
'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME
= SY-REPID
I_INTERNAL_TABNAME = 'I_MARA'
I_INCLNAME
= SY-REPID
CHANGING
CT_FIELDCAT
ENDFORM.
= I_FCAT.
" CREATE_FCAT_MERGE
Layout:
Layout is a structure which is used to
decorate or embellish the out put of ALV
Report.
Requirement: Display list of materials for
a material type, with all fields of out put are
editable, no horizontal and vertical lines
and hotspot on material no.
Input Screen
START-OF-SELECTION .
PERFORM GET_DATA .
PERFORM CREATE_FCAT .
PERFORM CREATE_LAYOUT.
PERFORM DISPLAY_DATA .
END-OF-SELECTION .
FORM GET_DATA .
" GET_DATA
FORM DISPLAY_DATA .
= WA_LAYOUT
IT_FIELDCAT
= I_FCAT
TABLES
T_OUTTAB
ENDFORM.
= I_MARA.
" DISPLAY_DATA
FORM DISPLAY_DATA_LIST .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'MARA'
TABLES
T_OUTTAB
= I_MARA.
IF SY-SUBRC NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY
NUMBER SY-MSGNO
*
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4.
ENDIF.
ENDFORM.
" DISPLAY_DATA_LIST
FORM CREATE_FCAT .
V_POS = 1 .
WA_FCAT-COL_POS = V_POS.
WA_FCAT-FIELDNAME = 'MATNR' .
WA_FCAT-SELTEXT_M = 'Material.NO' .
WA_FCAT-HOTSPOT = 'X' .
APPEND WA_FCAT TO I_FCAT .
CLEAR WA_FCAT .
V_POS = V_POS 1.
WA_FCAT-COL_POS = V_POS .
WA_FCAT-FIELDNAME = 'MTART' .
WA_FCAT-SELTEXT_M = 'Material.Type' .
APPEND WA_FCAT TO I_FCAT .
CLEAR WA_FCAT .
V_POS = V_POS 1.
WA_FCAT-COL_POS = V_POS .
WA_FCAT-FIELDNAME = 'MBRSH' .
WA_FCAT-SELTEXT_M = 'Ind.Sector' .
APPEND WA_FCAT TO I_FCAT .
CLEAR WA_FCAT .
V_POS = V_POS 1.
WA_FCAT-COL_POS = V_POS .
WA_FCAT-FIELDNAME = 'MATKL' .
WA_FCAT-SELTEXT_M = 'Mat.Grp' .
APPEND WA_FCAT TO I_FCAT .
CLEAR WA_FCAT .
V_POS = V_POS 1.
WA_FCAT-COL_POS = V_POS .
WA_FCAT-FIELDNAME = 'MEINS' .
WA_FCAT-SELTEXT_M = 'Units' .
APPEND WA_FCAT TO I_FCAT .
CLEAR WA_FCAT .
ENDFORM.
" CREATE_FCAT
FORM CREATE_LAYOUT .
WA_LAYOUT-ZEBRA = 'X' .
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X' .
WA_LAYOUT-EDIT = 'X' .
WA_LAYOUT-NO_VLINE = 'X' .
WA_LAYOUT-NO_HLINE = 'X' .
ENDFORM.
" CREATE_LAYOUT
Layout:
Layout is a structure which is used to
decorate or embellish the out put of ALV
Report.
Requirement: Display list of sales order
for sales order range with totals and
subtotals of price
Input screen
END-OF-SELECTION .
PERFORM DISP_ALV .
FORM GET_DATA .
SELECT VBELN POSNR MATNR NETWR FROM
VBAP
INTO TABLE I_VBAP where vbeln in s_vbeln
.
ENDFORM.
" GET_DATA
FORM DISP_ALV .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK
=''
* I_BYPASSING_BUFFER
=''
* I_BUFFER_ACTIVE
=''
I_CALLBACK_PROGRAM
* I_CALLBACK_PF_STATUS_SET
* I_CALLBACK_USER_COMMAND
* I_CALLBACK_TOP_OF_PAGE
= SY-REPID
=''
=''
=''
* I_CALLBACK_HTML_TOP_OF_PAGE
* I_CALLBACK_HTML_END_OF_LIST
* I_STRUCTURE_NAME
* I_BACKGROUND_ID
=''
* I_GRID_TITLE
* I_GRID_SETTINGS
* IS_LAYOUT
=
=
IT_FIELDCAT
= I_FCAT
* IT_EXCLUDING
* IT_SPECIAL_GROUPS
IT_SORT
* IT_FILTER
* IS_SEL_HIDE
* I_DEFAULT
* I_SAVE
* IS_VARIANT
=
= I_SORT
=
=
= 'X'
=''
=
=''
=''
* IT_EVENTS
* IT_EVENT_EXIT
* IS_PRINT
=
=
* IS_REPREP_ID
* I_SCREEN_START_COLUMN
=0
* I_SCREEN_START_LINE
=0
* I_SCREEN_END_COLUMN
=0
* I_SCREEN_END_LINE
=0
* I_HTML_HEIGHT_TOP
=0
* I_HTML_HEIGHT_END
=0
* IT_ALV_GRAPHICS
* IT_HYPERLINK
=
=
* IT_ADD_FIELDCAT
* IT_EXCEPT_QINFO
* IR_SALV_FULLSCREEN_ADAPTER
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER
* ES_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB
= I_VBAP
* EXCEPTIONS
* PROGRAM_ERROR
* OTHERS
=1
=2
.
IF SY-SUBRC NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY
NUMBER SY-MSGNO
*
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4.
ENDIF.
ENDFORM.
" DISP_ALV
FORM CREATE_FCAT .
WA_FCAT-COL_POS = '1' .
WA_FCAT-FIELDNAME = 'VBELN' .
WA_FCAT-TABNAME = 'I_VBAP' .
WA_FCAT-SELTEXT_M = 'SDNO' .
WA_FCAT-KEY = 'X' .
APPEND WA_FCAT TO I_FCAT .
CLEAR WA_FCAT .
WA_FCAT-COL_POS = '2' .
WA_FCAT-FIELDNAME = 'POSNR' .
WA_FCAT-TABNAME = 'I_VBAP' .
WA_FCAT-SELTEXT_M = 'ITEMNO' .
* WA_FCAT-NO_OUT = 'X' .
WA_FCAT-HOTSPOT = 'X' .
WA_FCAT-COL_POS = '3' .
WA_FCAT-FIELDNAME = 'MATNR' .
WA_FCAT-TABNAME = 'I_VBAP' .
WA_FCAT-SELTEXT_M = 'MATERIALNO' .
* WA_FCAT-EDIT = 'X' .
APPEND WA_FCAT TO I_FCAT .
CLEAR WA_FCAT .
WA_FCAT-COL_POS = '4' .
WA_FCAT-FIELDNAME = 'NETWR' .
WA_FCAT-TABNAME = 'I_VBAP' .
WA_FCAT-SELTEXT_M = 'NETPRICE' .
WA_FCAT-EMPHASIZE = 'C610'.
WA_FCAT-DO_SUM = 'X' .
APPEND WA_FCAT TO I_FCAT .
CLEAR WA_FCAT .
ENDFORM.
" CREATE_FCAT
FORM CALC_SUBTOT .
WA_SORT-FIELDNAME = 'VBELN '.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X '.
APPEND WA_SORT TO I_SORT .
ENDFORM.
" CALC_SUBTOT
Events in ALV
reports
+There are total 17 events available for ALV
reporting, by using this events we can
display report headers, report footers, user
command, pf status etc.
We use REUSE_ALV_EVENTS_GET function
module to get events and use in our report.
Steps for implementing events.
STEP1: Call the function module
REUSE_ALV_EVENTS_GET and get all
the events into a Internal Table(I_EVENTS).
STEP2: For each EVENT we need to provide
a Sub-Routine name. So Read the EVENT
from Internal Table into WorkArea and
provide the Sub-Routine name.
REPORT ZALV_MATERIAL_TOP_OF_PAGE.
TYPE-POOLS : SLIS .
*DATA DECLARAATIONS
DATA : I_MARA TYPE TABLE OF MARA .
DATA : WA_MARA TYPE MARA .
*ALV DECLARATIONS
DATA : I_FCAT TYPE SLIS_T_FIELDCAT_ALV .
DATA : WA_FCAT TYPE SLIS_FIELDCAT_ALV .
DATA : V_POS TYPE I .
DATA : I_EVENTS TYPE SLIS_T_EVENT .
DATA : WA_EVENTS LIKE LINE OF I_EVENTS .
DATA : I_HEADING TYPE SLIS_T_LISTHEADER .
DATA : WA_HEADING LIKE LINE OF I_HEADING .
START-OF-SELECTION .
PERFORM GET_DATA .
PERFORM CREATE_FCAT .
PERFORM GET_EVENTS .
PERFORM DISPLAY_DATA .
END-OF-SELECTION .
FORM GET_DATA .
SELECT * FROM MARA
INTO TABLE I_MARA
UP TO 100 ROWS .
ENDFORM.
" GET_DATA
FORM DISPLAY_DATA .
IT_FIELDCAT
= I_FCAT
IT_EVENTS
= I_EVENTS
TABLES
T_OUTTAB
= I_MARA.
ENDFORM.
" DISPLAY_DATA
FORM CREATE_FCAT .
V_POS = 1 .
WA_FCAT-COL_POS = V_POS.
WA_FCAT-FIELDNAME = 'MATNR' .
WA_FCAT-SELTEXT_M = 'Material.NO' .
WA_FCAT-HOTSPOT = 'X' .
APPEND WA_FCAT TO I_FCAT .
CLEAR WA_FCAT .
V_POS = V_POS 1.
WA_FCAT-COL_POS = V_POS .
WA_FCAT-FIELDNAME = 'MTART' .
WA_FCAT-SELTEXT_M = 'Material.Type' .
APPEND WA_FCAT TO I_FCAT .
CLEAR WA_FCAT .
V_POS = V_POS 1.
WA_FCAT-COL_POS = V_POS .
WA_FCAT-FIELDNAME = 'MBRSH' .
WA_FCAT-SELTEXT_M = 'Ind.Sector' .
APPEND WA_FCAT TO I_FCAT .
CLEAR WA_FCAT .
V_POS = V_POS 1.
WA_FCAT-COL_POS = V_POS .
WA_FCAT-FIELDNAME = 'MATKL' .
WA_FCAT-SELTEXT_M = 'Mat.Grp' .
APPEND WA_FCAT TO I_FCAT .
CLEAR WA_FCAT .
V_POS = V_POS 1.
WA_FCAT-COL_POS = V_POS .
WA_FCAT-FIELDNAME = 'MEINS' .
WA_FCAT-SELTEXT_M = 'Units' .
APPEND WA_FCAT TO I_FCAT .
CLEAR WA_FCAT .
ENDFORM.
FORM GET_EVENTS .
" CREATE_FCAT
=0
IMPORTING
ET_EVENTS
= I_EVENTS .
***********END OF LIST
READ TABLE I_EVENTS INTO WA_EVENTS WITH
KEY NAME = 'END_OF_LIST' .
WA_EVENTS-FORM = 'FORM_END_OF_LIST' .
" GET_EVENTS
FORM FORM_TOP_OF_PAGE .
WA_HEADING-TYP = 'H' .
* WA_HEADING-KEY = 'H' .
WA_HEADING-INFO = 'MATERIAL MASTER
REPORT' .
APPEND WA_HEADING TO I_HEADING .
WA_HEADING-TYP = 'S' .
WA_HEADING-KEY = 'USERNAME' .
WA_HEADING-INFO = SY-UNAME .
APPEND WA_HEADING TO I_HEADING .
WA_HEADING-TYP = 'A' .
WA_HEADING-KEY = 'DATE' .
WA_HEADING-INFO = SY-DATUM .
APPEND WA_HEADING TO I_HEADING .
CALL FUNCTION
'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY
*
I_LOGO
I_END_OF_LIST_GRID
I_ALV_FORM
= I_HEADING
=
=
=
ENDFORM .
"FORM_TOP_OF_PAGE
FORM FORM_END_OF_LIST .
REFRESH I_HEADING .
CLEAR WA_HEADING .
WA_HEADING-TYP = 'S' .
WA_HEADING-INFO = 'IBM INDIA PVT.LTD' .
APPEND WA_HEADING TO I_HEADING .
CALL FUNCTION
'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY
I_END_OF_LIST_GRID
= I_HEADING
= 'X'
.
ENDFORM .
"FORM_END_OF_LIST
W_FCAT-FIELDNAME
name
= 'MATNR'. "column
W_FCAT-TABNAME
= 'IT_MARA'. "table
W_FCAT-COL_POS
W_FCAT-FIELDNAME
W_FCAT-TABNAME
= '2'.
= 'MTART'.
= 'IT_MARA'.
W_FCAT-REF_TABNAME = 'MARA'.
W_FCAT-REF_FIELDNAME = 'MTART'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS
= '3'.
W_FCAT-FIELDNAME
W_FCAT-TABNAME
= 'MBRSH'.
= 'IT_MARA'.
W_FCAT-REF_TABNAME = 'MARA'.
W_FCAT-REF_FIELDNAME = 'MBRSH'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS
W_FCAT-FIELDNAME
W_FCAT-TABNAME
= '4'.
= 'MATKL'.
= 'IT_MARA'.
W_FCAT-REF_TABNAME = 'MARA'.
W_FCAT-REF_FIELDNAME = 'MATKL'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS
= '5'.
W_FCAT-FIELDNAME
W_FCAT-TABNAME
= 'MEINS'.
= 'IT_MARA'.
W_FCAT-REF_TABNAME = 'MARA'.
W_FCAT-REF_FIELDNAME = 'MEINS'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
= '1'.
= 'MATNR'.
= 'IT_MAKT'.
W_FCAT_MAKT-REF_TABNAME = 'MAKT'.
W_FCAT_MAKT-REF_FIELDNAME = 'MATNR'.
APPEND W_FCAT_MAKT TO T_FCAT_MAKT.
CLEAR W_FCAT_MAKT.
W_FCAT_MAKT-COL_POS
= '2'.
W_FCAT_MAKT-FIELDNAME
W_FCAT_MAKT-TABNAME
= 'SPRAS'.
= 'IT_MAKT'.
W_FCAT_MAKT-REF_TABNAME = 'MAKT'.
W_FCAT_MAKT-REF_FIELDNAME = 'SPRAS'.
APPEND W_FCAT_MAKT TO T_FCAT_MAKT.
CLEAR W_FCAT_MAKT.
W_FCAT_MAKT-COL_POS
W_FCAT_MAKT-FIELDNAME
W_FCAT_MAKT-TABNAME
= '3'.
= 'MAKTX'.
= 'IT_MAKT'.
W_FCAT_MAKT-REF_TABNAME = 'MAKT'.
W_FCAT_MAKT-REF_FIELDNAME = 'MAKTX'.
APPEND W_FCAT_MAKT TO T_FCAT_MAKT.
CLEAR W_FCAT_MAKT.
* * init
CALL FUNCTION
'REUSE_ALV_BLOCK_LIST_INIT' "initialize Block
List ALV
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID.
IT_SORT
I_TEXT
=
=''
TABLES
T_OUTTAB
* EXCEPTIONS
*
PROGRAM_ERROR
=1
MAXIMUM_OF_APPENDS_REACHED
OTHERS
=3
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
=2
IT_SORT
I_TEXT
=
=''
TABLES
T_OUTTAB
* EXCEPTIONS
*
PROGRAM_ERROR
=1
MAXIMUM_OF_APPENDS_REACHED
=2
OTHERS
=3
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
START-OF-SELECTION.
SELECT MATNR
MTART
MBRSH
MATKL
W_FCAT-FIELDNAME
name
= 'MATNR'. "column
W_FCAT-TABNAME
= 'IT_MARA'. "table
W_FCAT-REF_FIELDNAME = 'MATNR'.
"referance field, it will show descriptions
automatically
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS
W_FCAT-FIELDNAME
W_FCAT-TABNAME
= '2'.
= 'MTART'.
= 'IT_MARA'.
W_FCAT-REF_TABNAME = 'MARA'.
W_FCAT-REF_FIELDNAME = 'MTART'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS
W_FCAT-FIELDNAME
W_FCAT-TABNAME
= '3'.
= 'MBRSH'.
= 'IT_MARA'.
W_FCAT-REF_TABNAME = 'MARA'.
W_FCAT-REF_FIELDNAME = 'MBRSH'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS
W_FCAT-FIELDNAME
W_FCAT-TABNAME
= '4'.
= 'MATKL'.
= 'IT_MARA'.
W_FCAT-REF_TABNAME = 'MARA'.
W_FCAT-REF_FIELDNAME = 'MATKL'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
W_FCAT-COL_POS
W_FCAT-FIELDNAME
W_FCAT-TABNAME
= '5'.
= 'MEINS'.
= 'IT_MARA'.
W_FCAT-REF_TABNAME = 'MARA'.
W_FCAT-REF_FIELDNAME = 'MEINS'.
APPEND W_FCAT TO T_FCAT.
CLEAR W_FCAT.
= '1'.
= 'MATNR'.
= 'IT_MAKT'.
W_FCAT_MAKT-REF_TABNAME = 'MAKT'.
W_FCAT_MAKT-REF_FIELDNAME = 'MATNR'.
APPEND W_FCAT_MAKT TO T_FCAT_MAKT.
CLEAR W_FCAT_MAKT.
W_FCAT_MAKT-COL_POS
W_FCAT_MAKT-FIELDNAME
W_FCAT_MAKT-TABNAME
= '2'.
= 'SPRAS'.
= 'IT_MAKT'.
W_FCAT_MAKT-REF_TABNAME = 'MAKT'.
W_FCAT_MAKT-REF_FIELDNAME = 'SPRAS'.
APPEND W_FCAT_MAKT TO T_FCAT_MAKT.
CLEAR W_FCAT_MAKT.
W_FCAT_MAKT-COL_POS
W_FCAT_MAKT-FIELDNAME
W_FCAT_MAKT-TABNAME
= '3'.
= 'MAKTX'.
= 'IT_MAKT'.
W_FCAT_MAKT-REF_TABNAME = 'MAKT'.
W_FCAT_MAKT-REF_FIELDNAME = 'MAKTX'.
APPEND W_FCAT_MAKT TO T_FCAT_MAKT.
CLEAR W_FCAT_MAKT.
* * init
CALL FUNCTION
'REUSE_ALV_BLOCK_LIST_INIT' "initialize Block
List ALV
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID.
IT_SORT
I_TEXT
=
=''
TABLES
T_OUTTAB
* EXCEPTIONS
PROGRAM_ERROR
=1
MAXIMUM_OF_APPENDS_REACHED
OTHERS
=2
=3
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
CALL FUNCTION
'REUSE_ALV_BLOCK_LIST_APPEND' "append ALV
lists
EXPORTING
IS_LAYOUT = S_LAYOUT "set layout
IT_FIELDCAT = T_FCAT_MAKT "set field
catalog
I_TABNAME = 'IT_MAKT' "table
IT_EVENTS = S_EVENTS "events
IT_SORT
I_TEXT
=
=''
TABLES
T_OUTTAB
* EXCEPTIONS
*
PROGRAM_ERROR
=1
MAXIMUM_OF_APPENDS_REACHED
OTHERS
=2
=3
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
CALL FUNCTION
'REUSE_ALV_BLOCK_LIST_DISPLAY' . "display
blocked list
2.
Exclude ALV toolbar functions using
IT_EXCLUDE exporting parameter.
= 'STANDARD_FULLSCREEN'
TABLES
FUNCTIONS = FUN.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ELSE.
WA_EXCLUDE-FCODE = WA_FUN-FCODE.
"add all remaining
APPEND WA_EXCLUDE TO IT_EXCLUDE.
CLEAR WA_EXCLUDE.
ENDIF.
ENDLOOP.
START-OF-SELECTION.
SELECT * FROM MARA INTO TABLE IT_MARA
UP TO 50 ROWS.
CALL FUNCTION
'RS_CUA_GET_STATUS_FUNCTIONS'
EXPORTING
LANGUAGE = 'E'
PROGRAM = 'SAPLKKBL'
STATUS
= 'STANDARD_FULLSCREEN'
TABLES
FUNCTIONS = FUN.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
*&--------------------------------------------------------------------*
*
FOR EXCLUDING STANDARD BUTTONS
FROM ALV TOOLBAR
*&--------------------------------------------------------------------*
LOOP AT FUN INTO WA_FUN. "loop through all
functions
IF WA_FUN-FCODE EQ '&F03' OR WA_FUNFCODE EQ '&F15' OR WA_FUN-FCODE EQ
'&F12'. "don`t add back, exit, stop functions
ELSE.
WA_EXCLUDE-FCODE = WA_FUN-FCODE.
"add all remaining
APPEND WA_EXCLUDE TO IT_EXCLUDE.
CLEAR WA_EXCLUDE.
ENDIF.
ENDLOOP.
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_STRUCTURE_NAME = 'MARA'
IT_EXCLUDING
functions
= IT_EXCLUDE "exclude
TABLES
T_OUTTAB
data
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
Interactive Report
ALV
+Requirement: Display list of materials for a
material type with below options. 1. Add a
hotspot for material number. 2. Whenever
user double click on any material no, it
WA_FCAT-COL_POS = '3' .
WA_FCAT-FIELDNAME = 'MTART' .
WA_FCAT-TABNAME = 'IT_MARA' .
WA_FCAT-SELTEXT_M = 'Material Type' .
APPEND WA_FCAT TO IT_FCAT .
CLEAR WA_FCAT .
WA_FCAT-COL_POS = '4' .
WA_FCAT-FIELDNAME = 'MEINS' .
WA_FCAT-TABNAME = 'IT_MARA' .
WA_FCAT-SELTEXT_M = 'Base.Unit' .
WA_FCAT-REF_TABNAME = 'MARA' .
= SY-REPID
I_CALLBACK_USER_COMMAND =
'USER_COMMAND' "user command form
IT_FIELDCAT
CATALOG TO ALV
TABLES
T_OUTTAB
table
= IT_MARA. "output
"user_command
START-OF-SELECTION.
**get table data
SELECT MATNR MTART MBRSH MEINS FROM
MARA "get data from MARA
INTO TABLE IT_MARA UP TO 50 ROWS
WHERE MTART = P_MTART.
*** generate field catalogue
WA_FCAT-COL_POS = '1' . "column position
WA_FCAT-FIELDNAME = 'MATNR' . "column
name
WA_FCAT-TABNAME = 'IT_MARA' . "table
WA_FCAT-COL_POS = '3' .
WA_FCAT-FIELDNAME = 'MTART' .
WA_FCAT-TABNAME = 'IT_MARA' .
WA_FCAT-SELTEXT_M = 'Material Type' .
APPEND WA_FCAT TO IT_FCAT .
CLEAR WA_FCAT .
WA_FCAT-COL_POS = '4' .
WA_FCAT-FIELDNAME = 'MEINS' .
WA_FCAT-TABNAME = 'IT_MARA' .
WA_FCAT-SELTEXT_M = 'Base.Unit' .
WA_FCAT-REF_TABNAME = 'MARA' .
APPEND WA_FCAT TO IT_FCAT .
CLEAR WA_FCAT .
**display ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM
= SY-REPID
I_CALLBACK_USER_COMMAND =
'USER_COMMAND' "user command form
IT_FIELDCAT
CATALOG TO ALV
TABLES
T_OUTTAB
table
= IT_MARA. "output
"user_command