Showing posts with label ABAP REPORTS SAMPLE CODES. Show all posts
Showing posts with label ABAP REPORTS SAMPLE CODES. Show all posts

ABAP ALV Hirarchical Report Sample Code in sap programming

ABAP programming report for alv hierarchical report in sample code gives you a real time report that tells you in detail with example coding how to write the abap programming report.









&---------------------------------------------------------------------
*& Report Z_HIERARCHIAL_ALV *
*& *
&---------------------------------------------------------------------
*& *
*& *
&---------------------------------------------------------------------

REPORT ZGDEMO_HIERARCHIAL_ALV_9AM .
TYPE-POOLS SLIS.
DATA : IT_EKKO TYPE TABLE OF EKKO,
IT_EKPO TYPE TABLE OF EKPO.

DATA WA_KEYINFO TYPE SLIS_KEYINFO_ALV.

****************************************
  • START-OF-SELECTION. *
****************************************
START-OF-SELECTION.
PERFORM READ_DATA.

PERFORM FILL_KEYINFO.

PERFORM DISPLAY_DATA.

&---------------------------------------------------------------------
*& Form READ_DATA
&---------------------------------------------------------------------
form READ_DATA .

SELECT * INTO TABLE IT_EKKO FROM EKKO UP TO 20 ROWS.

IF NOT IT_EKKO IS INITIAL.
SELECT * INTO TABLE IT_EKPO FROM EKPO
FOR ALL ENTRIES
IN IT_EKKO
WHERE EBELN = IT_EKKO-EBELN.
ENDIF.

endform. " READ_DATA

&---------------------------------------------------------------------
*& Form FILL_KEYINFO
&---------------------------------------------------------------------
  • text
----------------------------------------------------------------------
form FILL_KEYINFO .
WA_KEYINFO-HEADER01 = 'EBELN'.
WA_KEYINFO-ITEM01 = 'EBELN'.
WA_KEYINFO-ITEM02 = 'EBELP'.
endform. " FILL_KEYINFO
&---------------------------------------------------------------------
*& Form DISPLAY_DATA
&---------------------------------------------------------------------
  • text
----------------------------------------------------------------------
  • --> p1 text
  • <-- li="li" p2="p2" text="text">
----------------------------------------------------------------------
form DISPLAY_DATA .
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
  • I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = SY-REPID
  • I_CALLBACK_PF_STATUS_SET = ' '
  • I_CALLBACK_USER_COMMAND = ' '
  • IS_LAYOUT =
  • IT_FIELDCAT =
  • IT_EXCLUDING =
  • IT_SPECIAL_GROUPS =
  • IT_SORT =
  • IT_FILTER =
  • IS_SEL_HIDE =
  • I_SCREEN_START_COLUMN = 0
  • I_SCREEN_START_LINE = 0
  • I_SCREEN_END_COLUMN = 0
  • I_SCREEN_END_LINE = 0
  • I_DEFAULT = 'X'
  • I_SAVE = ' '
  • IS_VARIANT =
  • IT_EVENTS =
  • IT_EVENT_EXIT =
i_tabname_header = 'IT_EKKO'
i_tabname_item = 'IT_EKPO'
I_STRUCTURE_NAME_HEADER = 'EKKO'
I_STRUCTURE_NAME_ITEM = 'EKPO'
is_keyinfo = WA_KEYINFO
  • IS_PRINT =
  • IS_REPREP_ID =
  • I_BYPASSING_BUFFER =
  • I_BUFFER_ACTIVE =
  • IMPORTING
  • E_EXIT_CAUSED_BY_CALLER =
  • ES_EXIT_CAUSED_BY_USER =
tables
t_outtab_header = IT_EKKO
t_outtab_item = IT_EKPO
  • 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

Related Posts:

SAP ABAP HR report for EEOC
ABAP Programming hr new hire report
SAP ABAP HR PAYROLL REPORT
ABAP HR head count report for sap
SAP ABAP FICO REPORT FOR GROUP CURRENCY RECONCILIATION
fico reconcilation report for company code currency report

 SAP ABAP FICO report about profitability analysis
SAP ABAP fico report profitability analysis report
 My sapcrm customers and consumer segmentation
Organizational challenges in crm and mysap solutions
Business View and Mysap.com
What is SAP R/3 introduction to mysap.com
SAP FICO cross company code reconciliation report
sap sales and distribution back orders report in abap

sales in erp programming invoice report
sap abap programming in mm module report about purchase order
abap programming sample report for materiel documents
sap programming report with oops concept

SAP abap mm module report with screen shots in erp programming

ABAP Programming report lets you view the stock of a material across all organizational levels. Within a company, individuals at various levels use this report to assess the stock situation of a material. The stock overview can be displayed in two formats:

1. The basic list gives you an overview of a material’s stock at all existing organizational levels (depending on your selection criteria).

2. The detail list gives you an overview of a material’s stock at a specified—and the next lower—organizational level (depending on your selection criteria).

Depending on the stock type, a number of display versions exist for both lists. The system administrator normally determines which stocks appear in which columns, as well as the order in which these columns are displayed.

This report enables you to view the inventory breakdown for a material at all organizational levels:

  1. Client codes
  2. Company codes
  3. Plants
  4. Storage locations
  5. Batches
You must enter the material number before you run this report. To narrow your search, we suggest using additional selection criteria.

The selection screen of this report includes:

  1. Variants
  2. Dynamic selection options
  3. User variables
  4. Execution (and print) in background
To access the first screen for this report, choose Logistics → Materials management →
Inventory management → Environment → Stock → Stock overview.

1. Enter 103-100 in Material. Accept all defaults on this screen. This will produce a stock overview report for the material across all plants and storage locations.
2. Choose Execute.

This screen shows the entire inventory for material 103-100 across all plants, regardless of company code. In this example, the report includes both Germany (company code 1000) and the United States (company code 3000).

3. Double click on a specific line (for example, storage location 0088) to drill down to a lower level of detail. This screen shows detailed information for storage location 0088.

Related Posts:

SAP ABAP HR report for EEOC
ABAP Programming hr new hire report
SAP ABAP HR PAYROLL REPORT
ABAP HR head count report for sap


sales in erp programming invoice report

SAP Sales and Distribution Incoming Order abap report

SAP Sales and Distribution report for incoming order abap report provides information on incoming orders. Not every manager within a company requires the same level of information on incoming orders. For example, a monthly summary of incoming orders (organized by sales office or customer) may be adequate for a senior executive, but a line manager may want to see a daily summary of the same data, perhaps listed by material. In this instance, the Incoming Order Report meets the unique information needs of both users.

Information systems reports, such as Incoming orders, are part of the Logistics Information System. The data reported is stored in special tables called information structures, which are separated from transaction levels. This allows much faster reporting and minimizes the impact on performance. The Sales Information System is part of the Logistics Information System.

Additionally, hundreds of end-user reporting functions in standard analyses and flexible analyses offer a range of options to analyze the information of incoming orders. The reporting data is updated at the information structures S001-S004 and S006 when an incoming order item is created or changed. Deleted orders are removed, but rejected orders are retained in the information structures.

Creating company specific information structures and update rules lets you specify different ways of collecting and reporting order data.

To run this abap report, use one of the following access options:

1.Logistics → Sales and distribution → Sales information system → Standard analyses →
Customer|Material|Sales organization|Sales employee|Sales office

2.In the Command field, enter transaction (see table below) and choose Enter. Choose one of the following options:

MCTA Customer
MCTC Material
MCTE Sales organization
MCTI Sales employee
MCTG Sales office

3.Choose System → Services → Reporting and enter RMCV0100 in the Program field.
Then, choose Execute to run the report.
You must use Period to analyze selection criteria to run this report. You should limit the selection criteria to reduce the run time for the report.

You can view other reports (such as open orders, returned orders, and invoiced sales) with the SIS end-user functions of standard or flexible analyses. In standard analyses, a search/jump function lets you jump to the customer or material master records. In flexible analyses, the report-to-report interface lets you jump to the customer or material master records.

The selection screen of this report includes:

Variants
Dynamic selection options
User settings for report drilldown, default key figures, and other reporting parameters
Execution

The output of this report includes:
Listing order header, order item, and order schedule item data
Selection of documents for individual display (double-click on one of the individual document line items)
Dynamic filtering of output (by column) after the program has been executed (to narrow down the displayed results): Position the cursor on a column, then choose Edit → Set filter (Ctrl+Shift+F2)
Sorting capability (by column): Select a column, then choose Edit → Sort in ascending/descending order (Ctrl+Shift+F5/F4)
Summation by column: Select a column, then choose Edit → Add up values (Shift+F7) column width optimization: Select a column, then choose Settings → Columns → Optimize width
Data statistics for the output: Choose Settings → List status (Ctrl+F11)

This sap abap report contains data that is statistically summarized. Based on your system’s configuration, this data is updated online by sales events or periodically by batch programs. This data cannot be manipulated.

When running the report in LIS/SIS (standard analyses), choose Logistics → Sales and distribution → Sales information system → Standard analyses.

Under Standard analyses, choose one of the following options:


To access the first screen for this report, choose Logistics → Sales and distribution → Sales information system → Standard analyses → Customer.

1. Under Characteristics, enter 1000 in Sales organization.
2. Under Period to analyze, enter a date range (for example, 06/1998 to 08/1998) in Month. A period is determined by the date an ordered item is changed or deleted.
3. Choose Execute.

Related Posts:

SAP ABAP HR report for EEOC
ABAP Programming hr new hire report
SAP ABAP HR PAYROLL REPORT
ABAP HR head count report for sap
SAP ABAP FICO REPORT FOR GROUP CURRENCY RECONCILIATION
fico reconcilation report for company code currency report

SAP ABAP HR programming report sample for EEOC

SAP ABAP HR programming report about EEO 1 report deals with compiling the EEO-1 data that US employers need to file every year with the Equal Employment Opportunity Commission (EEOC). The resulting statistic is formatted in accordance with the standards for computerized output prescribed by the EEOC. Section G (Certification) is omitted, since multi establishment employers are required to file the certified consolidated report on the original EEO-1 form.

This report only runs for employees who have a valid organizational assignment infotype 0001, including assignment to a personnel area/subarea and job. Employees must also have a valid additional personal data infotype 0077, including assignment of ethnic origin, and veteran status.
In addition, you must maintain the following system tables:

T5U0P: Every personnel area subarea has to be maintained. The following country-specific fields—with country modifier 10 (US)—must be completed:

REPUN: Reporting organizational unit
COIND: Company ID
EEOHQ: Headquarters indicator (checkbox). Must be checked ONLY for headquarters unit.
SICNO: Standard industry code (T5USC)
EINUM: INS employer ID
DANDB: Dun & Bradstreet ID

T5U13—Jobs: Country-specific field for country modifier 10 (US). For each job, the field EEOCT - EEO job category must be maintained. Standard EEO job categories are delivered.
All EEO categories must be entered into feature EEOCT, which converts job categories to the row numbers (01 to 09) in the EEO-1 report. Features may be accessed using transaction PE03.

T5UAD: For every reporting unit, an address should be created.
T5URU - EEO unit number for each reporting unit should be then created. For each EEO unit number, an address has to be assigned.

T5U0E - EEO Record: This report uses this table in several ways. The table provides:

Previously reported totals per reporting unit
Settings (that is, section C and E) for the current report
Totals for the current period (if needed)
T505R - Ethnic origin: If table T505R is modified or extended to allow additional ethnic categories, feature EEOCL (transaction PE03) must be modified to reflect those changes. Feature EEOCL yields the EEO employee category based on ethnic origin and gender.

Depending on when you run the report, you will need to consider special requirements concerning totals previously reported to the government.

. Running the report for the first time: For the period that provides the previous reported total, a record needs to be created for EACH reporting unit in T5U0E. This record should contain the totals per employee category and, preferably, the indicators for the questions in sections B and C reported for that period.

2. Running the report in subsequent periods: If the indicators for section B and C have not changed, it is not necessary to create the records for the current periods, since the report will read the indicators from the previous period. If the indicators have changed, a new record for the current period, containing the correct settings must be manually created. If desired, the report will update table T5U0E with the totals for the current period when the report is run.

Choose PA_UPDAT to create or modify the entry per reporting unit in table T5U0E .

EEOCT (Feature): Depending on the value used in table T5U13 (field EEOCT), this feature must be modified to yield the correct row number for each EEO category.

This report includes:

  1. Variants
  2. Execution (and print) in background
  3. Standard selection fields available
  4. Additional selection fields via the Further Selections or Matchcodes buttons
  5. Data output formatted in accordance with the standards for computerized output prescribed by the EEOC.
To run this abap report

choose System → Services → Reporting and enter RPSEEOU1 in the Program field. Then,
choose Execute to run the report.

1. Under Period, enter 06/01/1998 to 06/30/1998 in Other period and Person selection period.
2. Under Selection, enter 300 in Personnel area and 0001 in personnel subarea to limit the selection of employees.
3. Enter +3+ in Status 1/status 2/status 3 (employment status) to include only active employees.
4. Under Additional data, enter 00 1996 in Previous period. This determines the period from which the previously reported totals are read.
5. Enter 06 1996 in Current period.

This determines the period from which the indicators for sections C and E are read.

6. Choose Execute.

Related Posts:

ABAP Programming hr new hire report
SAP ABAP HR PAYROLL REPORT
ABAP HR head count report for sap
SAP ABAP FICO REPORT FOR GROUP CURRENCY RECONCILIATION
fico reconcilation report for company code currency report
SAP ABAP FICO report about profitability analysis
SAP ABAP fico report profitability analysis report My sapcrm customers and consumer segmentation
Organizational challenges in crm and mysap solutions
Business View and Mysap.com
What is SAP R/3 introduction to mysap.comSAP FICO cross company code reconciliation report

SAP FICO Profitability Analysis Plan and Actual Comparion

SAP FICO and in particular controlling wing ABAP report provides a contribution margin for divisions and products. Both actual and planned data list for the contribution margin, and a variance calculates for each value in it. This report summarizes revenues and contributions, and can do an in depth analysis of the margin for specific divisions or products.

A product line manager would use this report to monitor the performance of specific divisions and products and to identify the “bottom-line” impact of revenues and costs. Two features of this report, exception reporting and ranking, help to quickly identify both exceptional and marginal performers so that a product line manager can take immediate action to improve product performance.

You must set the Operating concern (but only when you first login). Choose Accounting → Controlling → Profitability analysis → Environment → Set operating concern. For the examples in this section, the operating concern is set to IDEA using cost-based profitability analysis.

All reports in profitability analysis are user-defined. This means you must configure and generate the operating concern before creating any reports and determine the rows, columns, variables, and general format by using drill down reporting (forms and reports).

Due to the configuration of this report, you must enter all selection options (that is, period range and fiscal year).

The profitability analysis line items which list are context sensitive. For example, when you position the cursor on a cell for a line item, only the reports that contain that line item show data. This improves performance of the report as a whole.

Once the original profitability analysis document appears, the original documents related to the line item may be retrieved. For example, from a sales document, a material master, customer master, billing document, and accounting document is available. From a direct financial entry, however, only the cost element and accounting documents are available. From settlement documents, the controlling object from which the settlement took place is generally available.

Two different views are available in this report:

1. Selected columns run across the report, while the characteristics (products, for example) run down the side.
2.All columns f or a single selected product show as rows for a contribution analysis.

You can analyze data using ranking lists, exception reporting, and sorting; list line items in the profitability analysis database; and access additional SAP data from this report.

This report contains data obtained from postings to cost-based CO-PA. As such, the data cannot be changed or manipulated from the report. Since cost-based—not account-based—CO-PA is used, value fields are used in the analysis instead of account numbers or cost elemets.

To access the first screen for this sap baap fico report, choose Information systems → Accounting → Profitability analysis Profitability report → Report selection.

From the reporting tree, choose the following report:

Plan- → Plan/Actual Comparison.

The initial screen looks like this in sap systems.
The numbers marked in the screen represent the following.

1. Enter 1 in From period and 12 in To period. This report will not provide a periodic breakdown of the costs, only totals for the period range.
2. Enter 1998 in From Fiscal Year. This report runs for only one fiscal year at a time.
3. Choose Execute.

The initial output of the report is as shown and each number of the output is explained as below.


The default sales organization number (for example, 1000) cannot be changed. Divisions show in rows. In this example, all postings were assigned to a division. If postings were not assigned to a division, Not assigned would appear in the last row.

Gross revenue and contribution margin data show in columns. For each of these values, planned and actual data appear, along with the absolute and percentage variances.

4. Double-click on the first division, Pumps. This screen shows the products within the Pumps division. Notice the breakdown of the Product characteristic as compared to the previous screen.
5. Choose Display to navigate to Division characteristic. This screen shows all Divisions.
6. Select the High Tech line.
7. Choose Enter.


Related Posts:

My sapcrm customers and consumer segmentation
Organizational challenges in crm and mysap solutions
Business View and Mysap.com
What is SAP R/3 introduction to mysap.com

List of FICO reports for SAP ABAP Programming

FICO is the important module of SAP erp and more ever a very important part of any business organization and it stand for finance and control. We can extract the data from SAP systems using the pre existing reports and by modifying them as per the need of the customer . It is the job of the SAP ABAP programmer and here is the list of pre defined abap program's t o extract data as per the need. It is the list compiled here for the reference.

fico internal summery report sap abap

sap finance cost center summery report

SAP FICO cost center actual line items report

Cost center overview sap fico report

Vendor balance in local currency report

Vendor open items sap abap report

Customer balance in local currency report

Customer open items report in sap abap

Account receivable information system sap abap report

Customer open item analysis report in erp sap

General ledger balance report in mysap.com

General ledger account balance report for fico of sap abap

fico general ledger line items for mysap erp

General ledger account balance report of ABAP

Related Posts:

Business View and Mysap.com
ERP software selection
ERP implementation process and advantages

SAP Finance Accounting Customer Open Item Analysis Report

This SAP Finance accounting sample report with default ABAP Code lets you select and analyze customer open items that are overdue and exceed a predefined amount. You can search by customer account number, company, deduction, and a specific level of balance.

The report’s dynamic options let you refine your search to allow for even greater levels of detail You can search by industry, country, accounting clerk, etc.

To run this ABAP report, use one of the following access options:

1. Information systems → Accounting → Financial accounting Accounts receivable → Select report

2.Information system → Account information → Days overdue analysis → Customer open
item analysis .

3.Choose System → Services → Reporting and enter RFDOPR10 in the Program field.

Then, choose Execute to run the report.

The selection screen of this report includes:

Variants
Dynamic selection options
User variables
Execution (and print) in background

This report contains data obtained from A/R customer balances. As such, the data cannot be changed or manipulated from the report.

Example SAP Finance customer open items report :Generate a report to analyze open items for a customer, with summarization levels set at 0 for the highest level of detail.

To access the first screen for this report, choose

Information systems → Accounting → Financial accounting

Accounts receivable → Select report

Information system → Account information → Days overdue analysis → Customer open item analysis.

When you select the above SAP menu path you will be seeing the following screen.

Each part of the screen numbered represent the following.

1. Enter AESC04D in Customer account.

2. Enter 0001 in Company code.

3. Enter 08/07/1998 in Open items at key date.

The system selects all items that posted before the specified key date and remain open for this period. The current date defaults to the system setting.

4. The Due date sorted list is set to a user-defined setting of 20, 50, 80, 100, and 180 days.

5. Choose Execute.

The SAP finance Customer Open Item Analysis screen provides several key pieces of information, including the customer’s name and address.

It is displayed in the following screen.

Each letter of the screen explains the following.

A Total current liabilities for the customer (for example, USD 3,200)

B Annual purchases and deductions .

C Terms of payment (for example, ZB00 indicates that the payable is immediately due in full)

D Aging breakdown (for example, the open item total is 3,200. At 20 days and less there is a credit of 1,000.)

The previous post deals with SAP Finance sample report on Ledger Balance Sheet.

ABAP MULTIPLE INTERACTIVE REPORT SAMPLE CODE 2

*TABLES DECLARATION
TABLES : KNA1, VBAK, VBAP.

*SELECT OPTIONS
SELECT-OPTIONS: CUST_NO FOR KNA1-KUNNR.

*INITIALIZATION
INITIALIZATION.
CUST_NO-LOW = '01'.
CUST_NO-HIGH = '5000'.
CUST_NO-SIGN = 'I'.
CUST_NO-OPTION = 'BT'.
APPEND CUST_NO.

*SELECTION SCREEN VALIDATION
AT SELECTION-SCREEN ON CUST_NO.

LOOP AT SCREEN.
IF CUST_NO-LOW <> 5000.
MESSAGE E001(ZTJ1).
ENDIF.
ENDLOOP.

*BASIC LIST SELECTION
START-OF-SELECTION.

SELECT KUNNR NAME1 ORT01 LAND1 INTO
(KNA1-KUNNR, KNA1-NAME1,KNA1-ORT01,KNA1-LAND1)
FROM KNA1
WHERE KUNNR IN CUST_NO.

WRITE:/1 SY-VLINE,
KNA1-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
16 SY-VLINE,
KNA1-NAME1 UNDER 'NAME',
61 SY-VLINE,
KNA1-ORT01 UNDER 'CITY',
86 SY-VLINE,
KNA1-LAND1 UNDER 'COUNTRY',
103 SY-VLINE.

HIDE: KNA1-KUNNR.
ENDSELECT.
ULINE.

*SECONDARY LIST ACCESS

AT user-command.

IF SY-UCOMM = 'IONE'.
PERFORM SALES_ORD.
ENDIF.
IF SY-UCOMM = 'ITWO'.
PERFORM ITEM_DET.
ENDIF.

*TOP OF PAGE
TOP-OF-PAGE.

FORMAT COLOR 1.
WRITE : 'CUSTOMER DETAILS'.
FORMAT COLOR 1 OFF.
ULINE.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'CUSTOMER NO.',
16 SY-VLINE,
18 'NAME',
61 SY-VLINE,
63 'CITY',
86 SY-VLINE,
88 'COUNTRY',
103 SY-VLINE.

ULINE.
FORMAT COLOR 3 OFF.

*TOP OF PAGE FOR SECONDARY LISTS
TOP-OF-PAGE DURING LINE-SELECTION.

*TOP OF PAGE FOR 1ST SECONDARY LIST
IF SY-UCOMM = 'IONE'.
ULINE.
FORMAT COLOR 1.
WRITE : 'SALES ORDER DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'CUSTOMER NO.',
16 SY-VLINE,
18 'SALES ORDER NO.',
40 SY-VLINE,
42 'DATE',
60 SY-VLINE,
62 'CREATOR',
85 SY-VLINE,
87 'DOC DATE',
103 SY-VLINE.
ULINE.
ENDIF.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR 2ND SECONDARY LIST

IF SY-UCOMM = 'ITWO'.
ULINE.
FORMAT COLOR 1.
WRITE : 'ITEM DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.

WRITE : 1 SY-VLINE,
3 'SALES ORDER NO.',
40 SY-VLINE,
42 'SALES ITEM NO.',
60 SY-VLINE,
62 'ORDER QUANTITY',
103 SY-VLINE.
ULINE.
ENDIF.
FORMAT COLOR 3 OFF.
*END OF PAGE

END-OF-PAGE.
ULINE.
WRITE :'USER :',SY-UNAME,/,'DATE :', SY-DATUM, 85 'END OF PAGE:',
SY-PAGNO.
SKIP.
*&---------------------------------------------------------------------*
*& Form SALES_ORD
*&
*& FIRST SECONDARY LIST FORM
*&---------------------------------------------------------------------*

FORM SALES_ORD .

SELECT KUNNR VBELN ERDAT ERNAM AUDAT INTO
(VBAK-KUNNR, VBAK-VBELN, VBAK-ERDAT, VBAK-ERNAM, VBAK-AUDAT)
FROM VBAK
WHERE KUNNR = KNA1-KUNNR.

WRITE:/1 SY-VLINE,
VBAK-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
16 SY-VLINE,
VBAK-VBELN UNDER 'SALES ORDER NO.' HOTSPOT ON,
40 SY-VLINE,
VBAK-ERDAT UNDER 'DATE',
60 SY-VLINE,
VBAK-ERNAM UNDER 'CREATOR',
85 SY-VLINE,
VBAK-AUDAT UNDER 'DOC DATE',
103 SY-VLINE.
HIDE : VBAK-VBELN.
ENDSELECT.

ULINE.
ENDFORM. " SALES_ORD

*&---------------------------------------------------------------------*
*& Form ITEM_DET
*&
*& SECOND SECONDARY LIST FORM
*&---------------------------------------------------------------------*
FORM ITEM_DET .

SELECT VBELN POSNR KWMENG INTO
(VBAP-VBELN, VBAP-POSNR, VBAP-KWMENG)
FROM VBAP
WHERE VBELN = VBAK-VBELN.

WRITE : /1 SY-VLINE,
VBAP-VBELN UNDER 'SALES ORDER NO.',
40 SY-VLINE,
VBAP-POSNR UNDER 'SALES ITEM NO.',
60 SY-VLINE,
VBAP-KWMENG UNDER 'ORDER QUANTITY',
103 SY-VLINE.

ENDSELECT.
ULINE.
ENDFORM. " ITEM_DET
************************************************************************

REPORT demo_list_at_pf.

START-OF-SELECTION.
WRITE 'Basic List, Press PF5, PF6, PF7, or PF8'.

AT pf5.
PERFORM out.

AT pf6.
PERFORM out.

AT pf7.
PERFORM out.

AT pf8.
PERFORM out.

FORM out.
WRITE: 'Secondary List by PF-Key Selection',
/ 'SY-LSIND =', sy-lsind,
/ 'SY-UCOMM =', sy-ucomm.
ENDFORM.

After executing the program, the system displays the basic list. The user can press the function keys F5 , F6 , F7 , and F8 to create secondary lists. If, for example, the 14th key the user presses is F6 , the output on the displayed secondary list looks as follows:

Secondary List by PF-Key Selection

SY-LSIND = 14

SY-UCOMM = PF06



Example for AT USER-COMMAND.

REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.

START-OF-SELECTION.
WRITE: 'Basic List',
/ 'SY-LSIND:', sy-lsind.

TOP-OF-PAGE.
WRITE 'Top-of-Page'.
ULINE.

TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-pfkey.
WHEN 'TEST'.
WRITE 'Self-defined GUI for Function Codes'.
ULINE.
ENDCASE.

AT LINE-SELECTION.
SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
PERFORM out.
sy-lsind = sy-lsind - 1.

AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'FC1'.
PERFORM out.
WRITE / 'Button FUN 1 was pressed'.
WHEN 'FC2'.
PERFORM out.
WRITE / 'Button FUN 2 was pressed'.
WHEN 'FC3'.
PERFORM out.
WRITE / 'Button FUN 3 was pressed'.
WHEN 'FC4'.
PERFORM out.
WRITE / 'Button FUN 4 was pressed'.
WHEN 'FC5'.
PERFORM out.
WRITE / 'Button FUN 5 was pressed'.
ENDCASE.
sy-lsind = sy-lsind - 1.

FORM out.
WRITE: 'Secondary List',
/ 'SY-LSIND:', sy-lsind,
/ 'SY-PFKEY:', sy-pfkey.
ENDFORM.

When you run the program, the system displays the following basic list with a the page header defined in the program:

You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to push buttons in the application toolbar. The page header of the detail list depends on the status.

Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined push buttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each push button.

For each interactive event, the system decreases the SY-LSIND system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, SY-LSIND still has the value 1.

RELATED POSTS

ABAP MULTIPLE INTERACTIVE REPORT SAMPLE CODE

tables: mara,vbap.

data : begin of itab occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
end of itab.

data : begin of itab1 occurs 0,
matnr like vbap-matnr,
vbeln like vbap-vbeln,
end of itab1.
data: fld(20) type c,val like mara-matnr .

selection-screen begin of block blk1 with frame title text-001.
select-options: m for mara-matnr obligatory.
selection-screen end of block blk1.

at selection-screen on m.
select single matnr from mara into mara-matnr where matnr = m-low.
if sy-subrc ne 0.
message e000(zz) with 'invalid ' mara-matnr 'in your ' 'selection'.
endif.



start-of-selection.
select matnr ernam into table itab from mara where matnr in m.
select matnr vbeln into table itab1 from vbap for all entries in itab
where matnr = itab-matnr.



end-of-selection.
loop at itab.
write:/30 itab-matnr,60 itab-ernam.
* hide itab-matnr.
clear itab-matnr.
endloop.
set pf-status 'XX2'.


at line-selection.
get cursor field fld value val.
case fld.
when 'ITAB-MATNR'.
write:/ val.
endcase.
case sy-lsind.
when '1'.
set pf-status 'XX2'.
set titlebar 'XX2'.
if itab1[] is initial.
write:/ 'no data found for itab1 in first secondary list'.
endif.
loop at itab1.
write:/30 itab1-matnr,60 itab1-vbeln.
* hide itab1-matnr.
endloop.
when '2'.
set pf-status 'XX2'.
set titlebar 'XX2'.
loop at itab.
write:/30 itab-matnr,60 itab-ernam.
endloop.
endcase.

at user-command.
case sy-ucomm.
when 'SET'.
if sy-lsind = 1.
window starting at 5 3 ending at 40 10.
write 'Select line for a second window'.
elseif sy-lsind = 2.
window starting at 45 10 ending at 60 12.
write 'Last window'.
endif.


when 'BACK'.
sy-lsind = sy-lsind - 1.
when 'ABC'.
write:/ 'iam great'.

when 'DOWNLOAD'.

call function 'GUI_DOWNLOAD'
exporting
* BIN_FILESIZE =
filename = 'c:\temp.txt'
filetype = 'DAT'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* IMPORTING
* FILELENGTH =
tables
data_tab = itab
* FIELDNAMES =
exceptions
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
others = 22.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endcase.


top-of-page during line-selection.
case sy-lsind.
when '1'.
write:/ 'this is secondary list'.
endcase.


* AT USER-COMMAND.
* CASE sy-ucomm.
* WHEN 'SELE'.
* IF sy-lsind = 1.
* SET PF-STATUS 'DIALOG'.
* SET TITLEBAR 'WI1'.
* WINDOW STARTING AT 5 3 ENDING AT 40 10.
* WRITE 'Select line for a second window'.
* ELSEIF sy-lsind = 2.
* SET PF-STATUS 'DIALOG' EXCLUDING 'SELE'.
* SET TITLEBAR 'WI2'.
* WINDOW STARTING AT 45 10 ENDING AT 60 12.
* WRITE 'Last window'.
* ENDIF.
* ENDCASE.


RELATED POSTS

EFFECTIVE CODING IN ABAP PART 2
EFFECTIVE CODING IN ABAP PART 1
PERFORMANCE TIPS FOR ABAPER

ABAP SAMPLE CODE FOR OUTPUT TO EXCEL AND IN PUT FILE PATH THROGH SELECTION SCREEN

TABLES:
sflight.

parameters : p_file like rlgrap-filename.

* header data................................
DATA :
header1 LIKE gxxlt_p-text VALUE 'NAME',
header2 LIKE gxxlt_p-text VALUE 'Excel sheet'.

* Internal table for holding the SFLIGHT data
DATA BEGIN OF t_sflight OCCURS 0.
INCLUDE STRUCTURE sflight.
DATA END OF t_sflight.

* Internal table for holding the horizontal key.
DATA BEGIN OF t_hkey OCCURS 0.
INCLUDE STRUCTURE gxxlt_h.
DATA END OF t_hkey .

* Internal table for holding the vertical key.
DATA BEGIN OF t_vkey OCCURS 0.
INCLUDE STRUCTURE gxxlt_v.
DATA END OF t_vkey .

* Internal table for holding the online text....
DATA BEGIN OF t_online OCCURS 0.
INCLUDE STRUCTURE gxxlt_o.
DATA END OF t_online.

* Internal table to hold print text.............
DATA BEGIN OF t_print OCCURS 0.
INCLUDE STRUCTURE gxxlt_p.
DATA END OF t_print.

* Internal table to hold SEMA data..............
DATA BEGIN OF t_sema OCCURS 0.
INCLUDE STRUCTURE gxxlt_s.
DATA END OF t_sema.

* Retreiving data from sflight.
SELECT * FROM sflight
INTO TABLE t_sflight.

* Text which will be displayed online is declared here....
t_online-line_no = '1'.
t_online-info_name = 'Created by'.
t_online-info_value = 'SURESH KUMAR PARVATHANENI'.
APPEND t_online.

* Text which will be printed out..........................
t_print-hf = 'H'.
t_print-lcr = 'L'.
t_print-line_no = '1'.
t_print-text = 'This is the header'.
APPEND t_print.

t_print-hf = 'F'.
t_print-lcr = 'C'.
t_print-line_no = '1'.
t_print-text = 'This is the footer'.
APPEND t_print.

* Defining the vertical key columns.......
t_vkey-col_no = '1'.
t_vkey-col_name = 'MANDT'.
APPEND t_vkey.

t_vkey-col_no = '2'.
t_vkey-col_name = 'CARRID'.
APPEND t_vkey.

t_vkey-col_no = '3'.
t_vkey-col_name = 'CONNID'.
APPEND t_vkey.

t_vkey-col_no = '4'.
t_vkey-col_name = 'FLDATE'.
APPEND t_vkey.

* Header text for the data columns................

t_hkey-row_no = '1'.
t_hkey-col_no = 1.
t_hkey-col_name = 'PRICE'.
APPEND t_hkey.

t_hkey-col_no = 2.
t_hkey-col_name = 'CURRENCY'.
APPEND t_hkey.

t_hkey-col_no = 3.
t_hkey-col_name = 'PLANETYPE'.
APPEND t_hkey.

t_hkey-col_no = 4.
t_hkey-col_name = 'SEATSMAX'.
APPEND t_hkey.

t_hkey-col_no = 5.
t_hkey-col_name = 'SEATSOCC'.
APPEND t_hkey.

t_hkey-col_no = 6.
t_hkey-col_name = 'PAYMENTSUM'.
APPEND t_hkey.

* populating the SEMA data..........................
t_sema-col_no = 1.
t_sema-col_typ = 'STR'.
t_sema-col_ops = 'DFT'.
APPEND t_sema.

t_sema-col_no = 2.
APPEND t_sema.

t_sema-col_no = 3.
APPEND t_sema.

t_sema-col_no = 4.
APPEND t_sema.

t_sema-col_no = 5.
APPEND t_sema.

t_sema-col_no = 6.
APPEND t_sema.

t_sema-col_no = 7.
APPEND t_sema.

t_sema-col_no = 8.
APPEND t_sema.

t_sema-col_no = 9.
APPEND t_sema.

t_sema-col_no = 10.
t_sema-col_typ = 'NUM'.
t_sema-col_ops = 'ADD'.
APPEND t_sema.

CALL FUNCTION 'XXL_FULL_API'
EXPORTING
* DATA_ENDING_AT = 54
* DATA_STARTING_AT = 5
filename = p_file
header_1 = header1
header_2 = header2
no_dialog = 'X'
no_start = ' '
n_att_cols = 6
n_hrz_keys = 1
n_vrt_keys = 4
sema_type = 'X'
* SO_TITLE = ' '


TABLES
data = t_sflight
hkey = t_hkey
online_text = t_online
print_text = t_print
sema = t_sema
vkey = t_vkey


EXCEPTIONS


cancelled_by_user = 1
data_too_big = 2
dim_mismatch_data = 3
dim_mismatch_sema = 4
dim_mismatch_vkey = 5
error_in_hkey = 6
error_in_sema = 7
file_open_error = 8
file_write_error = 9
inv_data_range = 10
inv_winsys = 11
inv_xxl = 12
OTHERS = 13
.
IF sy-subrc <> 0.


MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

RELATED POSTS

CONTROL BLOCKS IN ABAP
CODE INSPECTOR IN ABAP

SAP Financial Part Five

SAP Financial Cost Management 
SAP Financial Dunning