Jan 26, 2020

Build and use Hierarchies like GL or Cost Center for Profitability (COPA) or other reporting in S/4 HANA Fiori Apps

Now a days in S/4 HANA we have a series of Fiori Apps available for reporting that are replacing the good old fashion S_ALR_xxx reports that we used to use to report on Cost Center, Internal Order, Profit Center and others on actuals/plan. The old reports are still working fine, but they are good for GUI, not for Fiori. (Unless you call the Tcode through Fiori GUI tile)
So now you have Fiori App reports like "Cost Center - Plan/Actual YTD" or COPA "Market Segments" (replacing old fashion KE30) among others that in order for you to use the Cost Center Hierarchy or Profit Center Hierarchy on them, you first need to run a couple of programs to make them available in those Fiori Apps.
These Hierarchies are stored in the back-end as SETs like any other SETs that we used to use in Finance for all sort of needs. In order to be able to have them available for these Fiori Apps, you need to convert them into BW Hierarchies as the Fiori Apps are based on BW Queries and those don't know anything about SETs, they run with Hierarchies.

This is a 2-step process that you need to run every time you do a modification in any of those Hierarchies, so then the changes become available in the Fiori Apps.

Step #1
Tcode: HRY_REPRELEV - Set Report Relevancy for Hierarchies


As you can see in the screen capture, you can use the following Hierarchies 
  • Cost Center Group
  • Cost Element Group
  • Order (Ex Internal Order) Group
  • Profit Center Group
  • Account Group
  • WBS Element Group
  • Functional Area Group 


Once you select the Hierarchy (Set Class) that you want to use, you execute and you get the list of the available ones. In this case "Organizational Unit" is my SAP Best Practices Controlling Area "A000" and all the Groups that come with it. Depending on the Set Class you select, it could mean something different.
Then you activate the "Report Relevant" flag of the lines/lines that you want and SAVE.

Step #2
Tcode: HRRP_REP - FIN Runtime Hierarchy Replicator

This step is required to be able to replicate those previous elements as hierarchies so then the Fiori Apps will be able to use them. Without entering into to many technical details, the Fiori Apps use / show/ consume this as a kind of BW Hierarchies, and this process is required to expose them as such.

You will go, select your Hierarchy ID that you want to replicate, enter a valid from date, and select the "Run settings" for background or foreground. It does not take long to execute, so foreground should not be an issue.


This means that every time you do a change in any of the Hierarchies (GL, Cost Center, Profit Center, Internal Ordes, WBS, etc.) you need to run these 2-Step process so you will have the latest changes available for the Fiori Apps. Without this execution, you will not see the new changes.
This process can also be scheduled to run periodically, but this should only be in a context were you have constant changes.

An small example of an App that would use these hierarchies, "Cost Centers Plan/Actual YTD"


Click in "Cost Center Hierarchy", click "Go"


And you will get the list of Hierarchies that were replicated. (For confidentiality reasons, I am masking the names)


If your Company and/or Project needs to implement this, or any of the functionalities described in my Blog, or advise about them, do not hesitate to reach out to me and I will be happy to provide you my services.

Jan 2, 2020

SAP AP / AR standard Aging reports - out of the box easy

For the ones that have been around in the SAP world for quite some years like me, there has been a constant ask from customers to get an Aging report out of ECC or even S/4 like other systems have. One that would show you Customer / Vendor one-by-one with their total AP/AR and a break it down by due dates for 0-30 days, 31-60, 61-90 and so on ... Many legacy systems have this type of report and it is a must have for any AP or AR Manager to have one. Somehow this has never been the case for SAP to have it out of the box.
You can do something "similar" by using FBL1N for Vendor Line items and FBL5N for Customer line items where you will get document by document with the corresponding due Date or Arrears. But you cannot get buckets like 0,30,60,90, etc. out of it.
In the past, I have seen projects even building these reports in BW (BI later and in today's language Analytics). Another way also, was to have Custom built drill-down report (with Report Painter) to achieve this too, using AP and AR libraries.
But since SAP ECC6.0 EHP5 (and higher of course), the answer to this requirement comes out of the box. It is part of a package of reports and transactions that have been delivered to meet certain legal requirements for China. But who says that you cannot use them for any other country ? They work just fine, have no restrictions and of course they are not written in Chinese (otherwise I would not be able to read them).
The AP/AR Aging report Transaction Codes are IDCNAP and IDCNAR respectively. They are 2 separate Tcodes, but they are almost identical one another. Their principle is just the same. One of the main differences is in the selection screen of the AR Aging report, you can choose / filter by certain SD criteria like Sales Org., Distribution Channel, Division, Sales District and Sales Document.

AP Aging report (IDCNAP)

The report selection screen allows you to run the report by CoCode, Vendor, Profit Center (which for many Companies is important for AR/AP splitting thanks to Document Splitting) and some other indicators. The most important thing, you will find it at the bottom under "Due Date Sorter List". This options are the ones that will allow you to build your own Aging buckets (Ex 0-30, 31-60, 61-90 and so on ...). There is the option of building up to 8 buckets, which is way more than what any normal company would ever need. Once you setup those buckets, you execute it and you will get the data Aging built and split that way.
If you close the Transaction and come back, those bucket will not stay; so that is why I recommend you to build a Selection Variant so you do not have to enter the buckets every time.

AR Aging report (IDCNAR)

This is the AR Aging report with the added option of entering SD Data filtering by SD Organizational Structure criteria.

If you need, you also have "Dynamic Selection" criteria which gives you more selection capabilities.
Once you execute the reports, your output will look like this.

For confidentiality reasons, I am masking the Client Names and other Customer specific data.
Standard, right after execution, it comes with quite a few different subtotals (way to many for me), but it is just a matter of clicking in "Subtotal On/Off" Icon to remove it.
Once done your report will look a lot better.

As you can see you get CoCode, Credit Segment, Profit Center, of course Customer, Reconciliation Account, Total Open item, Amount Not due and then your Aging buckets as per your selection criteria. You also get a percentage calculation of that "bucket" in regards to the grand total, which you can easily remove if you don't like by changing the column layout.

As per extra columns that you can get in the layout, you already get pretty much everything, but you can also add Company Code Name and Credit Control Area.

Once the report out, you can sort up/down, filter anyway you want as with any other SAP report that has an ALV output. You can also do drill-down by double-clicking on any AR/AP bucket and you will get the exact line items that make up that amount.

So as you can see, this is the Aging report that many Customers have been asking for many years and for an unknown reason (at least to me ...), it was never built in SAP out of the box.

As I mentioned, both reports AP/AR are pretty much identical and behave the same. Different program names, but for what I could see in the code, similar program structures underneath.

The reports mention China, but there is nothing specific that will not make them applicable or usable for any other country. I have personally use them already in Canadian and US clients without any issues or limitations.

Where can you find these reports in the SAP Menu ?
They are buried inside the Country specific functions / reports for China in Accounts Payable and Accounts Receivable Menu area.

Accounts Payable Menu


Accounts Receivable Menu


If your Company and/or Project needs to implement this, or any of the functionalities described in my Blog, or advise about them, do not hesitate to reach out to me and I will be happy to provide you my services.

Nov 26, 2019

Positive Pay in S4 HANA times (1709 and up)


I will start by explaining what Positive Pay is (for those who know, you can skip this part). It is a popular Service in North American banks that they provide to prevent fraud on printed checks that you issue. You issue / print a check to pay a Vendor and you mail it via regular Post mail. At the same time, usually by the end of the day, you will produce a file as per your bank specifications for this service with all the issued checks list with date, amount and beneficiary and send it to your bank. 

Once your issued check is presented to be paid by your Vendor at the bank, they cross ref it against the info you have provided them. If any of the data does not match, they will stop the payment of that check and send you an exception notice (online). Then you will decide if the check gets paid or not. This way you can prevent check fraud by someone that could have altered any information in the check (usually amount and/or beneficiary) to get away with it. If you do not have that service, your bank could easily end up paying your check, leaving you on the hook to absorb the fraud.

A few years ago, a client of mine, had a check altered. The mail somehow was intercepted, they copied all the info in the check into a brand new check and a $450 CAD check got converted into $23k CAD check. The bank end up paying it. Luckily, for my client, we also had Electronic Bank Statement (EBS) in place and the next day the check was paid. We were trying to reconcile it, the system could not find that check number with that amount. Then we started investigating in our system and found out that check number was for $450 instead of $23k. They call right away the Bank and thanks God the bank recognized it and absorbed the hit. In this case, Positive Pay would have been ideal to directly stop it from being paid.

How we used to do Positive Pay in SAP before S/4 HANA 1709 ?


Standard SAP Tcode FCHX (Program RFCHKE00) is designed to output a file that provides this exact information (to a certain point) so you can send it to your bank. But …. There is always a but. Each and every bank has its own set of requirements when it comes to Positive Pay and the file specifications vary from Bank to bank, they are not standard like EBS or electronic payments. So this program will not work out of the box for you. If it does, you should buy a lottery ticket !

This program works with 2 internal Structures DTACHKH (Header) and DTACHKP (Line items / checks) where all the “necessary” information is output. I put necessary between quotes, because in some cases your bank might ask you for some extra info.

There were a couple of alternatives to solve this until today:

#1 – Take a copy of this program and make a Z Transaction (this is the more popular one and I have done it a couple of times already). You will also copy these 2 structures and make them Z. Then once you have a copied program, you can control the info you need, the file format, the logic, etc. That way you will output a file as per your bank specifications. If you were to need this for several banks, you will do as many Z programs as banks you have. Or you can enhance if further to have some sort of bank selection so you control different output file formats all in one program.

#2 – Modify the standard delivered structures (DTACHKH and DTACHKP) to include or remove what you need. This does not give you a lot of flexibility and you will be limited to only 1 bank. If in the future you have another bank, this approach will not work.

#3 – Do a full custom program to create your own extract and build your file as per your bank needs. At the end, all the information is somehow stored in Tables REGUP and REGUH. It is more work as you have to build a program from scratch, a selection screen, file handle, etc. In a sense is what FCHX already does. I have seen this approach being suggested by people in Internet. (Not the one I will go with).

#4 – Use FCHX the way it is out of the box, let it create the file. Then create a 2nd program that will grab this file and format it (and enhance if needed) the way you need it for your bank. (An old client of mine did it this way).

#5 – Do the same as option #4 but transform your file in your middleware directly and then send it to the bank directly from there.

As you can see there are many options with pros/cons and more or less effort.

My preferred option was always #1, up until I recently discovered a new SAP standard delivered way that comes with S/4 HANA 1709 (FPS02) which is the environment that I was working with.

How do we do Positive Pay in SAP S/4 HANA 1709 today ?


Way simpler, quicker and less custom (Z) than it used to be ….
Now Standard SAP Tcode FCHX (Program RFCHKE00) allows you to work with a DMEE structure so you can design and output your custom file as per your bank’s needs without the need for an Abap, program or structure modifications. You just design your output file with the Tcode DMEEX (Extended DMEE) and then you can output the file.

As you can see in the screen shoot below, FCHX has a line at the bottom where you can specify your “Payment Medium format”. This last line / option, was not there before in previous versions, like in ECC6.0. Now as of 1709 you have this possibility.

Then when it comes to build your output file, you work it with DMEEX (Extended, not the traditional DMEE. But it is almost the same) the same way as if you were building any other electronic payment file to your bank. But instead of this file being called by your Payment Program (F110), it will be called by FCHX.




Once you have fill out the corresponding info in your selection screen file, you will execute it and a file will be created. (see confirmation message below)


Now … Where is that file going ? It is being created in TemSe or Tcode FDTA (Fiori App “Manage Payment Media”).

Then you go there, enter your selection criteria and execute.


Once you are here, you select the line and download the file as you might already be doing with any other electronic payment file.



In this case I created a custom DMEE called “ZBOA_US_POSIPAY” as per my Bank specifications. In this case Bank of America.

With S/4 HANA 1709, there is a standard delivered DMEEX format for Positive Pay that you can use as an starting point to create your own custom DMEE. This DMEE is called “US_POSIPAY”. You will copy it and create your own Z Format. You can create as many custom DMEEs formats as banks you have. This way you do not need to change your FCHX program. You only need to change the “Payment Medium format” in the execution screen. This way you stay standard and there is no issues when it comes to an upgrade.

This saves you the need to do Abap, and you are completely independent as any Functional FICO consultant with the right knowledge can do it. It does not require development anymore.

Note: FCHX out of the box has an issue to work with any other DMEE other than standard delivered US_POSIPAY and requires you to implement an OSS Note to correct this bug. Probably I was one of the firsts in the world to have attempted to use this solution as it was not working and SAP did not know about it. I ended up reporting it to SAP via an OSS Message. It took me around 2 months of exchange with them before they finally ended up releasing this OSS Note. After that it works well. So now I am able to say that there is an OSS Note out there that was released thanks to me.
This Note applies to S4CORE 102 (1709), 103 (1809), 104 (1909).


OSS Note



If your Company and/or Project needs to implement this, or any of the functionalities described in my Blog, or advise about them, do not hesitate to reach out to me and I will be happy to provide you my services.