Escolar Documentos
Profissional Documentos
Cultura Documentos
Payables
Applies to:
SAP BI NetWeaver 7.0. For more information, visit the Business Intelligence homepage.
Summary
This document describes about the requirement of two reports based on Account Payables sharing common
ETL where data will be derived from GL datasource and ABAP code written in start & end routine to achieve
the same.
Author: Arun Purohit
Company: PricewaterhouseCoopers Private Limited
Created on: 13 Oct 2011
Author Bio
Arun Purohit is currently working with PricewaterhouseCoopers Pvt. Ltd. He is a SAP BI
Consultant (with ABAP & BO knowledge) with total experience is above 4.5 years on SAP
BI Implementation, developments and SAP BI/BO implementation projects.
Table of Contents
Requirement ....................................................................................................................................................... 3
Functional Business Understanding ................................................................................................................... 3
MIRO ............................................................................................................................................................... 3
FB60 3
Business Understanding of reports .................................................................................................................... 4
Accounts Payable Booked (APB) ................................................................................................................... 4
Accounts Payable Yet to be Booked (APYB) ................................................................................................. 5
ETL of Reports .................................................................................................................................................... 6
ECC Side Components ................................................................................................................................... 6
BI Side Components ....................................................................................................................................... 6
Information required to write Start & End Routine .......................................................................................... 7
Start Routine and End Routine ....................................................................................................................... 7
BEx Query........................................................................................................................................................... 9
APB report ....................................................................................................................................................... 9
APYB report .................................................................................................................................................... 9
Related Content ................................................................................................................................................ 10
Disclaimer and Liability Notice .......................................................................................................................... 11
Requirement
Our requirement was to create two reports for Account Payables, which were APB & APYB. It was expected
to show breakup of actual amount (Payable) into GLs.
APB
This report will be based on MIRO (tcode MIRO is used) accounting payable documents (or
documents created in tcode FB60) i.e. Accounting Document (Payable) of document type RE.
Any account payable document (type RE) has got two types of GL accounts in its line items. First
type of GL will indicate the Vendor account for making payment to which this payable document is
created. Second type will include all other kind of GL accounts which are related to expenses for e.g.
Material Consumption, Travel Expenses, and Local Conveyances etc. High level relation between
these two types is: Vendor GL account line items will show total payable amount while other GLs will
show its breakup in terms of services taken from vendor. In this report we are interested only in
second type of GLs. Final outcome of report will be able to show GL breakup of accounts payables
over a period of time.
APYB
This report will be based on MIGO (tcode MIGO is used) accounting payable documents i.e.
Accounting Document (Payable) of document type WE.
Any account payable document (type WE) has got two types of GL accounts in its line items. First
type of GL will be GR/IR type of GL Account. Second type will include all other kind of GL accounts
which are related to expenses for e.g. Material Consumption, Travel Expenses, and Local
Conveyances etc. High level relation between these two types is: GR/IR type of GL Account line
items will show total payable amount while other GLs will show its breakup in terms of services
taken from vendor. In this report we are interested only in second type of GLs. Final outcome of
report will be able to show GL breakup of MIGO documents over a period of time for which MIRO is
not done yet.
ETL of Reports
ECC Side Components
Standard Datasource used for ETL is: 0FI_GL_4
Underlying Tables of this datasource:
BSEG (This table stores item level data for all kinds of accounting documents)
BKPF (This table has header data of all kind of Accounting documents)
Some fields (fields from BSEG, which were not there in datasource) are enhanced as per requirement on this
datasource using standard structure CI_BSIS. This type of enhancement doesnt need writing code in
CMOD.
Customer Datasource Created: ZRSEG
Underlying Table of this datasource:
RSEG (This table stores data of MIRO material documents number with respect to Purchase Orders & MIGO
Material document numbers)
Other ECC tables related (directly or indirectly):
BSIK (Open Account Payable Documents)
BSAK (Closed Account Payable Documents)
BI Side Components
Data from 0FI_GL_4 is fed to standard DSO 0FIGL_O02, there is no standard cube available on top of this
DSO; therefore I created custom Infocube as copy of standard cube 0FIAP_C03 as ZFIGL_C03.
One additional characteristic is added to Infocube ZFIGL_C03, namely: Phase. Value is populated in this
field from start & end routine of transformation between DSO 0FIGL_O02 and cube ZFIGL_C03.
In transformation between datasource 0FI_GL_4 and DSO 0FIGL_O02, I have written a transformation code
for Expense Head characteristic for grouping of GL accounts at higher level.
Data from datasource ZRSEG is fed to custom DSO ZO_RSEG. This DSO is not used directly in reporting, it
is read in start routine of transformation between DSO 0FIGL_O02 and cube ZFIGL_C03.
Apply a loop to make ensure that any document having at least one Vendor GL
then its all items will be marked APB.
***"" In coding ignore those MIGO docs for which MIRO is done using data from
table RSEG
*********Assign this value to Exp_type....in End Routine, this is done to
display exact expense head for GR/IR line item in APB report i.e. expense head
(line item other than GR/IR) of corresponding preceding MIGO doc for this MIRO
doc.
EXIT.
ENDLOOP.
ENDLOOP.
LOOP AT IT_PHASE ASSIGNING <FS_PHASE2>
WHERE GL = 'AP_GR/IR'
AND APYB.
LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>
WHERE AC_DOC_NO = <FS_PHASE2>-DOC
AND FISCPER+0(4) = <FS_PHASE2>-FY
AND DOC_NUM = <FS_PHASE2>-PDOC
AND DOC_ITEM = <FS_PHASE2>-PITEM
AND GL_ACCOUNT NE 'AP_GR/IR'.
This is to make sure that all items of doc with at least one GR_IR item are
marked APYB.
ENDLOOP.
ENDLOOP.
Read DSO based on table RSEG to avoid those GR_IR items which are already
MIROed.
*******************End of Start routine*************
*******************End routine*************
Following loop is to populate a flag, for those documents which are having
multiple vendors. To exclude such docs, in case we want to analyse this report
based on Vendors.
LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>
WHERE 'APB'.
READ TABLE Internal Table ASSIGNING <FS_DOC>
WITH KEY DOC = <RESULT_FIELDS>-AC_DOC_NO
FY = <RESULT_FIELDS>-FISCPER+0(4).
IF SY-SUBRC = 0.
IF <FS_DOC>-COUNT > 1.
<RESULT_FIELDS>-FLAG = 'X'.
ELSE.
<RESULT_FIELDS>-FLAG = ''.
ENDIF.
ELSE.
<RESULT_FIELDS>-FLAG = ''.
ENDIF.
ENDLOOP.
LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>
WHERE GL_ACCOUNT NE 'AP_GL1'
AND GL_ACCOUNT NE 'AP_GL2'
AND GL_ACCOUNT NE 'AP_GL3'
AND GL_ACCOUNT NE 'AP_ADV_GL3'
AND GL_ACCOUNT NE 'AP_ADV_GL2'
AND GL_ACCOUNT NE 'AP_ADV_GL1'
AND /BIC/ZPHASE = 'APB'
AND FLAG NE 'X'.
IF <RESULT_FIELDS>-CREDITOR EQ SPACE.
LOOP AT IT_PHASE ASSIGNING <FS_PHASE>
WHERE DOC = <RESULT_FIELDS>-AC_DOC_NO
AND FY = <RESULT_FIELDS>-FISCPER+0(4)
AND ( GL = 'AP_GL1'
OR GL = 'AP_GL2'
OR GL = 'AP_GL3'
OR GL = 'AP_ADV_GL1'
OR GL = 'AP_ADV_GL2'
OR GL = 'AP_ADV_GL3')
AND VENDOR NE SPACE.
<RESULT_FIELDS>-CREDITOR = <FS_PHASE>-VENDOR.
EXIT.
ENDLOOP.
ENDIF.
ENDLOOP.
*******************End of End routine*************
BEx Query
APB report
In this report restriction can be set on characteristic Phase with value APB, so as to show values of APB
only. Filter on GL account to exclude AP GLs, as break up of AP GL amounts is required in terms of other
GLs.
APYB report
In this report restriction can be set on characteristic Phase with value APYB, so as to show values of APYB
only. Filter on GL account to exclude GR/IR GLs, as break up of GR/IR GL amounts is required in terms of
other GLs.
Related Content
0FI_GL_4
0FI_AP_4