Documente Academic
Documente Profesional
Documente Cultură
Applies to:
This document will help you understand some of the Capabilities and Features of Replacement path
Variables used in BEx. For more information, visit the EDW homepage.
Summary
This document will explain you one of the complex scenarios related material movement to be handled at BI
reporting layer. It also provide sample scenario to achieve this kind of requirement with the help of
replacement path.
Author: Ankit Udeshi
Company: Capgemini Consulting Pvt Ltd.
Created on: 12th May 2010
Author Bio
Ankit Udeshi is working with Capgemini Consulting for around two year now. He is involved in SAP BI
Implementation projects.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 1
Purchase Order History Tracking
Table of Contents
Scenario ....................................................................................................................................................... 3
Functional Help ............................................................................................................................................. 4
GR Cancellation Information ...................................................................................................................... 4
Implementing the Scenario ............................................................................................................................ 4
Datasource Enhancement ......................................................................................................................... 4
Modeling ................................................................................................................................................... 6
Mapping Datasource to BI............................................................................................................................................ 6
Handling in BEx ......................................................................................................................................... 6
Reference Query .......................................................................................................................................................... 6
Rows ............................................................................................................................................................................ 6
Variables ...................................................................................................................................................................... 6
Output of reference query:- .......................................................................................................................................... 6
Actual Query ................................................................................................................................................................ 7
Rows:-.......................................................................................................................................................................... 7
Variables:-.................................................................................................................................................................... 7
Global Restriction:- ...................................................................................................................................................... 7
Output of Query ............................................................................................................................................ 9
Case 1:- .................................................................................................................................................... 9
Case 2:- .................................................................................................................................................... 9
Output:- ........................................................................................................................................................................ 9
Case 3:- .................................................................................................................................................. 10
Related Content .......................................................................................................................................... 11
Disclaimer and Liability Notice ..................................................................................................................... 12
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 2
Purchase Order History Tracking
Scenario
Report is based on Purchase order created and Good Receipt Done. There are some challenging scenario
from users that are listed below.
It should display actual GR posting as well as GR that are reversed wrt to actual posting for
particular purchase order.
If user will enter GR date in user selection screen where actual GR is done as then it reversed on the
next day. Then user get a output as both the record, one for actual posting on GR date and another
for reversal wrt to actual posting (It may not be equal to GR date that user will enter in Variable
screen).
ME23N screen for Purchase order history for particular PO.
If user will enter GR date as 02/25/2009 then in output there will be two record one for 02/25/2009 with
Movement type 101 and other for 02/27/2009 with movement type 102.
If user will enter GR date as 02/27/2010 in variable screen, then there will be NO record in output.
If user will enter GR date as 03/03/2009 in variable screen, then there will be only one record in
output with GR date as 03/03/2009 with movement type as 101.
If user will run this report freely, without any restriction then there will be three record associated with
this PO number and PO Item.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 3
Purchase Order History Tracking
Functional Help
GR Cancellation Information
GR document is generally cancelled using Transaction Code MIGO or MBST. Once you cancel the GR
document it will keep the document number of your GR in the MSEG-SMBLN field as a reference.
With reference to above example.
Material Document Number 5000022267 is cancelled, hence material document number 5000023289 is
created with movement type 102.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 4
Purchase Order History Tracking
IT_SGR[] = C_T_DATA[]
select MBLNR " Mat. Doc. No.
ZEILE " Mat. Doc Item No.
SMBLN " Mat. Doc. No.___1
EBELN " PO No.
EBELP " PO Item No.
from MSEG
into table itab_MSEG
FOR ALL ENTRIES IN it_SGR
WHERE EBELN = IT_SGR-EBELN
AND EBELP = IT_SGR-EBELP
AND BELNR = IT_SGR-BELNR.
AND SMBLN <> ''.
loop at c_t_data into l_sgr.
read table itab_mseg into wa_mseg
with key EBELN = l_SGR-EBELN
EBELP = l_SGR-EBELP
MBLNR = l_sgr-belnr
ZEILE = l_sgr-BUZEI.
if sy-subrc = 0.
l_sgr-ZZSMBLN = wa_mseg-SMBLN.
else.
l_sgr-ZZSMBLN = l_sgr-BELNR.
endif.
clear wa_mseg.
Endloop.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 5
Purchase Order History Tracking
Modeling
Mapping Datasource to BI
Get both the field Material document Number and reference document (Enhance field) in BI. Get the both the
field till reporting layer.
For Reference map, Material document Number (BLNR) to 0MATL_DOC and Reference Material document
number (ZZSMBLN) to ZMATL_DOC.
Output of your Final reporting layer will be similar to data show below.
Handling in BEx
Reference Query
Need to create one reference query that will have all variable and it will be further used in our main query.
Let refer this Query as ZPPV_M03_REP_PATH. Query structure will be as show below.
Rows
Material Document - 0MAT_DOC ( G/R No.)
Variables
All the restriction that users need at variable screen can be specified in this query. It will help to boost the
query performance.
Query Output:-
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 6
Purchase Order History Tracking
Actual Query
This query will refer reference query to get its global restriction.
Rows:-
Entire set of characteristic that are required by user.
Variables:-
All the restriction that users need at variable screen can be specified in this query. It will help to boost the
query performance. Specify the same variables that are used in reference query.
Global Restriction:-
It will have ZMATL_DOC begin restricted with a variable type Replacement Path.
This replacement path variable will refer 0MATL_DOC from reference query.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 7
Purchase Order History Tracking
Logic:-
When we execute the query for Material = 611252 and GR Date = 02/25/2009
Output from reference query will be a single record.
When we Restrict 0MATL_DOC to ZMATL_DOC in actual query with replacement path you will find two
record.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 8
Purchase Order History Tracking
Output of Query
Case 1:-
Selection: Material = 611252 and GR Date = 02/25/2009
Case 2:-
Selection: Material = 611252 and GR Date = 02/27/2009
Variable Screen:
Output:-
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 9
Purchase Order History Tracking
Case 3:-
Selection: Material = 611252 and GR Date = 03/03/2009
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 10
Purchase Order History Tracking
Related Content
Help.sap.com
Movement Type
For more information, visit the EDW homepage
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 11
Purchase Order History Tracking
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 12