SAP ABAP Programming Report on Production Order

SAP ABAP programming report provides a summarized list of production orders based on user specified criteria. It is a powerful tool for monitoring the progress of orders through the production process, both from a manufacturing and an accounting perspective.

From this report, you can drill down to the order in display or change mode. The report also lets you display the dependent demand for components and the pegging reports to the demand source. For a configured product, it lets you drill down to the details of the configuration.

There are some additional flags such as component storage location, deletion indicator, and rework and collective order indicators which may further filter the selection. Since a production order database can be very large, it is advisable to use the filters provided in the first section to limit data selection and improve performance. All filters and settings may be saved for future use as a variant.

The report provides three basic views:

1. Object overview (MRP controller, plant, order type, system status, basic dates)
2. Order header overview (all header-level dates, last changed by, material description)
3. Object detail list (based on objects chosen, displays/groups related fields; see below) Use of the standard profile will list a predefined set of fields for each order, but these may be changed for the particular session, or a new profile may be created for the future.

This report contains data obtained from production orders. There are two cases in which data may be changed:

1. An order brought up in change mode from the menu option (Environment → Change order; an icon is also provided).

2. By choosing Goto → Object detail list → Components you are provided various branch points under the subsequent Environment menu, including the ability to change the order, create and process pick lists (goods issues) and invoke backorder processing.

To access the first screen for this report, choose Logistics → Production → Production control → Control → Information systems → Order Info system → Object overview.

1. Select the standard profile in Overall profile.
2. Enter 3000 in Plant.
3. Choose List → Execute.

This screen shows the Object Overview. The orders are listed along with the various status codes from the order. Click the node to expand the line entry.

1. Enter DLV in System status and then, select Excl. (exclude). This selection assures that the report will ignore orders that are “technically completed.”

2. Under Relative dates at header level enter the number of days (plus or minus) from the current day. Combining the number of days (for example, 60) with the selection option of less than (<) selects orders started more than 60 days ago. 3. Choose Execute. This screen shows the list restricted to orders that do not have the DLV status. The actual start date for these orders is more than 60 days ago.
1. Click the node for the production order you want to expand on.
2. Select the expand node button to display a full listing for the order.
3. Each subordinate object can be expanded to reveal more detail.
4. Choose Fields to modify individual columns.
5. The individual order can be displayed or changed by selecting the appropriate menu choice or
icon. The cursor is placed on the order to display or change, then the icon is selected. In this example, we choose Display order.


ABAP Programming Report Stock Requirement List

This ABAP report gives you a sneak peak about about the SAP Report which can give you different options to extract data from the source server about stock requiremnt of a comapany.This report provides a real-time display of the inventory on hand and the requirements for a specific material. All recommendations and exception messages from MPS/MRP are as current as the most recent planning-run.

Starting with the current date, this report displays the inventory on hand, followed by one line for each element of supply and demand, any related MPS/MRP exception messages, and the projected balance. The report offers drilldown capabilities for additional detail to enable a quick assessment of the inventory position.

You must enter the Material number and Plant before running this report. If you want to review a product group instead of a specific material, you will need to enter the Product group on the first screen.

From the output of this report, you can:

  1. Immediately convert MPS/MRP planned orders into production orders
  2. Immediately convert purchase requisitions into purchase orders or scheduling agreements
  3. Start a pegging report for any element to determine the source of demand
  4. View lower-level dependent requirements and call up an order report
  5. Select various menu options to review detailed planning parameters
  6. Display available-to-promise calculations
  7. Invoke capacity planning functions from the menu
  8. Compare the last MRP report to assess changes in the planning situation
This program can be used to convert orders and invoke capacity planning. Thus, the system administrator may want to limit user authorization to this program.

From this report, you can select the following functions:

Print the displayed stock/requirements results (List → Print).
Invoke the rescheduling function (List → Rescheduling).
Calculate ATP (List → Calculate ATP).
Display additional detail:
Stock statistics such as receipts, issues, quantities in restricted stock, at vendors, in transit, QI, and returns (Goto → Stock statistics)
Sales statistics such as quantity of a material on sales orders, quotes, and contracts (Goto → Sales statistics)
Planning data drawn from the material master, such as the MRP controller, MRP group, MRP type, reorder point and lot sizing data, availability check, special procurement type, and a recap of all receipts and issue by source/type (Goto → Material overview)

Display additional data such as a second exception message, order dates, quantity, strategy (Edit → Additional data; an icon is also available or you can simply double-click). From the popup window, it is possible to convert the item or invoke pegging reports; this can also be done directly from various Environment menu options.

To access the first screen for this report, choose

Logistics → Production → MRP → Evaluations → Stock/reqmts list.
1. Enter the material (for example, 100-100) or product group in Material.
2. Enter the plant associated with the material (for example, 3000) or product group in Plant.
3. If you entered a product group in step 1 above, select Product group.
4. Choose Enter.

The system displays the following:

A Date of receipt/requirement and associated type of supply or demand
B Material number, order number, etc.
C MRP exception message D Receipt or requirement quantity
E Available quantity

The width of columns may be adjusted by dragging the column divider.


SAP ABAP Sample Program for Order Cost Element Display

This sap abap program gives you some basic screenshots about a programming and its code for the order of cost element display.This report summarizes costs by cost element and shows the current, planned, and actual costs, as well as planned and actual credits, debits, and quantities for a maintenance order.

It shows the current status of the maintenance order as postings are made, regardless of when the accounting period closes. It also differentiates between settlement postings, and planned and actual costs. Planned costs are a result of planning labor hours, materials (stock reservations and purchase requisitions), and external services for maintenance order operations.

Actual costs are a result of time postings (through HR or through the PM confirmation screen), material issues, service entry confirmations, and purchase order receipts. If the maintenance order has actual cost postings, you can drill down to the relevant documents for more information. This will give you detailed information about when and by whom the entries were made, which postings were made, what materials were issued, what overhead costs or cost allocations were included in the cost calculations, etc.

For the cost overview report, you must define value categories in Customizing, and the cost elements for each value category. You must then assign the value categories to corresponding PM key figures for costs. This allows you to set up value categories which group together several cost-element accounts, and allocate one or more value categories to each PM key figure for costs.

For the order cost element report, you must define G/L accounts and cost elements, valuation and account determination (for materials configured), and valid prices (for activity types). You must then set up the configuration for maintenance order costs and maintenance work centers with appropriate cost calculation formulas.

When you run this report you will get a message saying The order has no costs if no planned or actual costs exist for the maintenance order. If there are planned costs, but no actual postings, the report displays these but you will not be able to drill down by line item.

You can use this report to obtain cost information while currently viewing a maintenance order. However, remember it is cost information as viewed from an accounting perspective. An alternate cost overview display allows you to configure the desired cost elements from a maintenance perspective.

The cost buckets (value categories) are defined in configuration and allow you to define which cost elements make up a value category to filter out unwanted cost elements or group together cost element accounts into one value category with a user-defined label. You can view this overview by choosing Cost Overview, or choosing Goto → Cost Overview from the central header screen of the order.

If you run this report from within the order, there is no selection screen. The system defaults to the controlling area and the order number. If you run this report with transaction GR55,report group 7K0Q, you will need to enter this information.This report contains data obtained from accounting and material documents. As such, you cannot manipulate the data.

To access the first screen for this report, choose Logistics → Plant maintenance → Maintenance processing → Orders → Change.
In both examples we show change transactions which are typically not regarded as reports. However, these transactions have been included for informational purposes only.
1. Enter 901913 in Order.
2. Choose Enter.

This screen shows the Central Header for the Change Maintenance order.
3. Choose Extras → Cost Reports → Plan/act. Comparison.

Planned costs, actual costs, and quantities for the order summarize by cost element and group by debit or credit postings.

4. Double-click on the Cost elements column header to drill down to further information about the posting.

In this example, we see the cost center and activity type for the time posted to the maintenance order.

5. If actual costs were posted, choose Line Items to further drill down and view the actual documents.

This screen shows the list of individual postings to the order.Fields in this list can be configured by creating user-defined display variants.

6. To change the appearance of this display, choose Settings → Display Variant → Current.


SAP ABAP List Notifications Tasks Programming

SAP ABAP Programming in Plant maintenance department programming report can be used this report to describe the condition of a technical object, or to report a malfunction in a technical object and request the damage to be repaired. This report displays a list of tasks for selected maintenance notifications.

No prerequisites are required to run this report. If you run the report without entering any selection criteria, the system date is used as the notification date and all uncompleted tasks list for this date.

From this report, you can select and view (or edit) notifications and execute functions (for example, put in process, print, postpone, complete, and create an order for the notification).

This report contains data obtained from maintenance notifications which have tasks assigned to them. Data can be manipulated by selecting and editing notifications, and by executing functions (such as postpone, complete, put in process, etc.).

The system administrator can prevent users from editing notifications with transaction code IW67 by making the appropriate restrictions to the authorization profiles of the users.

To access the first screen for this report, choose Logistics → Plant maintenance → Maintenance processing → Notifications and then, List of tasks → Display.

1. Enter the desired date range (for example, 16.08.1998 to 20.08.1998) in Notification date.
2. Enter the task completion dates (for example, 23.08.1998 to 28.08.1998) in Planned end.
3. Deselect Only uncompleted tasks to exclude tasks that have not been completed.
4. Choose Execute.

This screen shows all notification tasks due to be completed in the given period.
5. To change the display format of this report, choose Settings → Display variant → Current.


SAP ABAP Programming report MM Display Purchage Requistions

The explained abap programming report for erp sap,displays a set of purchase requisitions according to selected criteria. You can control both the display of these requisitions and how they are sorted. Frequently a “purchasing group” is set up as a set of buyers, or each group number is assigned to an individual buyer.

Lists of created requisitions can be viewed according to the buyer who may process them or the requestor who entered them. Purchase requisitions also can be directed for certain plants and storage locations. Consequently, displaying requisitions by plant and storage location can provide a view beyond purchase orders. Listing purchase requisitions is also useful for managers who are required to release requisitions begun by their employees.

You must enter a scope of list to run this report. This identifies how the set of purchase requisitions will be displayed (for example, 2-line, 3-line, etc.) and a display sort indicator. The output will only be meaningful if valid purchase requisitions have first been entered into the system.

To assure a more meaningful report, you should know the items that will limit the display (for example, purchase group, material, plant, delivery date, processing status, etc.). You can use the sort indicator to sort the report as desired, however you can also change the sorting once the report has run. Summary data can be displayed from the output. This report also uses such features as dynamic selections, user variables, and selection variants.

This report contains data obtained from purchase requisitions, related materials, vendor information, and outline agreements. As such, the data cannot be changed or manipulated from the report.

To access the first screen for this sap abap programming report, choose Logistics → Materials management → Purchasing → Requisition → List displays → General.

1. Enter A in Scope of list. This creates a three-line display in the output.
2. Enter 3000 in Plant.
3. Enter 1 in Sort indicator. This creates sorting by purchase requisition number and item.
4. Make certain that Closed requisitions is deselected.
5. Choose Execute.

This display of purchase requisitions corresponds to the header lines defined according to selections for the Scope of list. Requisitions are sequentially numbered, all with the same date, plant, material group, and requestor. Thus, it is likely that the requisitions came from the material planner MEIER.

6. Double-click on an individual line (for example, 10004956) to view detailed information.

This screen shows detailed information for requisition number 10004956.


SAP ABAP ALV Report with Double Click Event

sap abap programming report sample code is about using alv double click event and its execution in a alv report.The sample coding is as shown below.


type-pools:
slis.
tables:
mara.

types:
begin of x_mara,
matnr like mara-matnr,
box(1),
end of x_mara.

data:
t_mara type standard table of x_mara,
t_events type SLIS_T_EVENT,
t_fieldcat type SLIS_T_FIELDCAT_ALV with header line.

data:
wa_matnr type x_mara,
WA_FIELDCAT LIKE t_fieldcat.
selection-screen begin of block b1.
select-options:
s_matnr for mara-matnr.
selection-screen end of block b1.

start-of-selection.

select matnr from mara into table t_mara
where matnr in s_matnr.
if sy-subrc = 0.
sort t_mara by matnr.
endif.

t_fieldcat-fieldname = 'BOX'.
t_fieldcat-seltext_l = 'Selection'.
t_fieldcat-tabname = 'T_MARA'.
t_fieldcat-checkbox = 'X'.
t_fieldcat-col_pos = 1.
t_fieldcat-input = 'X'.
t_fieldcat-edit = 'X'.
*T_FIELDCAT-hotspot = 'X'.
append t_fieldcat.

clear t_fieldcat.

t_fieldcat-fieldname = 'MATNR'.
t_fieldcat-seltext_l = 'Material'.
t_fieldcat-tabname = 'T_MARA'.
t_fieldcat-col_pos = 2.
T_FIELDCAT-hotspot = 'X'.
append t_fieldcat.

perform f_get_events.
perform f_display_report.

FORM USER_COMMAND1 USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
data:
l_matnr like mara-matnr.

CALL FUNCTION 'CONVERSION_EXIT_MATN2_INPUT'
EXPORTING
input = rs_selfield-value
IMPORTING
OUTPUT = l_matnr.
IF sy-subrc 0.
  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

delete t_mara where matnr = l_matnr.
perform f_display_report.
  • perform f_display_report.
  • CALL TRANSACTION 'KO03' AND SKIP FIRST SCREEN.
ENDFORM. " USER_COMMAND1

&---------------------------------------------------------------------
*& Form f_display_report
----------------------------------------------------------------------
form f_display_report.

data:
l_prog like sy-repid.
l_prog = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
  • I_INTERFACE_CHECK = ' '
  • I_BYPASSING_BUFFER =
  • I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = l_prog
  • I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND1'
  • I_CALLBACK_TOP_OF_PAGE = ' '
  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '
  • I_CALLBACK_HTML_END_OF_LIST = ' '
  • I_STRUCTURE_NAME =
  • I_BACKGROUND_ID = ' '
  • I_GRID_TITLE =
  • I_GRID_SETTINGS =
  • IS_LAYOUT =
IT_FIELDCAT = t_fieldcat[]
  • IT_EXCLUDING =
  • IT_SPECIAL_GROUPS =
  • IT_SORT =
  • IT_FILTER =
  • IS_SEL_HIDE =
I_DEFAULT = 'X'
  • I_SAVE = ' '
  • IS_VARIANT =
  • IT_EVENTS =
  • IT_EVENT_EXIT =
  • IS_PRINT =
  • IS_REPREP_ID =
  • I_SCREEN_START_COLUMN = 0
  • I_SCREEN_START_LINE = 0
  • I_SCREEN_END_COLUMN = 0
  • I_SCREEN_END_LINE = 0
  • IT_ALV_GRAPHICS =
  • IT_ADD_FIELDCAT =
  • IT_HYPERLINK =
  • I_HTML_HEIGHT_TOP =
  • I_HTML_HEIGHT_END =
  • IT_EXCEPT_QINFO =
  • IMPORTING
  • E_EXIT_CAUSED_BY_CALLER =
  • ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = t_mara
  • 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. " f_display_report

here all meterials are displayed, as N when i click on the material number it will delete the selected material from the list and it will display's the report, like wise your can check the interactive event how it will works.

ABAP Report ALV Block List in SAP Programming

This sap programming report with sample code using abap programming language explains you how to use alv block list to append the report.

REPORT ZALVBLOCK .

TYPE-POOLS : SLIS.

TABLES : AFKO,AFPO.

TYPES : BEGIN OF SAFPO ,
AUFNR LIKE AFPO-AUFNR,
POSNR LIKE AFPO-POSNR,
PLNUM LIKE AFPO-PLNUM,
STRMP LIKE AFPO-STRMP,
MATNR LIKE AFPO-MATNR,
PSMNG LIKE AFPO-PSMNG,
MEINS LIKE AFPO-MEINS,
END OF SAFPO.
TYPES : BEGIN OF SAFKO,
AUFNR LIKE AFKO-AUFNR,
END OF SAFKO.
DATA : IAFKO TYPE TABLE OF SAFKO WITH HEADER LINE,
IAFPO TYPE TABLE OF SAFPO WITH HEADER LINE.

DATA : IFIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
WFIELDCAT1 TYPE SLIS_FIELDCAT_ALV,
ILAYOUT1 TYPE SLIS_LAYOUT_ALV,
IEVENT1 TYPE SLIS_T_EVENT,
WEVENT1 TYPE SLIS_ALV_EVENT,
IKEYINFO1 TYPE SLIS_KEYINFO_ALV.

DATA : IFIELDCAT2 TYPE SLIS_T_FIELDCAT_ALV,
WFIELDCAT2 TYPE SLIS_FIELDCAT_ALV,
ILAYOUT2 TYPE SLIS_LAYOUT_ALV,
IEVENT2 TYPE SLIS_T_EVENT,
WEVENT2 TYPE SLIS_ALV_EVENT.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS : S_AUFNR FOR AFKO-AUFNR,
S_GLTRP FOR AFKO-GLTRP.

SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID.
  • I_CALLBACK_PF_STATUS_SET = ' '
  • I_CALLBACK_USER_COMMAND = ' '
  • IT_EXCLUDING =
.

PERFORM GET_DATA.
PERFORM BUILD_FIELDCAT.
PERFORM BUILD_LAYOUT.
PERFORM BUILD_EVENT.
PERFORM BUILD_KEYINFO.

PERFORM BUILD_FIELDCAT2.
PERFORM BUILD_LAYOUT2.
PERFORM BUILD_EVENT2.

PERFORM DISPLAY_BLOCK1.

PERFORM DISPLAY_BLOCK2.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
  • EXPORTING
  • I_INTERFACE_CHECK = ' '
  • IS_PRINT =
  • I_SCREEN_START_COLUMN = 0
  • I_SCREEN_START_LINE = 0
  • I_SCREEN_END_COLUMN = 0
  • I_SCREEN_END_LINE = 0
  • IMPORTING
  • E_EXIT_CAUSED_BY_CALLER =
  • ES_EXIT_CAUSED_BY_USER =
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.
&---------------------------------------------------------------------
*& Form GET_DATA
&---------------------------------------------------------------------
  • text
----------------------------------------------------------------------
  • --> p1 text
  • <-- li="" p2="" text="">
----------------------------------------------------------------------
FORM GET_DATA .
SELECT AUFNR FROM AFKO INTO CORRESPONDING FIELDS OF TABLE IAFKO
WHERE AUFNR IN S_AUFNR AND GLTRP IN S_GLTRP.

SELECT AUFNR POSNR PLNUM STRMP MATNR PSMNG MEINS FROM AFPO INTO CORRESPONDING FIELDS OF TABLE
IAFPO WHERE AUFNR IN S_AUFNR.
ENDFORM. " GET_DATA
&---------------------------------------------------------------------
*& Form BUILD_FIELDCAT
&---------------------------------------------------------------------
  • text
----------------------------------------------------------------------
  • --> p1 text
  • <-- li="" p2="" text="">
----------------------------------------------------------------------
FORM BUILD_FIELDCAT .
REFRESH : IFIELDCAT1.

*WFIELDCAT1-FIELDNAME = 'AUFNR'.
*WFIELDCAT1-COL_POS = '1'.
*WFIELDCAT1-SELTEXT_L = 'Order No'.
*APPEND WFIELDCAT1 TO IFIELDCAT1.
*CLEAR WFIELDCAT1.
WFIELDCAT1-FIELDNAME = 'GLTRP'.
WFIELDCAT1-COL_POS = '1'.
WFIELDCAT1-SELTEXT_L = 'Basic Finish Time'.
APPEND WFIELDCAT1 TO IFIELDCAT1.
CLEAR WFIELDCAT1.

WFIELDCAT1-FIELDNAME = 'GSTRP'.
WFIELDCAT1-COL_POS = '2'.
WFIELDCAT1-SELTEXT_L = 'Basic Start Time'.
APPEND WFIELDCAT1 TO IFIELDCAT1.
CLEAR WFIELDCAT1.

WFIELDCAT1-FIELDNAME = 'GAMNG'.
WFIELDCAT1-COL_POS = '3'.
WFIELDCAT1-SELTEXT_L = 'Total Order Qty'.
APPEND WFIELDCAT1 TO IFIELDCAT1.
CLEAR WFIELDCAT1.

WFIELDCAT1-FIELDNAME = 'GMEIN'.
WFIELDCAT1-COL_POS = '4'.
WFIELDCAT1-SELTEXT_L = 'UOM'.
APPEND WFIELDCAT1 TO IFIELDCAT1.
CLEAR WFIELDCAT1.

ENDFORM. " BUILD_FIELDCAT
&---------------------------------------------------------------------
*& Form BUILD_LAYOUT
&---------------------------------------------------------------------
  • text
----------------------------------------------------------------------
  • --> p1 text
  • <-- li="" p2="" text="">
----------------------------------------------------------------------
FORM BUILD_LAYOUT .
ILAYOUT1-COLWIDTH_OPTIMIZE = 'X'.
ILAYOUT1-ZEBRA = 'X'.

ENDFORM. " BUILD_LAYOUT
&---------------------------------------------------------------------
*& Form BUILD_EVENT
&---------------------------------------------------------------------
  • text
----------------------------------------------------------------------
  • --> p1 text
  • <-- li="" p2="" text="">
----------------------------------------------------------------------
FORM BUILD_EVENT .

WEVENT1-FORM = 'TOPOFLIST1'.
WEVENT1-NAME = SLIS_EV_TOP_OF_LIST.
APPEND WEVENT1 TO IEVENT1.

ENDFORM. " BUILD_EVENT
&---------------------------------------------------------------------
*& Form DISPLAY_BLOCK1
&---------------------------------------------------------------------
  • text
----------------------------------------------------------------------
  • --> p1 text
  • <-- li="" p2="" text="">
----------------------------------------------------------------------
FORM DISPLAY_BLOCK1 .
*CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_HS_APPEND'
  • EXPORTING
  • IS_LAYOUT = ILAYOUT1
  • IT_FIELDCAT = IFIELDCAT2
  • IS_KEYINFO = IKEYINFO1
  • I_HEADER_TABNAME = 'IAFKO'
  • I_ITEM_TABNAME = 'IAFPO'
  • IT_EVENTS = IEVENT1
    • IT_SORT =
    • I_TEXT = ' '
  • TABLES
  • T_OUTTAB_HEADER = IAFKO
  • T_OUTTAB_ITEM = IAFPO
    • EXCEPTIONS
    • PROGRAM_ERROR = 1
    • MAXIMUM_OF_APPENDS_REACHED = 2
    • OTHERS = 3
  • .
*IF SY-SUBRC 0.
    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
*
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = ILAYOUT1
IT_FIELDCAT = IFIELDCAT1
I_TABNAME = 'IAFKO'
IT_EVENTS = IEVENT1
  • IT_SORT =
  • I_TEXT = ' '
TABLES
T_OUTTAB = IAFKO
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 2
OTHERS = 3
.
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_BLOCK1

FORM TOPOFLIST1.

WRITE :/10 'TABLE AFKO CONTENTS'.
WRITE :/(30) SY-ULINE.

ENDFORM.
&---------------------------------------------------------------------
*& Form BUILD_FIELDCAT2
&---------------------------------------------------------------------
  • text
----------------------------------------------------------------------
  • --> p1 text
  • <-- li="" p2="" text="">
----------------------------------------------------------------------
FORM BUILD_FIELDCAT2 .
REFRESH : IFIELDCAT2.
WFIELDCAT2-FIELDNAME = 'AUFNR'.
WFIELDCAT2-COL_POS = '1'.
WFIELDCAT2-SELTEXT_L = 'Order No'.
APPEND WFIELDCAT2 TO IFIELDCAT2.
CLEAR WFIELDCAT2.

WFIELDCAT2-FIELDNAME = 'POSNR'.
WFIELDCAT2-COL_POS = '2'.
WFIELDCAT2-SELTEXT_L = 'Order Item No'.
APPEND WFIELDCAT2 TO IFIELDCAT2.
CLEAR WFIELDCAT2.

WFIELDCAT2-FIELDNAME = 'PLNUM'.
WFIELDCAT2-COL_POS = '3'.
WFIELDCAT2-SELTEXT_L = 'Planned Order No'.
APPEND WFIELDCAT2 TO IFIELDCAT2.
CLEAR WFIELDCAT2.

WFIELDCAT2-FIELDNAME = 'STRMP'.
WFIELDCAT2-COL_POS = '4'.
WFIELDCAT2-SELTEXT_L = 'Strt Dt Plnd ordr No'.
APPEND WFIELDCAT2 TO IFIELDCAT2.
CLEAR WFIELDCAT2.

WFIELDCAT2-FIELDNAME = 'MATNR'.
WFIELDCAT2-COL_POS = '5'.
WFIELDCAT2-SELTEXT_L = 'Material No'.
APPEND WFIELDCAT2 TO IFIELDCAT2.
CLEAR WFIELDCAT2.

WFIELDCAT2-FIELDNAME = 'PSMNG'.
WFIELDCAT2-COL_POS = '6'.
WFIELDCAT2-SELTEXT_L = 'Pland Ordr Qty'.
APPEND WFIELDCAT2 TO IFIELDCAT2.
CLEAR WFIELDCAT2.

WFIELDCAT2-FIELDNAME = 'MEINS'.
WFIELDCAT2-COL_POS = '7'.
WFIELDCAT2-SELTEXT_L = 'UOM'.
APPEND WFIELDCAT2 TO IFIELDCAT2.
CLEAR WFIELDCAT2.
ENDFORM. " BUILD_FIELDCAT2
&---------------------------------------------------------------------
*& Form BUILD_LAYOUT2
&---------------------------------------------------------------------
  • text
----------------------------------------------------------------------
  • --> p1 text
  • <-- li="" p2="" text="">
----------------------------------------------------------------------
FORM BUILD_LAYOUT2 .
ILAYOUT2-COLWIDTH_OPTIMIZE = 'X'.
ILAYOUT2-ZEBRA = 'X'.
ENDFORM. " BUILD_LAYOUT2
&---------------------------------------------------------------------
*& Form BUILD_EVENT2
&---------------------------------------------------------------------
  • text
----------------------------------------------------------------------
  • --> p1 text
  • <-- li="" p2="" text="">
----------------------------------------------------------------------
FORM BUILD_EVENT2 .

WEVENT2-FORM = 'TOPOFLIST2'.
WEVENT2-NAME = SLIS_EV_TOP_OF_LIST.
APPEND WEVENT2 TO IEVENT2.
CLEAR WEVENT2.

ENDFORM. " BUILD_EVENT2
&---------------------------------------------------------------------
*& Form DISPLAY_BLOCK2
&---------------------------------------------------------------------
  • text
----------------------------------------------------------------------
  • --> p1 text
  • <-- li="" p2="" text="">
----------------------------------------------------------------------
FORM DISPLAY_BLOCK2 .
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = ILAYOUT2
IT_FIELDCAT = IFIELDCAT2
I_TABNAME = 'IAFPO'
IT_EVENTS = IEVENT2
  • IT_SORT =
  • I_TEXT = ' '
TABLES
T_OUTTAB = IAFPO
  • EXCEPTIONS
  • PROGRAM_ERROR = 1
  • MAXIMUM_OF_APPENDS_REACHED = 2
  • OTHERS = 3
.
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_BLOCK2

FORM TOPOFLIST2.
WRITE : /10 'TABLE AFPO CONTENTS'.
WRITE :/(35) SY-ULINE.
ENDFORM.
&---------------------------------------------------------------------
*& Form BUILD_KEYINFO
&---------------------------------------------------------------------
  • text
----------------------------------------------------------------------
  • --> p1 text
  • <-- li="" p2="" text="">
----------------------------------------------------------------------
FORM BUILD_KEYINFO .
IKEYINFO1-HEADER01 = 'AUFNR'.
IKEYINFO1-ITEM01 = 'AUFNR'.
ENDFORM. " BUILD_KEYINFO


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

ABAP Programming Report sample code with OOPS concept

This abap programming report with sap can be used to get the data from sap data base using oops concept is as shown below.

The variant on selection screen


Material ............ 100-100 to 100-200
Plant................ 1000 to 2000
BOM Usage............ 1 to 1
BOM status........... 01 to 01
BOM category........ D to P

SAMPLE CODE

**---------------------------------------------------------------------
*
*                           T Y P E S                                 *
*---------------------------------------------------------------------*
TYPES:
* Material Data
BEGIN OF TYPE_MAST,
 MATNR LIKE MAST-MATNR,             " Material Number
 WERKS LIKE MAST-WERKS,             " Plant
 STLAN LIKE MAST-STLAN,             " BOM Usage
 STLNR LIKE MAST-STLNR,             " Bill of material
 STLAL LIKE MAST-STLAL,             " Alternative BOM
END OF TYPE_MAST,

* Material Description Data
BEGIN OF TYPE_MAKT,
 MATNR LIKE MAKT-MATNR,             " Material Number
 MAKTX LIKE MAKT-MAKTX,             " Material Description
END OF TYPE_MAKT,

* BOM Header Data
BEGIN OF TYPE_STKO,
 STLTY LIKE STKO-STLTY,             " BOM category
 STLNR LIKE STKO-STLNR,             " Bill of material
 STLAL LIKE STKO-STLAL,             " Alternative BOM
 DATUV LIKE STKO-DATUV,             " Valid-From Date
 BMENG LIKE STKO-BMENG,             " Base Quantity
 STKTX LIKE STKO-STKTX,             " Alternative BOM Text
 STLST LIKE STKO-STLST,             " BOM status
END OF TYPE_STKO,

* BOM Text Data
BEGIN OF TYPE_STZU,
 STLTY LIKE STZU-STLTY,             " BOM category
 STLNR LIKE STZU-STLNR,             " Bill of material
 ZTEXT LIKE STZU-ZTEXT,             " BOM text
END OF TYPE_STZU,

* BOM Item Data
BEGIN OF TYPE_STPO,
 STLTY LIKE STPO-STLTY,             " BOM category
 STLNR LIKE STPO-STLNR,             " Bill of material
 IDNRK LIKE STPO-IDNRK,             " BOM component
 POSTP LIKE STPO-POSTP,             " Item Category(BOM)
 POSNR LIKE STPO-POSNR,             " BOM Item Number
 MENGE LIKE STPO-MENGE,             " Component quantity
END OF TYPE_STPO,

* Output Data
BEGIN OF TYPE_OUTPUT,

 WERKS LIKE MAST-WERKS,             " Plant
 MATNR LIKE MAST-MATNR,             " Material Number
 MAKTX LIKE MAKT-MAKTX,             " Material Description
 STLNR LIKE MAST-STLNR,             " Bill of material
 STLAN LIKE MAST-STLAN,             " BOM Usage
 STLAL LIKE MAST-STLAL,             " Alternative BOM

 STLTY LIKE STKO-STLTY,             " BOM category
 DATUV LIKE STKO-DATUV,             " Valid-From Date
 BMENG LIKE STKO-BMENG,             " Base Quantity
 STKTX LIKE STKO-STKTX,             " Alternative BOM Text
 STLST LIKE STKO-STLST,             " BOM status
 IDNRK LIKE STPO-IDNRK,             " BOM component
 POSTP LIKE STPO-POSTP,             " Item Category(BOM)
 POSNR LIKE STPO-POSNR,             " BOM Item Number
 MENGE LIKE STPO-MENGE,             " Component quantity
 ZTEXT LIKE STZU-ZTEXT,             " BOM text
END OF TYPE_OUTPUT.

*----------------------------------------------------------------------
*
*                            D A T A
*
*----------------------------------------------------------------------
*
DATA:
W_MATNR TYPE MARA-MATNR,             " Material Number
W_WERKS TYPE MAST-WERKS,             " Plant
W_STLAN TYPE MAST-STLAN,             " BOM Usage
W_STLST TYPE STKO-STLST,             " BOM status
W_STLTY TYPE STKO-STLTY,             " BOM category

W_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
W_ALV_GRID  TYPE REF TO CL_GUI_ALV_GRID,
OK_CODE     LIKE SY-UCOMM.

*---------------------------------------------------------------------*
*                  I N T E R N A L   T A B L E S                      *
*---------------------------------------------------------------------*
DATA:
* Material Data
I_MAST          TYPE STANDARD TABLE OF TYPE_MAST,
WA_MAST         TYPE TYPE_MAST,

* Material Description Data
I_MAKT          TYPE STANDARD TABLE OF TYPE_MAKT,
WA_MAKT         TYPE TYPE_MAKT,

* BOM Header Data
I_STKO          TYPE STANDARD TABLE OF TYPE_STKO,
WA_STKO         TYPE TYPE_STKO,

* BOM Text Data
I_STZU          TYPE STANDARD TABLE OF TYPE_STZU,
WA_STZU         TYPE TYPE_STZU,

* BOM Item Data
I_STPO          TYPE STANDARD TABLE OF TYPE_STPO,
WA_STPO         TYPE TYPE_STPO,

* Output table
I_OUTPUT        TYPE STANDARD TABLE OF TYPE_OUTPUT,
WA_OUTPUT       TYPE TYPE_OUTPUT,

* Field Catalog table
IT_FCAT      TYPE LVC_T_FCAT,         " Internal table for field catal
WA_FCAT      TYPE LVC_S_FCAT.         " Work area for field catalog

*---------------------------------------------------------------------*
*                 S E L E C T I O N     S C R E E N                   *
*---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-SS1.
SELECT-OPTIONS:
S_MATNR FOR W_MATNR,           " Material Number
S_WERKS FOR W_WERKS OBLIGATORY," Plant
S_STLAN FOR W_STLAN,           " BOM Usage
S_STLST FOR W_STLST,           " BOM status
S_STLTY FOR W_STLTY.           " BOM category
SELECTION-SCREEN END OF BLOCK B1.

*----------------------------------------------------------------------
*
*               A T   S E L E C T I O N   S C R E E N
*
*----------------------------------------------------------------------
*
AT SELECTION-SCREEN.
PERFORM F010_VALIDATE_MATERIAL.
PERFORM F020_VALIDATE_PLANT.
PERFORM F030_VALIDATE_BOM_USAGE.
PERFORM F040_VALIDATE_BOM_STATUS.
PERFORM F050_VALIDATE_BOM_CATEGORY.

*---------------------------------------------------------------------*
*                S T A R T   O F   S E L E C T I O N                  *
*---------------------------------------------------------------------*
START-OF-SELECTION .
PERFORM F210_FETCH_BOM_LINK_DATA.
PERFORM F220_FETCH_MATERIAL_DES_DATA.
PERFORM F230_FETCH_BOM_HEADER_DATA.
PERFORM F240_FETCH_BOM_TEXT.
PERFORM F250_FETCH_BOM_ITEM_DATA.

*---------------------------------------------------------------------*
*                  E N D   O F   S E L E C T I O N                    *
*---------------------------------------------------------------------*
END-OF-SELECTION.
PERFORM F600_POPULATE_DATA.
PERFORM F650_FIELD_CATLOG.
CALL SCREEN 100.


*&--------------------------------------------------------------------*
*&      Form  f010_validate_material                                  *
*&--------------------------------------------------------------------*
*       --Validate Material                                           *
*---------------------------------------------------------------------*
FORM F010_VALIDATE_MATERIAL .

* Validate Material
IF S_MATNR IS NOT INITIAL.

 SELECT MATNR
   INTO W_MATNR
   FROM MARA
  UP TO 1 ROWS
  WHERE MATNR IN S_MATNR.
 ENDSELECT.

 CHECK SY-SUBRC NE 0.

 SET CURSOR FIELD 'S_MATNR'.
 MESSAGE 'Invalid Material' TYPE 'E'.  " Invalid Material

ENDIF.                               " IF s_matnr IS NOT INITIAL.

ENDFORM.                               " f010_validate_material

*&--------------------------------------------------------------------*
*&      Form  f020_validate_plant                                     *
*&--------------------------------------------------------------------*
*       - Validate Plant                                              *
*---------------------------------------------------------------------*
FORM F020_VALIDATE_PLANT .

* Validate Plant
SELECT  WERKS
 INTO W_WERKS
 FROM T001W
 UP TO 1 ROWS
 WHERE WERKS IN S_WERKS.
ENDSELECT.
CHECK SY-SUBRC NE 0.

SET CURSOR FIELD 'S_WERKS'.
MESSAGE 'Invalid Plant' TYPE 'E'.    " Invalid Plant

ENDFORM.                               " f020_validate_plant

*&--------------------------------------------------------------------*
*&      Form  f030_validate_BOM_usage                                 *
*&--------------------------------------------------------------------*
*       -Validate BOM Usage                                           *
*---------------------------------------------------------------------*
FORM F030_VALIDATE_BOM_USAGE .

* Validate BOM Usage
IF S_STLAN IS NOT INITIAL.

 SELECT STLAN
   INTO W_STLAN
   FROM T416
   UP TO 1 ROWS
   WHERE STLAN IN S_STLAN.
 ENDSELECT.
 CHECK SY-SUBRC NE 0.

 SET CURSOR FIELD 'S_STLAN'.
 MESSAGE 'Invalid BOM Usage' TYPE 'E'.  " Invalid BOM Usage

ENDIF.                               " IF s_stlan IS NOT INITIAL.

ENDFORM.                               " f030_validate_BOM_usage

*&--------------------------------------------------------------------*
*&      Form  f040_validate_BOM_status
*&--------------------------------------------------------------------*
*       - Validate BOM Status
*---------------------------------------------------------------------*
FORM F040_VALIDATE_BOM_STATUS .

* Validate BOM Status
IF S_STLST IS NOT INITIAL.

 SELECT  STLST
   INTO W_STLST
   FROM T415S
   UP TO 1 ROWS
   WHERE STLST IN S_STLST.
 ENDSELECT.

 CHECK SY-SUBRC NE 0.

 SET CURSOR FIELD 'S_STLST'.
 MESSAGE 'Invalid BOM Status' TYPE 'E'.  " Invalid BOM Status

ENDIF.                               " IF s_stlst IS NOT INITIAL

ENDFORM.                               " f040_validate_BOM_status

*&--------------------------------------------------------------------*
*&      Form  f050_validate_BOM_category                              *
*&--------------------------------------------------------------------*
*       -Validate BOM Category                                        *
*---------------------------------------------------------------------*
FORM F050_VALIDATE_BOM_CATEGORY .

* Validate BOM Category
IF S_STLTY IS NOT INITIAL.

 SELECT  STLTY
   INTO W_STLTY
   FROM STKO
   UP TO 1 ROWS
   WHERE STLTY IN S_STLTY.
 ENDSELECT.

 CHECK SY-SUBRC NE 0.

 SET CURSOR FIELD 'S_STLTY'.
 MESSAGE 'Invalid BOM Category' TYPE 'E'. " Invalid BOM Category

ENDIF.                               " IF s_stlty IS NOT INITIAL.

ENDFORM.                               " f050_validate_BOM_category

*&--------------------------------------------------------------------*
*&      Form  f210_fetch_bom_link_data                                *
*&--------------------------------------------------------------------*
*       - Fetch Material BOM Link data                                *
*---------------------------------------------------------------------*
FORM F210_FETCH_BOM_LINK_DATA .

* Fetch Material BOM Link data
SELECT MATNR                         " Material Number
      WERKS                         " Plant
      STLAN                         " BOM Usage
      STLNR                         " Bill of material
      STLAL                         " Alternative BOM
 INTO TABLE I_MAST
 FROM MAST
WHERE MATNR IN S_MATNR
  AND WERKS IN S_WERKS.

IF SY-SUBRC NE 0.
 MESSAGE 'No Data Found' TYPE 'E'.  " No Data Found
ENDIF.                               " IF sy-subrc NE 0.

SORT I_MAST BY MATNR WERKS.

ENDFORM.                               " f200_fetch_bom_link_data

*&--------------------------------------------------------------------*
*&      Form  f220_fetch_material_des_data                            *
*&--------------------------------------------------------------------*
*       -Fetch Material Description data                              *
*---------------------------------------------------------------------*
FORM F220_FETCH_MATERIAL_DES_DATA .

SELECT MATNR
      MAKTX
 INTO TABLE I_MAKT
 FROM MAKT
  FOR ALL ENTRIES IN I_MAST
WHERE MATNR EQ I_MAST-MATNR.

IF SY-SUBRC NE 0.
 MESSAGE 'No Data Found' TYPE 'E'.  " No Data Found
ENDIF.                               " IF sy-subrc NE 0.

SORT I_MAKT BY MATNR.

ENDFORM.                               " f200_fetch_material_des_data

*&--------------------------------------------------------------------*
*&      Form  f230_fetch_bom_header_data                              *
*&--------------------------------------------------------------------*
*       - Fetch BOM Header data                                       *
*---------------------------------------------------------------------*
FORM F230_FETCH_BOM_HEADER_DATA .

* Fetch BOM Header data
SELECT STLTY                         " BOM category
      STLNR                         " Bill of material
      STLAL                         " Alternative BOM
      DATUV                         " Valid-From Date
      BMENG                         " Base Quantity
      STKTX                         " Alternative BOM Text
      STLST                         " BOM status
 INTO TABLE I_STKO
 FROM STKO
 FOR ALL ENTRIES IN I_MAST
WHERE STLNR EQ I_MAST-STLNR
AND   STLTY IN S_STLTY
AND   STLST IN S_STLST.

IF SY-SUBRC NE 0.
 MESSAGE 'No Data Found' TYPE 'E'.  " No Data Found
ENDIF.                               " IF sy-subrc NE 0.

SORT I_STKO BY STLTY STLST.

ENDFORM.                               " f200_fetch_bom_header_data

*&--------------------------------------------------------------------*
*&      Form  f240_fetch_bom_text                                     *
*&--------------------------------------------------------------------*
*      - Fetch BOM text Data                                          *
*---------------------------------------------------------------------*
FORM F240_FETCH_BOM_TEXT .
*  DATA:
*    i_stko_temp LIKE TABLE OF wa_stko.
*
*  i_stko_temp = i_stko.
*  SORT i_stko_temp BY stlty stlnr.
*  DELETE ADJACENT DUPLICATES FROM i_stko_temp
*    COMPARING stlty stlnr.
*
*  SELECT stlty                         " BOM category
*         stlnr                         " Bill of material
*         ztext                         " BOM text
*    INTO TABLE i_stzu
*    FROM stzu
*     FOR ALL ENTRIES IN i_stko_temp
*   WHERE stlty EQ i_stko_temp-stlty
*     AND stlnr EQ i_stko_temp-stlnr.
*
*  DATA:
*    i_stzu_temp    LIKE TABLE OF wa_stzu.

SELECT STLTY                         " BOM category
      STLNR                         " Bill of material
      ZTEXT                         " BOM text
 INTO TABLE I_STZU
 FROM STZU
  FOR ALL ENTRIES IN I_STKO
WHERE STLTY EQ I_STKO-STLTY
  AND STLNR EQ I_STKO-STLNR.

IF SY-SUBRC NE 0.
 MESSAGE 'No Data Found' TYPE 'E'.  " No Data Found
ENDIF.                               " IF sy-subrc NE 0.

ENDFORM.                               " f200_fetch_bom_text

*&--------------------------------------------------------------------*
*&      Form  f250_fetch_bom_item_data                                *
*&--------------------------------------------------------------------*
*       - Fetch BOM Item data                                         *
*---------------------------------------------------------------------*
FORM F250_FETCH_BOM_ITEM_DATA .

* Fetch BOM Header data
SELECT STLTY                         " BOM category
      STLNR                         " Bill of material
      IDNRK                         " BOM component
      POSTP                         " Item Category(BOM)
      POSNR                         " BOM Item Number
      MENGE                         " Component quantity
 INTO TABLE I_STPO
 FROM STPO
  FOR ALL ENTRIES IN I_STKO
WHERE STLTY EQ I_STKO-STLTY
  AND STLNR EQ I_STKO-STLNR.

IF SY-SUBRC NE 0.
 MESSAGE 'No Data Found' TYPE 'E'.  " No Data Found
ENDIF.                               " IF sy-subrc NE 0.

ENDFORM.                               " f200_fetch_bom_item_data

*&--------------------------------------------------------------------*
*&      Form  f600_populate_data
*
*&--------------------------------------------------------------------*
*       - Displaying the data                                         *
*---------------------------------------------------------------------*
FORM F600_POPULATE_DATA .

*  SORT i_stko.
*  SORT i_mast.
*  DELETE ADJACENT DUPLICATES FROM i_mast.

LOOP AT I_STPO INTO WA_STPO.
 CLEAR WA_OUTPUT.
 READ TABLE I_STKO INTO WA_STKO WITH KEY STLNR = WA_STPO-STLNR
                                         STLTY = WA_STPO-STLTY
                                         BINARY SEARCH.
*    CHECK sy-subrc eq 0.
 READ TABLE I_STZU INTO WA_STZU WITH KEY STLNR = WA_STKO-STLNR
                                         STLTY = WA_STKO-STLTY
                                         BINARY SEARCH.
*    CHECK sy-subrc Eq 0.
 READ TABLE I_MAST INTO WA_MAST WITH KEY STLNR = WA_STKO-STLNR
                                         BINARY SEARCH.
*    CHECK sy-subrc Eq 0.
 READ TABLE I_MAKT INTO WA_MAKT WITH KEY MATNR = WA_MAST-MATNR
                                         BINARY SEARCH.
*    CHECK sy-subrc Eq 0.
 MOVE:

   WA_STPO-IDNRK TO WA_OUTPUT-IDNRK,
   WA_STPO-POSTP TO WA_OUTPUT-POSTP,
   WA_STPO-POSNR TO WA_OUTPUT-POSNR,
   WA_STPO-MENGE TO WA_OUTPUT-MENGE,

   WA_STKO-STLTY TO WA_OUTPUT-STLTY,
   WA_STKO-DATUV TO WA_OUTPUT-DATUV,
   WA_STKO-BMENG TO WA_OUTPUT-BMENG,
   WA_STKO-STKTX TO WA_OUTPUT-STKTX,
   WA_STKO-STLST TO WA_OUTPUT-STLST,

   WA_STZU-ZTEXT TO WA_OUTPUT-ZTEXT,

   WA_MAST-WERKS TO WA_OUTPUT-WERKS,
   WA_MAST-MATNR TO WA_OUTPUT-MATNR,
   WA_MAKT-MAKTX TO WA_OUTPUT-MAKTX,
   WA_MAST-STLNR TO WA_OUTPUT-STLNR,
   WA_MAST-STLAN TO WA_OUTPUT-STLAN,
   WA_MAST-STLAL TO WA_OUTPUT-STLAL.

 APPEND WA_OUTPUT TO I_OUTPUT.

ENDLOOP.                             " LOOP AT i_stpo

ENDFORM.                               " f600_display_data

*&--------------------------------------------------------------------*
*&      Form  f650_field_catlog                                       *
*&--------------------------------------------------------------------*
*       -Fill Field Catalog                                           *
*---------------------------------------------------------------------*
FORM F650_FIELD_CATLOG .

WA_FCAT-FIELDNAME = 'WERKS'.
WA_FCAT-REF_TABLE = 'MAST'.
WA_FCAT-REF_FIELD = 'WERKS'.
WA_FCAT-COL_POS   = 1.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'MATNR'.
WA_FCAT-REF_TABLE = 'MAST'.
WA_FCAT-REF_FIELD = 'MATNR'.
WA_FCAT-COL_POS   = 2.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'MAKTX'.
WA_FCAT-REF_TABLE = 'MAKT'.
WA_FCAT-REF_FIELD = 'MAKTX'.
WA_FCAT-COL_POS   = 3.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'STLTY'.
WA_FCAT-REF_TABLE = 'STKO'.
WA_FCAT-REF_FIELD = 'STLTY'.
WA_FCAT-COL_POS   = 4.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'STLAN'.
WA_FCAT-REF_TABLE = 'MAST'.
WA_FCAT-REF_FIELD = 'STLAN'.
WA_FCAT-COL_POS   = 5.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'STLNR'.
WA_FCAT-REF_TABLE = 'MAST'.
WA_FCAT-REF_FIELD = 'STLNR'.
WA_FCAT-COL_POS   = 6.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'STLAL'.
WA_FCAT-REF_TABLE = 'MAST'.
WA_FCAT-REF_FIELD = 'STLAL'.
WA_FCAT-COL_POS   = 7.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'STKTX'.
WA_FCAT-REF_TABLE = 'STKO'.
WA_FCAT-REF_FIELD = 'STKTX'.
WA_FCAT-COL_POS   = 8.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'DATUV'.
WA_FCAT-REF_TABLE = 'STKO'.
WA_FCAT-REF_FIELD = 'DATUV'.
WA_FCAT-COL_POS   = 9.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'BMENG'.
WA_FCAT-REF_TABLE = 'STKO'.
WA_FCAT-REF_FIELD = 'BMENG'.
WA_FCAT-COL_POS   = 10.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'STLST'.
WA_FCAT-REF_TABLE = 'STKO'.
WA_FCAT-REF_FIELD = 'STLST'.
WA_FCAT-COL_POS   = 11.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'IDNRK'.
WA_FCAT-REF_TABLE = 'STPO'.
WA_FCAT-REF_FIELD = 'IDNRK'.
WA_FCAT-COL_POS   = 12.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'POSTP'.
WA_FCAT-REF_TABLE = 'STPO'.
WA_FCAT-REF_FIELD = 'POSTP'.
WA_FCAT-COL_POS   = 13.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'POSNR'.
WA_FCAT-REF_TABLE = 'STPO'.
WA_FCAT-REF_FIELD = 'POSNR'.
WA_FCAT-COL_POS   = 14.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'MENGE'.
WA_FCAT-REF_TABLE = 'STPO'.
WA_FCAT-REF_FIELD = 'MENGE'.
WA_FCAT-COL_POS   = 15.
APPEND WA_FCAT TO IT_FCAT.

WA_FCAT-FIELDNAME = 'ZTEXT'.
WA_FCAT-REF_TABLE = 'STZU'.
WA_FCAT-REF_FIELD = 'ZTEXT'.
WA_FCAT-COL_POS   = 16.
APPEND WA_FCAT TO IT_FCAT.

ENDFORM.                               " f650_field_catlog

*&--------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT                                   *
*&--------------------------------------------------------------------*
*       -Calling Function Module                                      *
*---------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'BACK'.
*  SET TITLEBAR 'xxx'.

IF W_CONTAINER IS INITIAL.
*    IF cl_gui_alv_grid=>offline( ) IS INITIAL.

 CREATE OBJECT W_CONTAINER
   EXPORTING
*      PARENT                      =
     CONTAINER_NAME              = 'CUSTOM'
*      STYLE                       =
*      LIFETIME                    = lifetime_default
*      REPID                       =
*      DYNNR                       =
*      NO_AUTODEF_PROGID_DYNNR     =
 EXCEPTIONS
   CNTL_ERROR                  = 1
   CNTL_SYSTEM_ERROR           = 2
   CREATE_ERROR                = 3
   LIFETIME_ERROR              = 4
   LIFETIME_DYNPRO_DYNPRO_LINK = 5
   OTHERS                      = 6
     .
 IF SY-SUBRC  EQ 0.
   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
 ENDIF.                               " IF sy-subrc  0.
ENDIF.

CREATE OBJECT W_ALV_GRID
 EXPORTING
*      I_SHELLSTYLE      = 0
*      I_LIFETIME        =
   I_PARENT          = W_CONTAINER
*      I_APPL_EVENTS     = space
*      I_PARENTDBG       =
*      I_APPLOGPARENT    =
*      I_GRAPHICSPARENT  =
*      I_NAME            =
 EXCEPTIONS
   ERROR_CNTL_CREATE = 1
   ERROR_CNTL_INIT   = 2
   ERROR_CNTL_LINK   = 3
   ERROR_DP_CREATE   = 4
   OTHERS            = 5
   .
IF SY-SUBRC  EQ 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.                             " IF sy-subrc  0.
*  ENDIF.

CALL METHOD W_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
*   EXPORTING
*    I_BUFFER_ACTIVE               =
*    I_BYPASSING_BUFFER            =
*    I_CONSISTENCY_CHECK           =
*     i_structure_name              = 'WA_OUTPUT'
*    IS_VARIANT                    =
*    I_SAVE                        =
*    I_DEFAULT                     = 'X'
*    IS_LAYOUT                     =
*    IS_PRINT                      =
*    IT_SPECIAL_GROUPS             =
*    IT_TOOLBAR_EXCLUDING          =
*    IT_HYPERLINK                  =
*    IT_ALV_GRAPHICS               =
*    IT_EXCEPT_QINFO               =
 CHANGING
   IT_OUTTAB                     = I_OUTPUT
   IT_FIELDCATALOG               = IT_FCAT
*    IT_SORT                       =
*    IT_FILTER                     =
 EXCEPTIONS
   INVALID_PARAMETER_COMBINATION = 1
   PROGRAM_ERROR                 = 2
   TOO_MANY_LINES                = 3
   OTHERS                        = 4
       .
IF SY-SUBRC  EQ 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.                               " IF sy-subrc  0.

ENDMODULE.                             " STATUS_0100 OUTPUT

*&--------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT                              *
*&--------------------------------------------------------------------*
*       - Leave Program                                               *
*---------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.

CASE OK_CODE.
 WHEN 'BACK'.
   LEAVE TO SCREEN 0.
ENDCASE.                             " CASE ok_code
CLEAR OK_CODE.

ENDMODULE.                             " USER_COMMAND_0100  INPUT

ABAP Programming for Material Documents for MM Module

Programming with sap abap report lists the material documents that posted for one or more materials. The report’s drill down capacity allows you to view all supporting documents. Material documents are posted with all goods movements, including those in which stock does not actually move (for example, a change in batch number for a material). Material documents are posted from transactions such as purchase order receipts, issuing components to production orders, and the “post goods issue”for a delivery on a sales order.

No prerequisites are required to run this report. However, you should limit the selection criteria to restrict the material document listing. The Setting checkboxes allow you to select different ways the output can be shown at the bottom of the selection screen .

This report generates information that can be used to find all the production order1 receipts for a set of materials in a given time period. For example, you can find all the movements of a particular material batch (lot) within a quarter. From the list, you can select (and view) any of the listed material documents. In addition to viewing a material, you can view the total stock quantities (stock overview) for the material.

This report contains data obtained from material documents and material information. As such, the data cannot be changed or manipulated from the report.

To access the first screen for this report, choose Logistics → Materials management → Inventory management → Environment → List displays → Mat.doc.for material.

1. Enter 3000 in Plant.
2. Enter 101 in Movement type.
3. Enter a date range in Posting date (for example, 01/01/1997 to 12/31/1997).
4. Choose Execute.

This screen shows a listing of material document line items arranged by material. In this example, if you scroll down to material P-100, you find two receipts made on two separate documents.


SAP ABAP Programming report in sap mm module

This abap programming report for sap in materiel management module ,you can customize this report to analyze purchase orders according to:

1. Account assignment (Lists purchase orders for a given account assignment, for example, by cost center).

2. PO number (Lists all purchase orders within a range of numbers)

3. Archived purchasing documents (Lists POs that have been removed from the system and archived)

4. Requirement tracking number (Lists all purchasing documents created with reference to a series of purchase requisitions having a certain requirement tracking number. The analysis shows the requisitions for which purchase orders have already been created.)

5. Vendor/material (Lists purchase orders created for a particular vendor, material, or material group)

If you are in the program Purchase orders by material, you must enter the Material. If you are in the program Purchase orders by account assignment, you must enter the Account assignment.

The selection options are based on the relevant purchasing document and the list can vary to some extent among documents. The more information the list contains, the more time it will take for the report to run. Larger reports should be reserved for background processing to save time.

You can combine search criteria to find a specific purchase order (for example, you could search for a PO that was issued to a specific vendor for a specific cost center in July).

The selection screen of this report includes:

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

The output of this report includes :

Listing purchase order, sorted by item number
Selection of purchase orders for individual display (double-click on the individual purchase order)

Selection of purchase order items for individual display (double-click on one of the purchase order line items, or click on it and choose History → Changes → Delivery schedule)

To access the first screen for this report, choose Logistics → Materials management → Purchasing → Purchase order → List displays → By vendor.

1. Enter 1010 in Vendor. This will produce a report of all purchase orders for this vendor.
2. Choose Execute.

This report shows all the purchase orders for vendor 1010.

From this screen, you can drill down to get more information.

3. Double-click on the PO header to access the purchase order (for example, 450005024). This screen shows the selected purchase order.
4. Choose Back to return to the original report.

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 mm materiel overview report