SAP OIJ_METER_CALC Function Module for Calculate the quantity from opening & closing reading
OIJ_METER_CALC is a standard oij meter calc SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Calculate the quantity from opening & closing reading processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for oij meter calc FM, simply by entering the name OIJ_METER_CALC into the relevant SAP transaction such as SE37 or SE38.
Function Group: OIJ_METER
Program Name: SAPLOIJ_METER
Main Program: SAPLOIJ_METER
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function OIJ_METER_CALC pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'OIJ_METER_CALC'"Calculate the quantity from opening & closing reading.
EXPORTING
I_TSYST = "Transport system
I_TICKET_ITEM = "OIL-TSW: Ticket item number
I_TICKET_VERSION = "OIL-TSW: Ticket version
I_TICKET_PURPOSE = "OIL-TSW: Ticket purpose
* I_NO_CLOSING_RDG = ' ' "
I_LOCID = "Location ID
I_METER = "GMM: Sequence number of meter assigned to customer
I_METER_RDG_O = "GMM: Start counter reading
I_TIME_O = "UTC time stamp in short form (YYYYMMDDhhmmss)
I_METER_RDG_C = "GMM: End counter reading
I_TIME_C = "UTC time stamp in short form (YYYYMMDDhhmmss)
I_MATNR = "Material number
I_TICKET_KEY = "OIL-TSW: Ticket key
IMPORTING
E_QUANTITY = "Scheduled qty
E_QTY_UOM = "General unit of measure
EXCEPTIONS
NO_LOCATION_METER = 1 INVALID_READING = 2 INVALID_METER = 3 INVALID_READING_TIME = 4
IMPORTING Parameters details for OIJ_METER_CALC
I_TSYST - Transport system
Data type: OIJ_TSYSTOptional: No
Call by Reference: Yes
I_TICKET_ITEM - OIL-TSW: Ticket item number
Data type: OIJ_EL_TKT_POSNROptional: No
Call by Reference: Yes
I_TICKET_VERSION - OIL-TSW: Ticket version
Data type: OIJ_EL_TKT_VERSIONOptional: No
Call by Reference: Yes
I_TICKET_PURPOSE - OIL-TSW: Ticket purpose
Data type: OIJ_EL_TKT_PURPOSEOptional: No
Call by Reference: Yes
I_NO_CLOSING_RDG -
Data type:Default: ' '
Optional: Yes
Call by Reference: Yes
I_LOCID - Location ID
Data type: OIJ_LOCIDOptional: No
Call by Reference: Yes
I_METER - GMM: Sequence number of meter assigned to customer
Data type: OII_GSEQNROptional: No
Call by Reference: Yes
I_METER_RDG_O - GMM: Start counter reading
Data type: OII_STCOUNOptional: No
Call by Reference: Yes
I_TIME_O - UTC time stamp in short form (YYYYMMDDhhmmss)
Data type: TIMESTAMPOptional: No
Call by Reference: Yes
I_METER_RDG_C - GMM: End counter reading
Data type: OII_ENCOUNOptional: No
Call by Reference: Yes
I_TIME_C - UTC time stamp in short form (YYYYMMDDhhmmss)
Data type: TIMESTAMPOptional: No
Call by Reference: Yes
I_MATNR - Material number
Data type: MATNROptional: No
Call by Reference: Yes
I_TICKET_KEY - OIL-TSW: Ticket key
Data type: OIJ_EL_TKT_KEYOptional: No
Call by Reference: Yes
EXPORTING Parameters details for OIJ_METER_CALC
E_QUANTITY - Scheduled qty
Data type: OIJ_MENGEOptional: No
Call by Reference: Yes
E_QTY_UOM - General unit of measure
Data type: OIJ_UNITOptional: No
Call by Reference: Yes
EXCEPTIONS details
NO_LOCATION_METER -
Data type:Optional: No
Call by Reference: Yes
INVALID_READING -
Data type:Optional: No
Call by Reference: Yes
INVALID_METER -
Data type:Optional: No
Call by Reference: Yes
INVALID_READING_TIME -
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for OIJ_METER_CALC Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_i_tsyst | TYPE OIJ_TSYST, " | |||
| lv_e_quantity | TYPE OIJ_MENGE, " | |||
| lv_no_location_meter | TYPE OIJ_MENGE, " | |||
| lv_i_ticket_item | TYPE OIJ_EL_TKT_POSNR, " | |||
| lv_i_ticket_version | TYPE OIJ_EL_TKT_VERSION, " | |||
| lv_i_ticket_purpose | TYPE OIJ_EL_TKT_PURPOSE, " | |||
| lv_i_no_closing_rdg | TYPE OIJ_EL_TKT_PURPOSE, " ' ' | |||
| lv_i_locid | TYPE OIJ_LOCID, " | |||
| lv_e_qty_uom | TYPE OIJ_UNIT, " | |||
| lv_invalid_reading | TYPE OIJ_UNIT, " | |||
| lv_i_meter | TYPE OII_GSEQNR, " | |||
| lv_invalid_meter | TYPE OII_GSEQNR, " | |||
| lv_i_meter_rdg_o | TYPE OII_STCOUN, " | |||
| lv_invalid_reading_time | TYPE OII_STCOUN, " | |||
| lv_i_time_o | TYPE TIMESTAMP, " | |||
| lv_i_meter_rdg_c | TYPE OII_ENCOUN, " | |||
| lv_i_time_c | TYPE TIMESTAMP, " | |||
| lv_i_matnr | TYPE MATNR, " | |||
| lv_i_ticket_key | TYPE OIJ_EL_TKT_KEY. " |
|   CALL FUNCTION 'OIJ_METER_CALC' "Calculate the quantity from opening & closing reading |
| EXPORTING | ||
| I_TSYST | = lv_i_tsyst | |
| I_TICKET_ITEM | = lv_i_ticket_item | |
| I_TICKET_VERSION | = lv_i_ticket_version | |
| I_TICKET_PURPOSE | = lv_i_ticket_purpose | |
| I_NO_CLOSING_RDG | = lv_i_no_closing_rdg | |
| I_LOCID | = lv_i_locid | |
| I_METER | = lv_i_meter | |
| I_METER_RDG_O | = lv_i_meter_rdg_o | |
| I_TIME_O | = lv_i_time_o | |
| I_METER_RDG_C | = lv_i_meter_rdg_c | |
| I_TIME_C | = lv_i_time_c | |
| I_MATNR | = lv_i_matnr | |
| I_TICKET_KEY | = lv_i_ticket_key | |
| IMPORTING | ||
| E_QUANTITY | = lv_e_quantity | |
| E_QTY_UOM | = lv_e_qty_uom | |
| EXCEPTIONS | ||
| NO_LOCATION_METER = 1 | ||
| INVALID_READING = 2 | ||
| INVALID_METER = 3 | ||
| INVALID_READING_TIME = 4 | ||
| . " OIJ_METER_CALC | ||
ABAP code using 7.40 inline data declarations to call FM OIJ_METER_CALC
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| DATA(ld_i_no_closing_rdg) | = ' '. | |||
Search for further information about these or an SAP related objects