HR_99S_INTERVAL_BETWEEN_DATES : Difference between two dates in days, weeks, months
WEEK_GET_FIRST_DAY : Get the first day of the week
FIMA_DAYS_AND_MONTHS_AND_YEARS : Find the difference between two dates in years, months and days.
DATE_TO_DAY : Returns the Day for the entered date.
Wednesday, July 29, 2009
Color single row in ALV
REPORT z_alv_color.
TYPE-POOLS: slis.
DATA: BEGIN OF it_flight OCCURS 0,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
seatsmax LIKE sflight-seatsmax,
seatsocc LIKE sflight-seatsocc,
color(4),
END OF it_flight.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
layout TYPE slis_layout_alv.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'IT_FLIGHT'
i_inclname = sy-repid
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2.
SELECT carrid
connid
fldate
seatsmax
seatsocc
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_flight
UP TO 20 ROWS.
*-conditionally populate the color
LOOP AT it_flight.
IF it_flight-seatsocc eq 0.
it_flight-color = 'C600'.
ENDIF.
MODIFY it_flight.
ENDLOOP.
*-Pass the color field information to layout
layout-info_fieldname = 'COLOR'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = layout
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_flight
EXCEPTIONS
program_error = 1.
TYPE-POOLS: slis.
DATA: BEGIN OF it_flight OCCURS 0,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
seatsmax LIKE sflight-seatsmax,
seatsocc LIKE sflight-seatsocc,
color(4),
END OF it_flight.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
layout TYPE slis_layout_alv.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'IT_FLIGHT'
i_inclname = sy-repid
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2.
SELECT carrid
connid
fldate
seatsmax
seatsocc
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_flight
UP TO 20 ROWS.
*-conditionally populate the color
LOOP AT it_flight.
IF it_flight-seatsocc eq 0.
it_flight-color = 'C600'.
ENDIF.
MODIFY it_flight.
ENDLOOP.
*-Pass the color field information to layout
layout-info_fieldname = 'COLOR'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = layout
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_flight
EXCEPTIONS
program_error = 1.
Sunday, June 7, 2009
Important tables in FI
Financial Accounting tables
BKPF Accounting Document Header
BSEG Accounting Document Segment
BSID Accounting: Secondary Index for Customers
BSAD Accounting: Secondary Index for Customers (Cleared Items)
BSIK Accounting: Secondary Index for Vendors
BSAK Accounting: Secondary Index for Vendors (Cleared Items)
BSIP Index for Vendor Validation
BVOR Inter Company Posting Procedure
FRUN Run Date of a Program
KNB4 Customer Payment History
KNB5 Customer Master Dunning Data
KNBK Customer Master Bank Details
KNC1 Customer Master Transaction Figures
KNC3 Customer Master Special GL Transactions Figures
LFB5 Vendor Master Dunning Data
LFBK Vendor Master Bank Details
LFC1 Vendor Master Transaction Figures
LFC3 Vendor Master Special GL Transactions
KNB1 Customer Master (Company Code)
LFA1 Vendor Master (General Section)
LFB1 Vendor Master (company Code Section)
SKA1 G/L Account Master (Chart of Accounts)
SKAT G/L Account Master (Chart of Accounts Description)
BKPF Accounting Document Header
BSEG Accounting Document Segment
BSID Accounting: Secondary Index for Customers
BSAD Accounting: Secondary Index for Customers (Cleared Items)
BSIK Accounting: Secondary Index for Vendors
BSAK Accounting: Secondary Index for Vendors (Cleared Items)
BSIP Index for Vendor Validation
BVOR Inter Company Posting Procedure
FRUN Run Date of a Program
KNB4 Customer Payment History
KNB5 Customer Master Dunning Data
KNBK Customer Master Bank Details
KNC1 Customer Master Transaction Figures
KNC3 Customer Master Special GL Transactions Figures
LFB5 Vendor Master Dunning Data
LFBK Vendor Master Bank Details
LFC1 Vendor Master Transaction Figures
LFC3 Vendor Master Special GL Transactions
KNB1 Customer Master (Company Code)
LFA1 Vendor Master (General Section)
LFB1 Vendor Master (company Code Section)
SKA1 G/L Account Master (Chart of Accounts)
SKAT G/L Account Master (Chart of Accounts Description)
Important tables in PP
Production Planning Tables
STKO BOM Header
STPO BOM Positions (detail)
MAPL Assignment fo Task Lists to Materials
PLKO Routing Group Header
PLSO Routing Group Sequence
PLPO Routing Group Operations
AFKO Production Order Header
AFPO Production Order Position (details)
STKO BOM Header
STPO BOM Positions (detail)
MAPL Assignment fo Task Lists to Materials
PLKO Routing Group Header
PLSO Routing Group Sequence
PLPO Routing Group Operations
AFKO Production Order Header
AFPO Production Order Position (details)
Important tables in MM
Materials Management Tables
EINA Purchasing Info Record- General Data
EINE Purchasing Info Record- Purchasing Organization Data
MAKT Material Descriptions
MARA General Material Data
MARC Plant Data for Material
MARD Storage Location Data for Material
MAST Material to BOM Link
MBEW Material Valuation
MKPF Header- Material Document
MSEG Document Segment- Material
MVER Material Consumption
MVKE Sales Data for materials
RKPF Document Header- Reservation
T023 Mat. groups
T024 Purchasing Groups
T156 Movement Type
T157H Help Texts for Movement Types
Purchasing TablesA501 Plant/Material
EBAN Purchase Requisition
EBKN Purchase Requisition Account Assignment
EKAB Release Documentation
EKBE History per Purchasing Document
EKET Scheduling Agreement Schedule Lines
EKKN Account Assignment in Purchasing Document
EKKO Purchasing Document Header
EKPO Purchasing Document Item
IKPF Header- Physical Inventory Document
ISEG Physical Inventory Document Items
LFA1 Vendor Master (General section)
LFB1 Vendor Master (Company Code)
NRIV Number range intervals
RESB Reservation/dependent requirements
T161T Texts for Purchasing Document Types
EINA Purchasing Info Record- General Data
EINE Purchasing Info Record- Purchasing Organization Data
MAKT Material Descriptions
MARA General Material Data
MARC Plant Data for Material
MARD Storage Location Data for Material
MAST Material to BOM Link
MBEW Material Valuation
MKPF Header- Material Document
MSEG Document Segment- Material
MVER Material Consumption
MVKE Sales Data for materials
RKPF Document Header- Reservation
T023 Mat. groups
T024 Purchasing Groups
T156 Movement Type
T157H Help Texts for Movement Types
Purchasing TablesA501 Plant/Material
EBAN Purchase Requisition
EBKN Purchase Requisition Account Assignment
EKAB Release Documentation
EKBE History per Purchasing Document
EKET Scheduling Agreement Schedule Lines
EKKN Account Assignment in Purchasing Document
EKKO Purchasing Document Header
EKPO Purchasing Document Item
IKPF Header- Physical Inventory Document
ISEG Physical Inventory Document Items
LFA1 Vendor Master (General section)
LFB1 Vendor Master (Company Code)
NRIV Number range intervals
RESB Reservation/dependent requirements
T161T Texts for Purchasing Document Types
Important tables in SD
Sales and Distribution Tables
KONV Conditions for Transaction Data
KONP Conditions for Items
LIKP Delivery Header Data
LIPS Delivery: Item data
VBAK Sales Document: Header Data
VBAP Sales Document: Item Data
VBBE Sales Requirements: Individual Records
VBEH Schedule line history
VBEP Sales Document: Schedule Line Data
VBFA Sales Document Flow
VBLB Sales document: Release order data
VBLK SD Document: Delivery Note Header
VBPA Sales Document: Partner
VBRK Billing: Header Data
VBRP Billing: Item Data
VBUK Sales Document: Header Status and Administrative Data
VBUP Sales Document: Item Status
VEKP Handling Unit - Header Table
VEPO Packing: Handling Unit Item (Contents)
VEPVG Delivery Due Index
KONV Conditions for Transaction Data
KONP Conditions for Items
LIKP Delivery Header Data
LIPS Delivery: Item data
VBAK Sales Document: Header Data
VBAP Sales Document: Item Data
VBBE Sales Requirements: Individual Records
VBEH Schedule line history
VBEP Sales Document: Schedule Line Data
VBFA Sales Document Flow
VBLB Sales document: Release order data
VBLK SD Document: Delivery Note Header
VBPA Sales Document: Partner
VBRK Billing: Header Data
VBRP Billing: Item Data
VBUK Sales Document: Header Status and Administrative Data
VBUP Sales Document: Item Status
VEKP Handling Unit - Header Table
VEPO Packing: Handling Unit Item (Contents)
VEPVG Delivery Due Index
Reports
Reports:
A report is an executable program which takes some input, fetches the relevant data, processes it and gives some output.
There are 7 types of reports. They are:
1. Interactive reports
2. Classic reports
3. Logical database reports
4. Alv reports
5. Graphic reports.
6. ABAP query
7. Report writer.
1. Classical Reports
In classic reports, we can see the output in single list where as in interactive reports we can see the output in multiple lists.
These are the simplest reports. Programmers learn this one first. It is just an output of data using the Write statement inside a loop.
• Classical reports are normal reports. These reports are not having any sub reports. IT IS HAVING ONLY ONE SCREEN/LIST FOR OUTPUT.
Events In Classical Reports.
• INTIALIZATION: This event triggers before selection screen display.
• AT-SELECTION-SCREEN: This event triggers after processing user input still selection screen is in active mode.
• START OF SELECTION: Start of selection screen triggers after processing selection screen.
• END-OF-SELECTION: It is for Logical Database Reporting.
2. Interactive Reports
As the name suggests, the user can Interact with the report. We can have a drill down into the report data. For example, Column one of the report displays the material numbers, and the user feels that he needs some more specific data about the vendor for that material, he can HIDE that data under those material numbers.
And when the user clicks the material number, another report (actually sub report/secondary list) which displays the vendor details will be displayed.
We can have a basic list (number starts from 0) and 20 secondary lists (1 to 21).
Events associated with Interactive Reports are:
1. AT LINE-SELECTION
2. AT USER-COMMAND
3. AT PF
4. TOP-OF-PAGE DURING LINE-SELECTION.
HIDE statement holds the data to be displayed in the secondary list.
sy-lisel: contains data of the selected line.
sy-lsind : contains the level of report (from 0 to 21)
Interactive Report Events:
• AT LINE-SELECTION : This Event triggers when we double click a line on the list, when the event is triggered a new sublist is going to be generated. Under this event what ever the statements that are been return will be displayed on newly generated sublist.
• AT PFn: For predefined function keys...
• AT USER-COMMAND : It provides user functions keys.
• TOP-OF-PAGE DURING LINE-SELECTION :top of page event for secondary list.
3.Logical Database Reports
Logical database is another tool for ABAP reports. Using LDB we can provide extra features for ABAP reports.
While using LDB there is no need for us to declare Parameters.
Selection-screen as they will be generated automatically.
We have to use the statement NODES in ABAP report.
If there are many tables the Performance will be slow as all the table data will be read from top node to bottom node .
4. Alv reports
ALV means ABAP List Viewer.
ALV is available in two modes: list and grid. List mode is good old list processing with standard functionalities, and grid mode is using a new OCX object displaying grids
ALV LIST- the commonly used ALV functions are
1.REUSE_ALV_VARIANT_DEFAULT_GET
2.REUSE_ALV_VARIANT_F4
3.REUSE_ALV_VARIANT_EXISTENCE
4.REUSE_ALV_EVENTS_GET
5.REUSE_ALV_COMMENTARY_WRITE
6.REUSE_ALV_FIELDCATALOG_MERGE
7.REUSE_ALV_LIST_DISPLAY
8.REUSE_ALV_POPUP_TO_SELECT
5) Graphical reports
Graphical -- Redirecting sap data into Business graphics
Here by using
Graph_2D, Graph_3D function modules we can get the 2D and 3D graphical reports.
6. ABAP Query Reports
ABAP query is another tool for ABAP. It provides efficency for ABAP reports. These reports are very accurate.
Transaction Code : SQ01
Report Writer
Key Concept :
Super users and end users can use Report Painter/Report Writer tools to write their own reports.
Giving them the ability to report on additional fields at their discretion shifts the report maintenance burden to them, saving SAP support groups time and effort normally spent creating and maintaining the reports.
Instead of using ABAP code to write a report in FI and CO, many users build a Report Painter/ Report Writer library using transaction MC27.
However, this workaround has some drawbacks. Little known transaction GRCT solves these problems in most cases, and eliminates the need to use transaction MC27.
7. report painter / report writer
You use the Report Painter to create reports from data in the Special Purpose Ledger (FI-SL) application component and other SAP application components to meet your specific reporting requirements.
Many reporting requirements can be met using the standard reports provided by various SAP application components. However, if your reporting requirements are not fulfilled by SAP’s standard reports, you can use the Report Painter to quickly and easily define your own reports.
The Special Purpose Ledger (FI-SL) application component does not provide any standard Report Painter reports because you must first install your FI-SL system setup (database tables and so on) to meet your specific business requirements.
Advantages of the Report Painter include:
• Easy and flexible report definition
• Report definition without using sets
• Direct layout control
In addition to the Report painter, you can use the Report Writer to define reports. You use the Report Writer to create reports from data in the Special Purpose Ledger (FI-SL) application component and other SAP application components to meet your specific reporting requirements.
The Report Writer is a tool using which you can define reports.
Many reporting requirements can be met using the standard reports provided by various SAP application components. However, if your reporting requirements are not fulfilled by SAP's standard reports, you can also define complex reports using the Report Writer.
With the Report Writer, you can organize reports to meet the specific needs of your enterprise. The Report Writer uses reporting building blocks, such as sets, which can be used in any report.
ABAP Report Types
ABAP report types are those ones available in some report's attributes screen, i.e. :
• Executable program
• Function group (containing function modules)
• Include
• Interface pool
• Class pool
• Module pool
• Subroutine pool
A report is an executable program which takes some input, fetches the relevant data, processes it and gives some output.
There are 7 types of reports. They are:
1. Interactive reports
2. Classic reports
3. Logical database reports
4. Alv reports
5. Graphic reports.
6. ABAP query
7. Report writer.
1. Classical Reports
In classic reports, we can see the output in single list where as in interactive reports we can see the output in multiple lists.
These are the simplest reports. Programmers learn this one first. It is just an output of data using the Write statement inside a loop.
• Classical reports are normal reports. These reports are not having any sub reports. IT IS HAVING ONLY ONE SCREEN/LIST FOR OUTPUT.
Events In Classical Reports.
• INTIALIZATION: This event triggers before selection screen display.
• AT-SELECTION-SCREEN: This event triggers after processing user input still selection screen is in active mode.
• START OF SELECTION: Start of selection screen triggers after processing selection screen.
• END-OF-SELECTION: It is for Logical Database Reporting.
2. Interactive Reports
As the name suggests, the user can Interact with the report. We can have a drill down into the report data. For example, Column one of the report displays the material numbers, and the user feels that he needs some more specific data about the vendor for that material, he can HIDE that data under those material numbers.
And when the user clicks the material number, another report (actually sub report/secondary list) which displays the vendor details will be displayed.
We can have a basic list (number starts from 0) and 20 secondary lists (1 to 21).
Events associated with Interactive Reports are:
1. AT LINE-SELECTION
2. AT USER-COMMAND
3. AT PF
4. TOP-OF-PAGE DURING LINE-SELECTION.
HIDE statement holds the data to be displayed in the secondary list.
sy-lisel: contains data of the selected line.
sy-lsind : contains the level of report (from 0 to 21)
Interactive Report Events:
• AT LINE-SELECTION : This Event triggers when we double click a line on the list, when the event is triggered a new sublist is going to be generated. Under this event what ever the statements that are been return will be displayed on newly generated sublist.
• AT PFn: For predefined function keys...
• AT USER-COMMAND : It provides user functions keys.
• TOP-OF-PAGE DURING LINE-SELECTION :top of page event for secondary list.
3.Logical Database Reports
Logical database is another tool for ABAP reports. Using LDB we can provide extra features for ABAP reports.
While using LDB there is no need for us to declare Parameters.
Selection-screen as they will be generated automatically.
We have to use the statement NODES in ABAP report.
If there are many tables the Performance will be slow as all the table data will be read from top node to bottom node .
4. Alv reports
ALV means ABAP List Viewer.
ALV is available in two modes: list and grid. List mode is good old list processing with standard functionalities, and grid mode is using a new OCX object displaying grids
ALV LIST- the commonly used ALV functions are
1.REUSE_ALV_VARIANT_DEFAULT_GET
2.REUSE_ALV_VARIANT_F4
3.REUSE_ALV_VARIANT_EXISTENCE
4.REUSE_ALV_EVENTS_GET
5.REUSE_ALV_COMMENTARY_WRITE
6.REUSE_ALV_FIELDCATALOG_MERGE
7.REUSE_ALV_LIST_DISPLAY
8.REUSE_ALV_POPUP_TO_SELECT
5) Graphical reports
Graphical -- Redirecting sap data into Business graphics
Here by using
Graph_2D, Graph_3D function modules we can get the 2D and 3D graphical reports.
6. ABAP Query Reports
ABAP query is another tool for ABAP. It provides efficency for ABAP reports. These reports are very accurate.
Transaction Code : SQ01
Report Writer
Key Concept :
Super users and end users can use Report Painter/Report Writer tools to write their own reports.
Giving them the ability to report on additional fields at their discretion shifts the report maintenance burden to them, saving SAP support groups time and effort normally spent creating and maintaining the reports.
Instead of using ABAP code to write a report in FI and CO, many users build a Report Painter/ Report Writer library using transaction MC27.
However, this workaround has some drawbacks. Little known transaction GRCT solves these problems in most cases, and eliminates the need to use transaction MC27.
7. report painter / report writer
You use the Report Painter to create reports from data in the Special Purpose Ledger (FI-SL) application component and other SAP application components to meet your specific reporting requirements.
Many reporting requirements can be met using the standard reports provided by various SAP application components. However, if your reporting requirements are not fulfilled by SAP’s standard reports, you can use the Report Painter to quickly and easily define your own reports.
The Special Purpose Ledger (FI-SL) application component does not provide any standard Report Painter reports because you must first install your FI-SL system setup (database tables and so on) to meet your specific business requirements.
Advantages of the Report Painter include:
• Easy and flexible report definition
• Report definition without using sets
• Direct layout control
In addition to the Report painter, you can use the Report Writer to define reports. You use the Report Writer to create reports from data in the Special Purpose Ledger (FI-SL) application component and other SAP application components to meet your specific reporting requirements.
The Report Writer is a tool using which you can define reports.
Many reporting requirements can be met using the standard reports provided by various SAP application components. However, if your reporting requirements are not fulfilled by SAP's standard reports, you can also define complex reports using the Report Writer.
With the Report Writer, you can organize reports to meet the specific needs of your enterprise. The Report Writer uses reporting building blocks, such as sets, which can be used in any report.
ABAP Report Types
ABAP report types are those ones available in some report's attributes screen, i.e. :
• Executable program
• Function group (containing function modules)
• Include
• Interface pool
• Class pool
• Module pool
• Subroutine pool
Wednesday, May 20, 2009
BAPI
A Business Application Programming Interface (BAPI) is a precisely defined interface providing access to processes and data in business application systems such as R/3.
BAPIs are defined as API methods of SAP business object types. These business object types and their BAPIs are described and stored in the Business Object Repository (BOR). A BAPI is implemented as a function module, that is stored and described in the Function Builder.
As of Release 4.5A BAPIs can also describe interfaces, implemented outside the R/3 System that can be called in external systems by R/3 Systems. These BAPIs are known as BAPIs used for outbound processing. The target system is determined for the BAPI call in the distribution model of Application Link Enabling (ALE).
BAPIs used for outbound processing are defined in the Business Object Repository (BOR) as API methods of SAP Interface Types. Functions implemented outside the R/3 System can be standardized and made available as BAPIs. For further information see BAPIs Used For Outbound Processing.
BAPIs can be called within the R/3 System from external application systems and other programs. BAPIs are the communication standard for business applications. BAPI interface technology forms the basis for the following developments:
· Connecting:
· New R/3 components, for example, Advanced Planner and Optimizer (APO) and Business Information Warehouse (BW).
· Non-SAP software
· Legacy systems
· Isolating components within the R/3 System in the context of Business Framework
· Distributed R/3 scenarios with asynchronous connections using Application Link Enabling (ALE)
· Connecting R/3 Systems to the Internet using Internet Application Components (IACs)
· PC programs as front-end to the R/3 System, for example, Visual Basic (Microsoft) or Visual Age for Java (IBM).
· Workflow applications that extend beyond system boundaries
· Customers' and partners' own developments
BAPIs are defined as API methods of SAP business object types. These business object types and their BAPIs are described and stored in the Business Object Repository (BOR). A BAPI is implemented as a function module, that is stored and described in the Function Builder.
As of Release 4.5A BAPIs can also describe interfaces, implemented outside the R/3 System that can be called in external systems by R/3 Systems. These BAPIs are known as BAPIs used for outbound processing. The target system is determined for the BAPI call in the distribution model of Application Link Enabling (ALE).
BAPIs used for outbound processing are defined in the Business Object Repository (BOR) as API methods of SAP Interface Types. Functions implemented outside the R/3 System can be standardized and made available as BAPIs. For further information see BAPIs Used For Outbound Processing.
BAPIs can be called within the R/3 System from external application systems and other programs. BAPIs are the communication standard for business applications. BAPI interface technology forms the basis for the following developments:
· Connecting:
· New R/3 components, for example, Advanced Planner and Optimizer (APO) and Business Information Warehouse (BW).
· Non-SAP software
· Legacy systems
· Isolating components within the R/3 System in the context of Business Framework
· Distributed R/3 scenarios with asynchronous connections using Application Link Enabling (ALE)
· Connecting R/3 Systems to the Internet using Internet Application Components (IACs)
· PC programs as front-end to the R/3 System, for example, Visual Basic (Microsoft) or Visual Age for Java (IBM).
· Workflow applications that extend beyond system boundaries
· Customers' and partners' own developments
ALE
Application Link Enabling (ALE) is a set of business processes and tools that allow applications on different computer systems to be linked. This can be done between different SAP systems as well as between SAP and non-SAP systems.
In a single SAP system different applications are integrated via a single database (e.g. finance, sales, production, human resources). However, many companies do not have just one integrated system but a distributed environment with different applications running on different systems. To run the whole business in such an environment the distributed applications have to be linked. This can be done through Application Link Enabling (ALE).
ALE provides distributed business processes that can be used to link the applications on different platforms. There are some ALE business processes delivered in the standard SAP system. Furthermore, there are tools that can be used to change the existing ALE business processes or to implement new distributed business processes.
Besides the business processes there are special ALE services that are required to set up and control a distributed environment. These services include a distribution model, business object synchronization and tools for monitoring or error handling. ALE is a major part of SAP's Business Framework Architecture. Besides the basis middleware, that provides the communication between components, and the interfaces (BAPIs), ALE business processes and ALE services enable the cooperation of the single components within the framework. That makes ALE the glue of the Business Framework
Different types of views
Views:
A view is a logical view on one or more tables, that is, a view is not actually physically stored, instead being derived from one or more other tables.
Types:
Database views
The view defined in the ABAP Dictionary is reproduced in the underlying database. You can use both ABAP Open SQL and ABAP Native SQL to access such views from ABAP programs, but you can only define them using transparent tables. If you define a database view using only one table, you can make changes to the view. For database views containing several tables, however, only read accesses are allowed.
Projection views
Projection views are used to suppress certain fields from a table in the interests of minimizing interfaces. A projection view can only refer to one table and, in contrast to database views, you cannot specify any restrictions with regard to table type. This view type also permits both read and write accesses with ABAP Open SQL.
Help views
Help views are used as the selection method of elementary search helps if the selection is too complex to be defined with a single database table. In contrast to database views, help views implement an outer join. For this reason they are suitable for linking supplementary information such as explanatory text from secondary tables. If the supplementary information were missing in an inner join, the entire dataset would not be selected.
Maintenance views
Maintenance views provide you with a business view of the data. You can change it either with the table maintenance transaction SM30, which allows you to maintain data from the base tables in a view at the same time, or with the customizing transaction. The mechanisms for data maintenance such as screens and processing programs can be created with a special transaction (SE54).
A view is a logical view on one or more tables, that is, a view is not actually physically stored, instead being derived from one or more other tables.
Types:
Database views
The view defined in the ABAP Dictionary is reproduced in the underlying database. You can use both ABAP Open SQL and ABAP Native SQL to access such views from ABAP programs, but you can only define them using transparent tables. If you define a database view using only one table, you can make changes to the view. For database views containing several tables, however, only read accesses are allowed.
Projection views
Projection views are used to suppress certain fields from a table in the interests of minimizing interfaces. A projection view can only refer to one table and, in contrast to database views, you cannot specify any restrictions with regard to table type. This view type also permits both read and write accesses with ABAP Open SQL.
Help views
Help views are used as the selection method of elementary search helps if the selection is too complex to be defined with a single database table. In contrast to database views, help views implement an outer join. For this reason they are suitable for linking supplementary information such as explanatory text from secondary tables. If the supplementary information were missing in an inner join, the entire dataset would not be selected.
Maintenance views
Maintenance views provide you with a business view of the data. You can change it either with the table maintenance transaction SM30, which allows you to maintain data from the base tables in a view at the same time, or with the customizing transaction. The mechanisms for data maintenance such as screens and processing programs can be created with a special transaction (SE54).
Types of tables in Data Dictionary
Transparent table
There is a physical table on the database for each transparent table. The names of the physical tables and the logical table definition in the ABAP/4 Dictionary correspond.
All business data and application data are stored in transparent tables.
On the other hand, pooled tables and cluster tables are not created in the database. The data of these tables is stored in the corresponding table pool or table cluster. It is not necessary to create indexes and technical settings for pooled and cluster tables.
Pooled table
Pooled tables can be used to store control data (e.g. screen sequences, program parameters or temporary data). Several pooled tables can be combined to form a table pool. The table pool corresponds to a physical table on the database in which all the records of the allocated pooled tables are stored.
Cluster table
Cluster tables contain continuous text, for example, documentation. Several cluster tables can be combined to form a table cluster. Several logical lines of different tables are combined to form a physical record in this table type. This permits object-by-object storage or object-by-object access. In order to combine tables in clusters, at least parts of the keys must agree. Several cluster tables are stored in one corresponding table on the database.
There is a physical table on the database for each transparent table. The names of the physical tables and the logical table definition in the ABAP/4 Dictionary correspond.
All business data and application data are stored in transparent tables.
On the other hand, pooled tables and cluster tables are not created in the database. The data of these tables is stored in the corresponding table pool or table cluster. It is not necessary to create indexes and technical settings for pooled and cluster tables.
Pooled table
Pooled tables can be used to store control data (e.g. screen sequences, program parameters or temporary data). Several pooled tables can be combined to form a table pool. The table pool corresponds to a physical table on the database in which all the records of the allocated pooled tables are stored.
Cluster table
Cluster tables contain continuous text, for example, documentation. Several cluster tables can be combined to form a table cluster. Several logical lines of different tables are combined to form a physical record in this table type. This permits object-by-object storage or object-by-object access. In order to combine tables in clusters, at least parts of the keys must agree. Several cluster tables are stored in one corresponding table on the database.
How to Debug a Sap Script ?
They are two ways to debug the SAP Script.
1. Use Tools - Word Processing - Layout Set (SE71). Enter name of layout set and then Utilities - Activate Debugger. It is of no consequence which layout set you enter when selecting the SAP script debugger. (Menu path: Tools-Word processing - Forms, Utilities - Activate Debugger) The next layout set called will invoke the debugger.
2. Another way to set the SAP Script debugger is to run program RSTXDBUG.
When you debug Print program it is same as you debug any other ABAP program. While when you debug SAP Script, you actually debug the code ( scripting) you have written SAP Script Form.In transaction SMARTFORMS look up the name of the generated function module for your smart form. Copy the name and go to transaction SE37. Get into the source code of the function module; via menu Go to -> Main Program and then find your piece of code by SEARCH 'VBELN1 = GS_HD_REF-ORDER_NUMB'. Put a breakpoint there and print your smart form. It will stop at the breakpoint.Script: In SE71 give your form name and in Utilities-->Active debugger.Then put a break point in your print program where ever you want to stop it.After that you need to go to your transaction like VF03/../..Etc for Invoice you need to execute it by giving Output type. Then it will debug step by step .
1. Use Tools - Word Processing - Layout Set (SE71). Enter name of layout set and then Utilities - Activate Debugger. It is of no consequence which layout set you enter when selecting the SAP script debugger. (Menu path: Tools-Word processing - Forms, Utilities - Activate Debugger) The next layout set called will invoke the debugger.
2. Another way to set the SAP Script debugger is to run program RSTXDBUG.
When you debug Print program it is same as you debug any other ABAP program. While when you debug SAP Script, you actually debug the code ( scripting) you have written SAP Script Form.In transaction SMARTFORMS look up the name of the generated function module for your smart form. Copy the name and go to transaction SE37. Get into the source code of the function module; via menu Go to -> Main Program and then find your piece of code by SEARCH 'VBELN1 = GS_HD_REF-ORDER_NUMB'. Put a breakpoint there and print your smart form. It will stop at the breakpoint.Script: In SE71 give your form name and in Utilities-->Active debugger.Then put a break point in your print program where ever you want to stop it.After that you need to go to your transaction like VF03/../..Etc for Invoice you need to execute it by giving Output type. Then it will debug step by step .
Wednesday, October 8, 2008
Program to count lines of abap code
*&---------------------------------------------------------------------*
*& Report ZCOUNT_ABAPCODE *
*&---------------------------------------------------------------------*
*& *
*&---------------------------------------------------------------------*
REPORT ZCOUNT_ABAPCODE .
tables: trdir.
types: begin of ty_proginfo,
program type programm,
counter type i,
empty type i,
comment type i,
source type i,
end of ty_proginfo.
data: st_proginfo type ty_proginfo,
it_proginfo type table of ty_proginfo,
st_progline type ty_proginfo.
field-symbols:
select-options: so_progr for trdir-name.
select name from trdir into table it_proginfo
where name in so_progr.
loop at it_proginfo assigning
perform count_program changing
add:
endloop.
write:/ 'Programs', 20 st_proginfo-counter,
/ 'Empty lines', 20 st_proginfo-empty,
/ 'Comment lines', 20 st_proginfo-comment,
/ 'Source lines', 20 st_proginfo-source.
*&---------------------------------------------------------------------*
*& Form count_program
*&---------------------------------------------------------------------*
FORM count_program USING p_proginfo TYPE ty_proginfo.
data: abaptab type standard table of string,
abaplin type string.
read report p_proginfo-program into abaptab.
check sy-subrc = 0.
add 1 to p_proginfo-counter.
loop at abaptab into abaplin.
if abaplin is initial.
add 1 to p_proginfo-empty.
elseif abaplin(1) = '*'.
add 1 to p_proginfo-comment.
else.
add 1 to p_proginfo-source.
endif.
endloop.
ENDFORM. " count_program
Friday, August 22, 2008
Steps to create custom infotype
1) Go to Transaction PM01.
2) Enter the custom Infotype number which you want to create (Should be a 4 digit number, start with 9).
3) Select the 'Employee Infotype' radio button.
4) Select the 'PS Structure Infotype'.
5) Click on Create... A separate table maintenance window appears...
6) Create a PS structure with all the fields you want on the Infotype
7) Save and Activate the PS structure
8) Go back to the initial screen of PM01.
9) Click on 'All' push button. It takes a few moments.
10) Click on 'Technical Characteristics'. Infotype list screen appears
11) Click on 'Change'(pencil) button
12) Select your Infotype and click on 'Detail' (magnifying glass) button
13) Give 'T591A' as subtype table
14) Give 'T591S' as subtype txt tab
15) Give your subtype field as subtype field
16) Save and come back to PM01 initial screen
17) Click on 'Infotype Characteristics' ... Infotype list screen appears
18) Click on 'Change' (pencil) button
19) Click on 'New Entries'
20) Enter your Infotype number and short text
21) Here we have to set different Infotype Characteristics as per the requirement. (Better open another session with some standard Infotype's infotype characteristics screen and use as the reference to fill yours)
22) Save your entries.
23) Now the Infotype is created and ready to use.
24) If you want to change the layout of the Infotype as per your requirement...
25) In the PM01 initial screen...Select 'Screen' radio button and give 2000 as the screen name, then click on edit.
26) In the next screen.. Select 'Layout Editor' and click 'Change'.
27) Screen default layout appears...here you can design/modify the screen..change the attributes of the fields..etc.
28) Save and activate. (Don't forget to 'Activate at every level)
2) Enter the custom Infotype number which you want to create (Should be a 4 digit number, start with 9).
3) Select the 'Employee Infotype' radio button.
4) Select the 'PS Structure Infotype'.
5) Click on Create... A separate table maintenance window appears...
6) Create a PS structure with all the fields you want on the Infotype
7) Save and Activate the PS structure
8) Go back to the initial screen of PM01.
9) Click on 'All' push button. It takes a few moments.
10) Click on 'Technical Characteristics'. Infotype list screen appears
11) Click on 'Change'(pencil) button
12) Select your Infotype and click on 'Detail' (magnifying glass) button
13) Give 'T591A' as subtype table
14) Give 'T591S' as subtype txt tab
15) Give your subtype field as subtype field
16) Save and come back to PM01 initial screen
17) Click on 'Infotype Characteristics' ... Infotype list screen appears
18) Click on 'Change' (pencil) button
19) Click on 'New Entries'
20) Enter your Infotype number and short text
21) Here we have to set different Infotype Characteristics as per the requirement. (Better open another session with some standard Infotype's infotype characteristics screen and use as the reference to fill yours)
22) Save your entries.
23) Now the Infotype is created and ready to use.
24) If you want to change the layout of the Infotype as per your requirement...
25) In the PM01 initial screen...Select 'Screen' radio button and give 2000 as the screen name, then click on edit.
26) In the next screen.. Select 'Layout Editor' and click 'Change'.
27) Screen default layout appears...here you can design/modify the screen..change the attributes of the fields..etc.
28) Save and activate. (Don't forget to 'Activate at every level)
Monday, August 18, 2008
Enhance standard infotypes in HR
1. Go to transaction PM01 and press tab ‘Enhance Standard Infotypes’:
2. Enter the Infotype to be enhanced and press ‘Create’.If the Infotype is enhanced earlier, it will throw an error ‘Structure already exists’Press ‘Edit’ in this case.
3. Add fields to be displayed on the Infotype screen to structure CI_PXXXX (Where XXXX is Infotype Number).
4. Save and activate the CI include.
5. Press ‘back’ to go to first screen of transaction PM01.
6. Enter ‘Include screen’ number and press ‘Create All ’.
6. Press ‘Assign Enhancement’.
7. For module pool MPXXXX00, and a screen of Infotype to be modified, assign program ZPXXXX00 and screen specified in PM01.
E.g: For infotype 0006, screen 2037 is to be modified.
8. Go to transaction SE80, in program ZPXXXX00, the screen created with added fields can be seen in screen painter. Modify the screen if required. This screen will be seen in transaction PA30 along with standard screen of that infotype.
9. Processing logic for these added fields can be written in PBO and PAI of this screen. (The data of standard Infotype screen will be present in this program ZPXXXX00 automatically)
2. Enter the Infotype to be enhanced and press ‘Create’.If the Infotype is enhanced earlier, it will throw an error ‘Structure already exists’Press ‘Edit’ in this case.
3. Add fields to be displayed on the Infotype screen to structure CI_PXXXX (Where XXXX is Infotype Number).
4. Save and activate the CI include.
5. Press ‘back’ to go to first screen of transaction PM01.
6. Enter ‘Include screen’ number and press ‘Create All ’.
6. Press ‘Assign Enhancement’.
7. For module pool MPXXXX00, and a screen of Infotype to be modified, assign program ZPXXXX00 and screen specified in PM01.
E.g: For infotype 0006, screen 2037 is to be modified.
8. Go to transaction SE80, in program ZPXXXX00, the screen created with added fields can be seen in screen painter. Modify the screen if required. This screen will be seen in transaction PA30 along with standard screen of that infotype.
9. Processing logic for these added fields can be written in PBO and PAI of this screen. (The data of standard Infotype screen will be present in this program ZPXXXX00 automatically)
Tuesday, May 27, 2008
Sample BDC program for Material master creation in MM01
REPORT zgm_bdc_mm01 NO STANDARD PAGE HEADING LINE-SIZE 255.
TYPES : BEGIN OF ty_mat,
mbrsh(1) TYPE c,
mtart(4) TYPE c,
maktx(40) TYPE c,
meins(3) TYPE c,
matkl(9) TYPE c,
END OF ty_mat.
DATA: it_mat TYPE STANDARD TABLE OF ty_mat,
wa_mat TYPE ty_mat.
DATA: it_bdcdata TYPE STANDARD TABLE OF bdcdata,
wa_bdcdata TYPE bdcdata.
DATA: wa_opt TYPE ctu_params.
DATA : filename TYPE string.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_file TYPE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
wa_opt-nobinpt = 'X'.
wa_opt-updmode = 'A'.
*upload data form presentation server to internal table
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_file.
START-OF-SELECTION.
filename = p_file.
IF filename IS NOT INITIAL.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filename
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = it_mat
* CHANGING
* ISSCANPERFORMED = ' '
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
END-OF-SELECTION.
LOOP AT it_mat INTO wa_mat.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMMG1-MTART'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'RMMG1-MBRSH'
wa_mat-mbrsh.
PERFORM bdc_field USING 'RMMG1-MTART'
wa_mat-mtart.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(02)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)'
'X'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(02)'
'X'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
wa_mat-maktx.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARA-MATKL'.
PERFORM bdc_field USING 'MARA-MEINS'
wa_mat-meins.
PERFORM bdc_field USING 'MARA-MATKL'
wa_mat-matkl.
PERFORM bdc_field USING 'MARA-MTPOS_MARA'
'NORM'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MAKT-MAKTX'.
PERFORM bdc_field USING 'MAKT-MAKTX'
wa_mat-maktx.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.
CALL TRANSACTION 'MM01' USING it_bdcdata OPTIONS FROM wa_opt.
CLEAR wa_mat.
REFRESH it_bdcdata.
ENDLOOP.
*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
CLEAR wa_bdcdata.
wa_bdcdata-program = program.
wa_bdcdata-dynpro = dynpro.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.
ENDFORM.
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = fnam.
wa_bdcdata-fval = fval.
APPEND wa_bdcdata TO it_bdcdata.
ENDFORM.
Monday, April 14, 2008
Program to find exits and badi for a transaction
REPORT Z_USEREXITBADIFIND .
TABLES : TSTC,
TADIR,
MODSAPT,
MODACT,
TRDIR,
TFDIR,
ENLFDIR,
SXS_ATTRT ,
TSTCT.
DATA : JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.
DATA : FIELD1(30).
DATA : V_DEVCLASS LIKE TADIR-DEVCLASS.
PARAMETERS : P_TCODE LIKE TSTC-TCODE,
P_PGMNA LIKE TSTC-PGMNA .
DATA WA_TADIR TYPE TADIR.
START-OF-SELECTION.
IF NOT P_TCODE IS INITIAL.
SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.
ELSEIF NOT P_PGMNA IS INITIAL.
TSTC-PGMNA = P_PGMNA.
ENDIF.
IF SY-SUBRC EQ 0.
SELECT SINGLE * FROM TADIR
WHERE PGMID = 'R3TR'
AND OBJECT = 'PROG'
AND OBJ_NAME = TSTC-PGMNA.
MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
IF SY-SUBRC NE 0.
SELECT SINGLE * FROM TRDIR
WHERE NAME = TSTC-PGMNA.
IF TRDIR-SUBC EQ 'F'.
SELECT SINGLE * FROM TFDIR
WHERE PNAME = TSTC-PGMNA.
SELECT SINGLE * FROM ENLFDIR
WHERE FUNCNAME = TFDIR-FUNCNAME.
SELECT SINGLE * FROM TADIR
WHERE PGMID = 'R3TR'
AND OBJECT = 'FUGR'
AND OBJ_NAME EQ ENLFDIR-AREA.
MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
ENDIF.
ENDIF.
SELECT * FROM TADIR INTO TABLE JTAB
WHERE PGMID = 'R3TR'
AND OBJECT IN ('SMOD', 'SXSD')
AND DEVCLASS = V_DEVCLASS.
SELECT SINGLE * FROM TSTCT
WHERE SPRSL EQ SY-LANGU
AND TCODE EQ P_TCODE.
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) 'Transaction Code - ',
20(20) P_TCODE,
45(50) TSTCT-TTEXT.
SKIP.
IF NOT JTAB[] IS INITIAL.
WRITE:/(105) SY-ULINE.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
* SORTING THE INTERNAL TABLE
SORT JTAB BY OBJECT.
DATA : WF_TXT(60) TYPE C,
WF_SMOD TYPE I ,
WF_BADI TYPE I ,
WF_OBJECT2(30) TYPE C.
CLEAR : WF_SMOD, WF_BADI , WF_OBJECT2.
*GET THE TOTAL SMOD.
LOOP AT JTAB INTO WA_TADIR.
AT FIRST.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 SY-VLINE,
2 'Enhancement/ Business Add-in',
41 SY-VLINE ,
42 'Description',
105 SY-VLINE.
WRITE:/(105) SY-ULINE.
ENDAT.
CLEAR WF_TXT.
AT NEW OBJECT.
IF WA_TADIR-OBJECT = 'SMOD'.
WF_OBJECT2 = 'Enhancement' .
ELSEIF WA_TADIR-OBJECT = 'SXSD'.
WF_OBJECT2 = ' Business Add-in'.
ENDIF.
FORMAT COLOR COL_GROUP INTENSIFIED ON.
WRITE:/1 SY-VLINE,
2 WF_OBJECT2,
105 SY-VLINE.
ENDAT.
CASE WA_TADIR-OBJECT.
WHEN 'SMOD'.
WF_SMOD = WF_SMOD + 1.
SELECT SINGLE MODTEXT INTO WF_TXT
FROM MODSAPT
WHERE SPRSL = SY-LANGU
AND NAME = WA_TADIR-OBJ_NAME.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WHEN 'SXSD'.
* FOR BADIS
WF_BADI = WF_BADI + 1 .
SELECT SINGLE TEXT INTO WF_TXT
FROM SXS_ATTRT
WHERE SPRSL = SY-LANGU
AND EXIT_NAME = WA_TADIR-OBJ_NAME.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
ENDCASE.
WRITE:/1 SY-VLINE,
2 WA_TADIR-OBJ_NAME HOTSPOT ON,
41 SY-VLINE ,
42 WF_TXT,
105 SY-VLINE.
AT END OF OBJECT.
WRITE : /(105) SY-ULINE.
ENDAT.
ENDLOOP.
WRITE:/(105) SY-ULINE.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No.of Exits:' , WF_SMOD.
WRITE:/ 'No.of BADis:' , WF_BADI.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(105) 'No userexits or BADis exist'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(105) 'Transaction does not exist'.
ENDIF.
AT LINE-SELECTION.
DATA : WF_OBJECT TYPE TADIR-OBJECT.
CLEAR WF_OBJECT.
GET CURSOR FIELD FIELD1.
CHECK FIELD1(8) EQ 'WA_TADIR'.
READ TABLE JTAB WITH KEY OBJ_NAME = SY-LISEL+1(20).
MOVE JTAB-OBJECT TO WF_OBJECT.
CASE WF_OBJECT.
WHEN 'SMOD'.
SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
WHEN 'SXSD'.
SET PARAMETER ID 'EXN' FIELD SY-LISEL+1(20).
CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
ENDCASE.
TABLES : TSTC,
TADIR,
MODSAPT,
MODACT,
TRDIR,
TFDIR,
ENLFDIR,
SXS_ATTRT ,
TSTCT.
DATA : JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.
DATA : FIELD1(30).
DATA : V_DEVCLASS LIKE TADIR-DEVCLASS.
PARAMETERS : P_TCODE LIKE TSTC-TCODE,
P_PGMNA LIKE TSTC-PGMNA .
DATA WA_TADIR TYPE TADIR.
START-OF-SELECTION.
IF NOT P_TCODE IS INITIAL.
SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.
ELSEIF NOT P_PGMNA IS INITIAL.
TSTC-PGMNA = P_PGMNA.
ENDIF.
IF SY-SUBRC EQ 0.
SELECT SINGLE * FROM TADIR
WHERE PGMID = 'R3TR'
AND OBJECT = 'PROG'
AND OBJ_NAME = TSTC-PGMNA.
MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
IF SY-SUBRC NE 0.
SELECT SINGLE * FROM TRDIR
WHERE NAME = TSTC-PGMNA.
IF TRDIR-SUBC EQ 'F'.
SELECT SINGLE * FROM TFDIR
WHERE PNAME = TSTC-PGMNA.
SELECT SINGLE * FROM ENLFDIR
WHERE FUNCNAME = TFDIR-FUNCNAME.
SELECT SINGLE * FROM TADIR
WHERE PGMID = 'R3TR'
AND OBJECT = 'FUGR'
AND OBJ_NAME EQ ENLFDIR-AREA.
MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
ENDIF.
ENDIF.
SELECT * FROM TADIR INTO TABLE JTAB
WHERE PGMID = 'R3TR'
AND OBJECT IN ('SMOD', 'SXSD')
AND DEVCLASS = V_DEVCLASS.
SELECT SINGLE * FROM TSTCT
WHERE SPRSL EQ SY-LANGU
AND TCODE EQ P_TCODE.
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) 'Transaction Code - ',
20(20) P_TCODE,
45(50) TSTCT-TTEXT.
SKIP.
IF NOT JTAB[] IS INITIAL.
WRITE:/(105) SY-ULINE.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
* SORTING THE INTERNAL TABLE
SORT JTAB BY OBJECT.
DATA : WF_TXT(60) TYPE C,
WF_SMOD TYPE I ,
WF_BADI TYPE I ,
WF_OBJECT2(30) TYPE C.
CLEAR : WF_SMOD, WF_BADI , WF_OBJECT2.
*GET THE TOTAL SMOD.
LOOP AT JTAB INTO WA_TADIR.
AT FIRST.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 SY-VLINE,
2 'Enhancement/ Business Add-in',
41 SY-VLINE ,
42 'Description',
105 SY-VLINE.
WRITE:/(105) SY-ULINE.
ENDAT.
CLEAR WF_TXT.
AT NEW OBJECT.
IF WA_TADIR-OBJECT = 'SMOD'.
WF_OBJECT2 = 'Enhancement' .
ELSEIF WA_TADIR-OBJECT = 'SXSD'.
WF_OBJECT2 = ' Business Add-in'.
ENDIF.
FORMAT COLOR COL_GROUP INTENSIFIED ON.
WRITE:/1 SY-VLINE,
2 WF_OBJECT2,
105 SY-VLINE.
ENDAT.
CASE WA_TADIR-OBJECT.
WHEN 'SMOD'.
WF_SMOD = WF_SMOD + 1.
SELECT SINGLE MODTEXT INTO WF_TXT
FROM MODSAPT
WHERE SPRSL = SY-LANGU
AND NAME = WA_TADIR-OBJ_NAME.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WHEN 'SXSD'.
* FOR BADIS
WF_BADI = WF_BADI + 1 .
SELECT SINGLE TEXT INTO WF_TXT
FROM SXS_ATTRT
WHERE SPRSL = SY-LANGU
AND EXIT_NAME = WA_TADIR-OBJ_NAME.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
ENDCASE.
WRITE:/1 SY-VLINE,
2 WA_TADIR-OBJ_NAME HOTSPOT ON,
41 SY-VLINE ,
42 WF_TXT,
105 SY-VLINE.
AT END OF OBJECT.
WRITE : /(105) SY-ULINE.
ENDAT.
ENDLOOP.
WRITE:/(105) SY-ULINE.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No.of Exits:' , WF_SMOD.
WRITE:/ 'No.of BADis:' , WF_BADI.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(105) 'No userexits or BADis exist'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(105) 'Transaction does not exist'.
ENDIF.
AT LINE-SELECTION.
DATA : WF_OBJECT TYPE TADIR-OBJECT.
CLEAR WF_OBJECT.
GET CURSOR FIELD FIELD1.
CHECK FIELD1(8) EQ 'WA_TADIR'.
READ TABLE JTAB WITH KEY OBJ_NAME = SY-LISEL+1(20).
MOVE JTAB-OBJECT TO WF_OBJECT.
CASE WF_OBJECT.
WHEN 'SMOD'.
SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
WHEN 'SXSD'.
SET PARAMETER ID 'EXN' FIELD SY-LISEL+1(20).
CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
ENDCASE.
Tuesday, March 11, 2008
Important Concepts in ABAP
| Reports | Classical, Interactive, ALV |
| Module Pool Programing | 4 Events - PAI, PBO, POH, POV |
| Bdc | Session method, Call transaction method, Direct input method |
| Bapi | Business objects , Function modules |
| Lsmw | 4 Methods - Direct input, Batch input, Business object, Idoc |
| Scripts | Forms ( start_form,open_form) , windows ( main,variable) |
| Smartforms | User friendly compared to Scripts |
| Exits | 4 Types - screen , menu, field, function module exits |
| Badi | Can have multiple Implementations |
| Workflow | Tasks, Rules, Events |
| Ale/Idoc | 5 Methods - Master data,Change pointers,Extensions,Reductions,Filtering |
| Custom Infotypes | Enhance standard , Create custom |
| BTE | Restrict standard FI transactions and default values |
| Function modules | Modularization, Remote calls |
| Data dictionary | Tables,Views,Data types,Type groups,Domain,Data element, Search help,Lock objects |
Monday, February 25, 2008
Sample ALV program to display Purchase order data
*&---------------------------------------------------------------------*
*& Report ZMM_PURCHASE_ORDER
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zmm_purchase_order2.
TABLES: ekko,ekpo.
TYPES: BEGIN OF gty_ekko,
ebeln TYPE ekko-ebeln,
bukrs TYPE ekko-bukrs,
bstyp TYPE ekko-bstyp,
bsart TYPE ekko-bsart,
lifnr TYPE ekko-lifnr,
ekorg TYPE ekko-ekorg,
ekgrp TYPE ekko-ekgrp,
waers TYPE ekko-waers,
kunnr TYPE ekko-kunnr,
END OF gty_ekko.
TYPES: BEGIN OF gty_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
loekz TYPE ekpo-loekz,
matnr TYPE ekpo-matnr,
bukrs TYPE ekpo-bukrs,
werks TYPE ekpo-werks,
lgort TYPE ekpo-lgort,
matkl TYPE ekpo-matkl,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
netwr TYPE ekpo-netwr,
mwskz TYPE ekpo-mwskz,
END OF gty_ekpo.
TYPES: BEGIN OF gty_final,
ebeln TYPE ekko-ebeln,
bukrs TYPE ekko-bukrs,
bstyp TYPE ekko-bstyp,
bsart TYPE ekko-bsart,
lifnr TYPE ekko-lifnr,
ekorg TYPE ekko-ekorg,
ekgrp TYPE ekko-ekgrp,
waers TYPE ekko-waers,
kunnr TYPE ekko-kunnr,
ebelp TYPE ekpo-ebelp,
loekz TYPE ekpo-loekz,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
lgort TYPE ekpo-lgort,
matkl TYPE ekpo-matkl,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
netwr TYPE ekpo-netwr,
mwskz TYPE ekpo-mwskz,
END OF gty_final.
DATA: gt_ekko TYPE STANDARD TABLE OF gty_ekko,
gt_ekpo TYPE STANDARD TABLE OF gty_ekpo,
gt_final TYPE STANDARD TABLE OF gty_final.
DATA: gtt_ekko TYPE gty_ekko,
gtt_ekpo TYPE gty_ekpo,
gtt_final TYPE gty_final.
DATA: g_repid TYPE sy-repid,
gt_fieldcatalog TYPE slis_t_fieldcat_alv ,
gtt_fieldcatalog TYPE slis_fieldcat_alv,
gt_layout TYPE slis_layout_alv ,
gt_fieldcatalog2 TYPE slis_t_fieldcat_alv ,
gtt_fieldcatalog2 TYPE slis_fieldcat_alv,
gt_layout2 TYPE slis_layout_alv ,
gt_fieldcatalog3 TYPE slis_t_fieldcat_alv ,
gtt_fieldcatalog3 TYPE slis_fieldcat_alv,
gt_layout3 TYPE slis_layout_alv ,
gt_print TYPE slis_print_alv,
gt_sort TYPE slis_t_sortinfo_alv ,
gt_filter TYPE slis_t_filter_alv,
gt_sp_group TYPE slis_t_sp_group_alv,
gt_alv_graphics TYPE dtc_t_tc,
gt_excluding TYPE slis_t_extab ,
gt_events TYPE slis_t_event ,
gt_variant TYPE disvariant,
gt_variant2 TYPE disvariant,
gt_variant3 TYPE disvariant,
g_var2 TYPE i,
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_status TYPE slis_formname VALUE 'SET_PF_STATUS'.
* selection screen
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECTION-SCREEN:SKIP 1.
SELECT-OPTIONS: s_ebeln FOR ekko-ebeln OBLIGATORY, " Po number
s_bukrs FOR ekko-bukrs, " company code
s_aedat FOR ekko-aedat. " creation date
SELECTION-SCREEN:SKIP 1.
SELECTION-SCREEN: END OF BLOCK b1.
INITIALIZATION.
* do nothing
START-OF-SELECTION.
* fetch the data from tables
PERFORM select_data.
END-OF-SELECTION.
* display the data using smartform
PERFORM display_data.
*&---------------------------------------------------------------------*
*& Form SELECT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- nbsp="" p2="" p="" text="">*----------------------------------------------------------------------*
FORM select_data .
SELECT ebeln
bukrs
bstyp
bsart
lifnr
ekorg
ekgrp
waers
kunnr FROM ekko INTO TABLE gt_ekko
WHERE ebeln IN s_ebeln
AND bukrs IN s_bukrs
AND bstyp = 'F'
AND aedat IN s_aedat.
IF sy-subrc = 0.
SELECT ebeln
ebelp
loekz
matnr
bukrs
werks
lgort
matkl
menge
meins
netpr
netwr
mwskz FROM ekpo INTO TABLE gt_ekpo
FOR ALL ENTRIES IN gt_ekko
WHERE ebeln = gt_ekko-ebeln
AND bukrs = gt_ekko-bukrs.
IF sy-subrc = 0.
* do nothing
ENDIF.
ENDIF.
LOOP AT gt_ekpo INTO gtt_ekpo.
CLEAR gtt_final.
gtt_final-ebeln = gtt_ekpo-ebeln.
gtt_final-ebelp = gtt_ekpo-ebelp.
gtt_final-loekz = gtt_ekpo-loekz.
gtt_final-matnr = gtt_ekpo-matnr.
gtt_final-bukrs = gtt_ekpo-bukrs.
gtt_final-werks = gtt_ekpo-werks.
gtt_final-lgort = gtt_ekpo-lgort.
gtt_final-matkl = gtt_ekpo-matkl.
gtt_final-menge = gtt_ekpo-menge.
gtt_final-meins = gtt_ekpo-ebeln.
gtt_final-netpr = gtt_ekpo-netpr.
gtt_final-netwr = gtt_ekpo-netwr.
gtt_final-mwskz = gtt_ekpo-mwskz.
CLEAR gtt_ekko.
READ TABLE gt_ekko INTO gtt_ekko WITH KEY ebeln = gtt_ekpo-ebeln.
IF sy-subrc = 0.
gtt_final-bstyp = gtt_ekko-bstyp.
gtt_final-bsart = gtt_ekko-bsart.
gtt_final-lifnr = gtt_ekko-lifnr.
gtt_final-ekorg = gtt_ekko-ekorg.
gtt_final-ekgrp = gtt_ekko-ekgrp.
gtt_final-waers = gtt_ekko-waers.
gtt_final-kunnr = gtt_ekko-kunnr.
ENDIF.
APPEND gtt_final TO gt_final.
ENDLOOP.
ENDFORM. " SELECT_DATA
*&---------------------------------------------------------------------*
*& Form DISPLAY_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- nbsp="" p2="" p="" text="">*----------------------------------------------------------------------*
FORM display_data .
set PF-STATUS 'ZSTATUS'.
REFRESH gt_fieldcatalog.
g_repid = sy-repid.
gtt_fieldcatalog-fieldname = 'EBELN'.
gtt_fieldcatalog-seltext_m = 'Po number'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 12.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'EBELP'.
gtt_fieldcatalog-seltext_m = 'Item no'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 8.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'BUKRS'.
gtt_fieldcatalog-seltext_m = 'Comp code'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 10.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'MATNR'.
gtt_fieldcatalog-seltext_m = 'Material'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 18.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'NETPR'.
gtt_fieldcatalog-seltext_m = 'Price'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 8.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'WAERS'.
gtt_fieldcatalog-seltext_m = 'Currency'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 8.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'MEINS'.
gtt_fieldcatalog-seltext_m = 'Unit'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 8.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'WERKS'.
gtt_fieldcatalog-seltext_m = 'Plant'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 8.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'EKGRP'.
gtt_fieldcatalog-seltext_m = 'Pur group'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 8.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'LIFNR'.
gtt_fieldcatalog-seltext_m = 'Vendor'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 10.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'KUNNR'.
gtt_fieldcatalog-seltext_m = 'Customer'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 10.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
* i_callback_pf_status_set = ' '
* i_callback_user_command = g_user_command
is_layout = gt_layout
it_fieldcat = gt_fieldcatalog[]
* it_special_groups = gt_sp_group[]
it_sort = gt_sort[]
it_filter = gt_filter[]
i_save = 'A'
* is_variant = gt_variant
it_events = gt_events[]
* is_print = gt_print
* it_alv_graphics = gt_alv_graphics[]
* it_excluding = gt_excluding
TABLES
t_outtab = gt_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " DISPLAY_DATA-->-->
*& Report ZMM_PURCHASE_ORDER
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zmm_purchase_order2.
TABLES: ekko,ekpo.
TYPES: BEGIN OF gty_ekko,
ebeln TYPE ekko-ebeln,
bukrs TYPE ekko-bukrs,
bstyp TYPE ekko-bstyp,
bsart TYPE ekko-bsart,
lifnr TYPE ekko-lifnr,
ekorg TYPE ekko-ekorg,
ekgrp TYPE ekko-ekgrp,
waers TYPE ekko-waers,
kunnr TYPE ekko-kunnr,
END OF gty_ekko.
TYPES: BEGIN OF gty_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
loekz TYPE ekpo-loekz,
matnr TYPE ekpo-matnr,
bukrs TYPE ekpo-bukrs,
werks TYPE ekpo-werks,
lgort TYPE ekpo-lgort,
matkl TYPE ekpo-matkl,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
netwr TYPE ekpo-netwr,
mwskz TYPE ekpo-mwskz,
END OF gty_ekpo.
TYPES: BEGIN OF gty_final,
ebeln TYPE ekko-ebeln,
bukrs TYPE ekko-bukrs,
bstyp TYPE ekko-bstyp,
bsart TYPE ekko-bsart,
lifnr TYPE ekko-lifnr,
ekorg TYPE ekko-ekorg,
ekgrp TYPE ekko-ekgrp,
waers TYPE ekko-waers,
kunnr TYPE ekko-kunnr,
ebelp TYPE ekpo-ebelp,
loekz TYPE ekpo-loekz,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
lgort TYPE ekpo-lgort,
matkl TYPE ekpo-matkl,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
netwr TYPE ekpo-netwr,
mwskz TYPE ekpo-mwskz,
END OF gty_final.
DATA: gt_ekko TYPE STANDARD TABLE OF gty_ekko,
gt_ekpo TYPE STANDARD TABLE OF gty_ekpo,
gt_final TYPE STANDARD TABLE OF gty_final.
DATA: gtt_ekko TYPE gty_ekko,
gtt_ekpo TYPE gty_ekpo,
gtt_final TYPE gty_final.
DATA: g_repid TYPE sy-repid,
gt_fieldcatalog TYPE slis_t_fieldcat_alv ,
gtt_fieldcatalog TYPE slis_fieldcat_alv,
gt_layout TYPE slis_layout_alv ,
gt_fieldcatalog2 TYPE slis_t_fieldcat_alv ,
gtt_fieldcatalog2 TYPE slis_fieldcat_alv,
gt_layout2 TYPE slis_layout_alv ,
gt_fieldcatalog3 TYPE slis_t_fieldcat_alv ,
gtt_fieldcatalog3 TYPE slis_fieldcat_alv,
gt_layout3 TYPE slis_layout_alv ,
gt_print TYPE slis_print_alv,
gt_sort TYPE slis_t_sortinfo_alv ,
gt_filter TYPE slis_t_filter_alv,
gt_sp_group TYPE slis_t_sp_group_alv,
gt_alv_graphics TYPE dtc_t_tc,
gt_excluding TYPE slis_t_extab ,
gt_events TYPE slis_t_event ,
gt_variant TYPE disvariant,
gt_variant2 TYPE disvariant,
gt_variant3 TYPE disvariant,
g_var2 TYPE i,
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_status TYPE slis_formname VALUE 'SET_PF_STATUS'.
* selection screen
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECTION-SCREEN:SKIP 1.
SELECT-OPTIONS: s_ebeln FOR ekko-ebeln OBLIGATORY, " Po number
s_bukrs FOR ekko-bukrs, " company code
s_aedat FOR ekko-aedat. " creation date
SELECTION-SCREEN:SKIP 1.
SELECTION-SCREEN: END OF BLOCK b1.
INITIALIZATION.
* do nothing
START-OF-SELECTION.
* fetch the data from tables
PERFORM select_data.
END-OF-SELECTION.
* display the data using smartform
PERFORM display_data.
*&---------------------------------------------------------------------*
*& Form SELECT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- nbsp="" p2="" p="" text="">*----------------------------------------------------------------------*
FORM select_data .
SELECT ebeln
bukrs
bstyp
bsart
lifnr
ekorg
ekgrp
waers
kunnr FROM ekko INTO TABLE gt_ekko
WHERE ebeln IN s_ebeln
AND bukrs IN s_bukrs
AND bstyp = 'F'
AND aedat IN s_aedat.
IF sy-subrc = 0.
SELECT ebeln
ebelp
loekz
matnr
bukrs
werks
lgort
matkl
menge
meins
netpr
netwr
mwskz FROM ekpo INTO TABLE gt_ekpo
FOR ALL ENTRIES IN gt_ekko
WHERE ebeln = gt_ekko-ebeln
AND bukrs = gt_ekko-bukrs.
IF sy-subrc = 0.
* do nothing
ENDIF.
ENDIF.
LOOP AT gt_ekpo INTO gtt_ekpo.
CLEAR gtt_final.
gtt_final-ebeln = gtt_ekpo-ebeln.
gtt_final-ebelp = gtt_ekpo-ebelp.
gtt_final-loekz = gtt_ekpo-loekz.
gtt_final-matnr = gtt_ekpo-matnr.
gtt_final-bukrs = gtt_ekpo-bukrs.
gtt_final-werks = gtt_ekpo-werks.
gtt_final-lgort = gtt_ekpo-lgort.
gtt_final-matkl = gtt_ekpo-matkl.
gtt_final-menge = gtt_ekpo-menge.
gtt_final-meins = gtt_ekpo-ebeln.
gtt_final-netpr = gtt_ekpo-netpr.
gtt_final-netwr = gtt_ekpo-netwr.
gtt_final-mwskz = gtt_ekpo-mwskz.
CLEAR gtt_ekko.
READ TABLE gt_ekko INTO gtt_ekko WITH KEY ebeln = gtt_ekpo-ebeln.
IF sy-subrc = 0.
gtt_final-bstyp = gtt_ekko-bstyp.
gtt_final-bsart = gtt_ekko-bsart.
gtt_final-lifnr = gtt_ekko-lifnr.
gtt_final-ekorg = gtt_ekko-ekorg.
gtt_final-ekgrp = gtt_ekko-ekgrp.
gtt_final-waers = gtt_ekko-waers.
gtt_final-kunnr = gtt_ekko-kunnr.
ENDIF.
APPEND gtt_final TO gt_final.
ENDLOOP.
ENDFORM. " SELECT_DATA
*&---------------------------------------------------------------------*
*& Form DISPLAY_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- nbsp="" p2="" p="" text="">*----------------------------------------------------------------------*
FORM display_data .
set PF-STATUS 'ZSTATUS'.
REFRESH gt_fieldcatalog.
g_repid = sy-repid.
gtt_fieldcatalog-fieldname = 'EBELN'.
gtt_fieldcatalog-seltext_m = 'Po number'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 12.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'EBELP'.
gtt_fieldcatalog-seltext_m = 'Item no'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 8.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'BUKRS'.
gtt_fieldcatalog-seltext_m = 'Comp code'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 10.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'MATNR'.
gtt_fieldcatalog-seltext_m = 'Material'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 18.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'NETPR'.
gtt_fieldcatalog-seltext_m = 'Price'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 8.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'WAERS'.
gtt_fieldcatalog-seltext_m = 'Currency'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 8.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'MEINS'.
gtt_fieldcatalog-seltext_m = 'Unit'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 8.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'WERKS'.
gtt_fieldcatalog-seltext_m = 'Plant'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 8.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'EKGRP'.
gtt_fieldcatalog-seltext_m = 'Pur group'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 8.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'LIFNR'.
gtt_fieldcatalog-seltext_m = 'Vendor'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 10.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
gtt_fieldcatalog-fieldname = 'KUNNR'.
gtt_fieldcatalog-seltext_m = 'Customer'.
gtt_fieldcatalog-col_pos = g_var2 + 1.
gtt_fieldcatalog-outputlen = 10.
APPEND gtt_fieldcatalog TO gt_fieldcatalog.
CLEAR gtt_fieldcatalog.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
* i_callback_pf_status_set = ' '
* i_callback_user_command = g_user_command
is_layout = gt_layout
it_fieldcat = gt_fieldcatalog[]
* it_special_groups = gt_sp_group[]
it_sort = gt_sort[]
it_filter = gt_filter[]
i_save = 'A'
* is_variant = gt_variant
it_events = gt_events[]
* is_print = gt_print
* it_alv_graphics = gt_alv_graphics[]
* it_excluding = gt_excluding
TABLES
t_outtab = gt_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " DISPLAY_DATA-->-->
Subscribe to:
Posts (Atom)