The purpose of this program is to highlight goods receipts (GR) that have no corresponding invoice receipts (IR). Either the invoice has not been received, or it has not been keyed in, or it was keyed in incorrectly.
The program is written as an interface for an ABAP Query. The output should be like that of ME2L (Purchasing IS), except that the format is different, and only those items with different quantities for GR and IR are listed. The code is not very optimized. The only advantage of using it as an ABAP Query is being able to quickly change the online format, sorting, etc.
Outstanding IRs from PO
*&---------------------------------------------------------------------*
*& Report ZGR-IR *
*& *
*&---------------------------------------------------------------------*
*& Used for ABAP Query to list goods received that have not been *
*& fully invoiced *
*&---------------------------------------------------------------------*
REPORT ZGR-IR.
TABLES: EKBE. "Define Dictionary structure
* Conditions to limit search
SELECT-OPTIONS: PO_DOC FOR EKBE-EBELN, "Purchase order
PO_ITEM FOR EKBE-EBELP, "Purchase order item
POSTDATE FOR EKBE-BUDAT, "GR Posting Date
MAT_NR FOR EKBE-MATNR. "Material number
DATA: GOODSRCVD LIKE EKBE-MENGE, "goods received in units
GOODSINVOICED LIKE EKBE-MENGE, "goods invoiced in units
LAST_EBELN LIKE EKBE-EBELN, "to keep track of already processed POs
LAST_EBELP LIKE EKBE-EBELP, " and PO items
BEGIN OF SUMS OCCURS 4,
BEWTP LIKE EKBE-BEWTP,
MENGE LIKE EKBE-MENGE,
SHKZG LIKE EKBE-SHKZG, "Debt/Credit indicator
END OF SUMS.
*
* check header GR documents for un-invoiced inventory
SELECT * FROM EKBE
WHERE BWART = '101' AND " GR document
EBELN IN PO_DOC AND
EBELP IN PO_ITEM AND
BUDAT IN POSTDATE AND
MATNR IN MAT_NR
ORDER BY EBELN EBELP BELNR.
CHECK " only get the header one
NOT ( EKBE-EBELN = LAST_EBELN AND EKBE-EBELP = LAST_EBELP ).
LAST_EBELN = EKBE-EBELN.
LAST_EBELP = EKBE-EBELP.
CLEAR SUMS. CLEAR SUMS[].
SELECT BEWTP MENGE SHKZG FROM EKBE INTO SUMS
WHERE EBELN = EKBE-EBELN AND EBELP = EKBE-EBELP.
COLLECT SUMS.
ENDSELECT.
GOODSRCVD = 0. GOODSINVOICED = 0.
LOOP AT SUMS. "sums table should now have 4 totals
IF SUMS-SHKZG = 'S'. "positive value
IF SUMS-BEWTP = 'E'. "goods received
GOODSRCVD = GOODSRCVD + SUMS-MENGE.
ELSE. "goods invoiced
GOODSINVOICED = GOODSINVOICED + SUMS-MENGE.
ENDIF.
ELSE. " negative value
IF SUMS-BEWTP = 'E'. "goods received
GOODSRCVD = GOODSRCVD - SUMS-MENGE.
ELSE. "goods invoiced
GOODSINVOICED = GOODSINVOICED - SUMS-MENGE.
ENDIF.
ENDIF.
ENDLOOP.
IF GOODSRCVD = GOODSINVOICED. "amount received = amount invoiced
CONTINUE.
ELSE.
EKBE-BPMNG = GOODSRCVD - GOODSINVOICED. "missing invoice amount
ENDIF.
*
ENDSELECT.
*&---------------------------------------------------------------------*
*& End of Report ZGR-IR *
*& *
*&---------------------------------------------------------------------*
Showing posts with label Find GRs without IRs. Show all posts
Showing posts with label Find GRs without IRs. Show all posts
Friday, November 23, 2007
ABAP/4 Program: Find GRs without IRs
Labels:
Find GRs without IRs
Subscribe to:
Posts (Atom)
Blog Archive
-
▼
2009
(81)
-
▼
June
(81)
- Lists in Unicode Systems
- The File Interface in Unicode Programs
- Character String and Byte String Processing in Uni...
- Structure Enhancements and Unicode Programs
- Structure Typing in Unicode Programs
- Conversion of Structures in Unicode Programs
- Access to memory sequences in Unicode programs
- Offset and Length Specifications in Unicode Programs
- Alignment in Unicode Systems
- Operand Types in Unicode Programs
- Names in Unicode Programs
- Comments and Literals in Non-Unicode Programs
- Differences between Unicode and Non-Unicode Programs
- Unicode - Overview
- Statements in Class and Interface Pools
- Statements for Defining Classes and Interfaces
- ABAP Objects - Keywords
- Inheritance Events
- Inheritance and Events
- Inheritance and Instantiation
- Inheritance and Constructors
- Inheritance and Static Components
- Inheritance and the Component Namespace
- Inheritance and Visibility
- Inheritance and Interfaces
- Inheritance and Polymorphism
- Abstract and Final Methods and Classes
- Redefining Methods
- Inheritance
- Definition of Classes and Interfaces
- Object Orientation
- CLASS-METHODS - FOR EVENT
- CLASS-METHODS - class_constructor
- CLASS-METHODS - RETURNING
- METHODS - IMPORTING, EXPORTING, CHANGING, RAISING
- CLASS-METHODS - IMPORTING, EXPORTING, CHANGING, RA...
- CLASS-METHODS
- Kernel Methods
- The C Destructor in Methods
- Interface Parameters in Methods
- Data Types and Constants
- Events In Components of classes
- Constructors In Components of Classes
- Methods in Components of classes
- Attributes
- Visibility Sections in Classes
- Components of Classes
- Classes
- ABAP Objects
- ABAP Programming Language - Overview
- Example of a Logical Database
- Logical Databases
- Position of the Basis System Within the R/3 System
- Running ABAP Programs
- Calling ABAP Dialog Modules
- Data Types in the ABAP Dictionary
- Pushbuttons on the Screen
- Processing Input/Output Fields
- Processing Screen
- Screens
- ABAP User Dialogs
- Reduce the Database Load
- Minimize the Search Overhead
- Minimize the Number of Data Transfers
- Minimize the Amount of Data Transferred
- Keep the Result Set Small
- Performance Notes
- Committing Database Changes
- Inserting or Changing Lines
- Deleting Lines
- Changing Line
- Inserting Lines into Tables
- Changing Data
- Reading Data
- Open SQL
- Checking User Authorizations
- Accessing the Database in the R/3 System
- ABAP Database Access
- ABAP HR Programming
- ABAP Tutorials for Beginners
- Download Abap certification material
-
▼
June
(81)
