Você está na página 1de 11

General Ledger Breakup of Account

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.

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


1

General Ledger Breakup of Account Payables

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

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


2

General Ledger Breakup of Account Payables

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.

Functional Business Understanding


MIGO, MIRO & FB60: Basically there are two types of account payable accounting documents: One is
created via tcode MIRO and second via tcode FB60.
MIRO
These kinds of documents are created when payments are made based on GR of Purchase Orders (PO).
Before GR in PO, MIGO accounting document (type WE) is created (with reference to Material document).
When MIGO doc is created vendor was not known, hence amount payable corresponding to vendor is show
under GR/IR GL. After GR (Goods Receipt) using tcode MIRO, miro is done for MIGO document. After miro
is done, MIRO accounting document (type RE) is created with exact replica of MIGO doc, except for the fact,
amount in GR/IR GL account flow into GL accounts for vendors.
FB60
These kinds of documents are created when payments are required to be made directly to the vendors
without reference of POs. These payments might include bank guarantee, advance or incentive etc.

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


3

General Ledger Breakup of Account Payables

Business Understanding of reports


Accounts Payable Booked (APB)
This report is basically required to study expenses and their breakup under different expense heads
(grouping of GL Accounts or heads in GL account hierarchy) of company during given time frame. Based on
this study proactive efforts could be made to improve & decrease unwanted expenses.

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


4

General Ledger Breakup of Account Payables

Accounts Payable Yet to be Booked (APYB)


This report is basically required to study unaccounted expenses and their breakup under different expense
heads (grouping of GL Accounts or heads in GL account hierarchy) of company during given time frame.
Basically its output will give open MIGO documents (MIGO docs for which miro is not done yet) i.e.
corresponding goods are not receipt.

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


5

General Ledger Breakup of Account Payables

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.

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


6

General Ledger Breakup of Account Payables

Information required to write Start & End Routine


1. GLs used by user for Accounts Payables i.e. GL Accounts for different kinds of vendors involved
2. GL used for GR/IR account
3. Posting key used in line item of GR/IR GL account (in credit entry) while posting MIGO
Start Routine and End Routine
In this ABAP code we are basically grouping the documents in cube under two categories, APB & APYB out
of whole plethora of documents coming from BSEG (docs include AR, AP & AA).
In declaration part create mainly two structures- one with set of fields required to mark APB or APYB and
second for reading DSO with data of RSEG.
*******************Start routine*************
Apply a loop to group AP data of BSEG under two categories: APB & APYB using
different conditions based on GL Account, Posting Key & Credit/Debit Key.

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*************

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


7

General Ledger Breakup of Account Payables

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*************

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


8

General Ledger Breakup of Account Payables

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.

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


9

General Ledger Breakup of Account Payables

Related Content
0FI_GL_4
0FI_AP_4

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


10

General Ledger Breakup of Account Payables

Disclaimer and Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not
supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document,
and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or
code sample, including any liability resulting from incompatibility between the content within this document and the materials and
services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this
document.

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


11

Você também pode gostar