Nov 12, 2021

How to manage Company Code Registration numbers that belong to other Country different than the one in your Company Code ?

When you create a Company Code in SAP for a specific country (Ex. US), the Company Code will allow you enter certain additional parameters for that Company Code that are typical for a Country US to have them. (Ex. TIN - Tax Identification Number, and some other registration numbers that are typically required for companies doing business in the US).

For example, for Canada you will need to enter the GST Registration number, PST or QST numbers as well since your Company Code will be in country CA.

This is an important piece of information that is typically needed for Legal requirements in many countries to issue invoices showing your Registration number when you print an invoice or send information to the banks, Tax agencies or other regulatory entities. So this becomes a MUST HAVE to have it available in the system ready to be used by any of these processes.

But now, what happens if you have a US Company Code, that is registered in Canada and you need to enter the GST Number for it ?

In standard SAP configuration, you will not be able to do it within the Company Code Global settings (or Maintain Additional Parameters as of S/4 HAHA 1709), those fields for GST number will not be available since your Company is in country US and that is not required in the US.

How do you enter this in your US Company Code ?

There are 2 options

This configuration to allow you to enter this parameters is based on "Parameters Types" that are preconfigured for certain countries. In the case of GST Number, it is Parameter Type F29T01. You can look for your specific Parameter Type in Table T001I

Option # 1


SM30 on Table V_T001I


Remove country CA for this record "Parameter Type" = F29T01

If you do that, this will make type F29T01 available for any Company Code regardless of the Country. So all Company Codes all of a sudden will have available the GST Number to be entered  even belonging to any country in the world. (For me this is not the preferred approach).

Option # 2

SM30 on Table  V_T001S4H

Enter a new entry for F29T01 record and assign it to country US. If you look for F29T01, it is already assigned to Country CA as well.

This will allow to enter the GST Number for all US CoCodes. For me, this should be the preferred approach as it only affects Country US and not all countries.

Be aware that this could be overwritten by an SAP upgrade, so it might need to be redone later.

Once you are done with the configuration, you will be able to enter the foreign registration numbers in your Company Code within Company Code Global Parameters or Additional Parameters.

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

Aug 5, 2021

How to send the different Finance outputs via email ?

A typical Business requirement now a days in today's world is to send certain Finance Outputs via email automatically from SAP as soon as you generate them. In S/4 HANA on-premise (and ECC as well), to be able to achieve this you need to deal with a little bit of custom code that needs to be added and managed in BTE's (Business Transaction Events). These ones are similar to any other User Exit.

As you might know already, there are different automatic processes in SAP that trigger outputs and when these are created, these BTEs will be called and eventually the generated outputs will be sent via email by SAP automatically if you put the appropriate code on them.

I will be talking in these post about 4 different important and key Finance Outputs:

    • Vendor Payment Advice
    • Customer Statement
    • Dunning Notice
    • Interest 

In this post I will NOT explain you how to execute the programs that generate them, what options and/or values to put in the screens. As a Consultant you should know how to run these "user" steps already. There are plenty of content about this on the Internet already. This Blog post is not for that, is to explain you the technical side of what you need to do to achieve sending these Outputs via email.

Each one of these Outputs have at least 1 (some even 2) Function Modules that need to be coded to be able to control if the output goes to the Spool, Email / Internet or Fax (nobody uses a Fax anymore). Other things that you can control too are the Sender email, Recipient email, email Subject and email body text. All of these can be managed as part of your custom code.

These FMs get assigned in Tcode FIBF and are based on a Transaction Event number that corresponds to each one of these different outputs. You cannot reuse the same code for all of them, but the idea and logic can be replicated for all of them.

1st you need to start by "registering" your Product / Output for the ones you will be dealing with. In my case, ZDUN, ZPADV_EM, ZPADV_SJ. But you can put any Product name / code that you want, then you need to flag the "Active" field as well; otherwise it will not be called.

Then once you have your Function Modules with your Custom code, you need to enter the FMs.

You go into Process Modules -> of a customer to assign them.

You make entries in this table to assign here the FMs that you have coded to manage the different options like (sender / receiver email, subject and body text). As you can see, the Process numbers represent the individual outputs.

Payment Advice

Payment Advice has 2 processes 2040 and 2050. 

Process 2040, allows you to manage Sender email address, Recipient email address, Mail Body Text and the type of Transmission Method 

  • c_finaa-nacha = '1'  - Spool
  • c_finaa-nacha = 'I'  - Internet / Email

For this SAP gives you a "Sample" FM that you can use as a base to copy and insert you own custom code. This is SAMPLE_PROCESS_00002040

Process 2050, allows you to manage email Subject

For this SAP gives you a "Sample" FM that you can use as a base to copy and insert you own custom code. This is SAMPLE_PROCESS_00002050

Customer Statement

Process 2310. This one allows you to manage Transmission method, Format (PDF), Mail Body, Mail Subject, Sender and Recipient email address.

For this SAP gives you a "Sample" FM that you can use as a base to copy and insert you own custom code. This is SAMPLE_PROCESS_00002310

Dunning Letter

Process 1040. This one allows you to manage Transmission method, Format (PDF), Mail Body, Mail Subject, Sender and Recipient email address.

For this SAP gives you a "Sample" FM that you can use as a base to copy and insert you own custom code. This is SAMPLE_PROCESS_00001040.

Interest Output

For the Interest Calculation done out of FINT Tcode, I will refer you to the below Blog post where it explains Badi FI_INT_CUS01 that needs to be implemented to manage all the same things that we did for the other Outputs. 

By the way, excellent Blog this one for Abap resources. 

The specific Abap code of each one of these Function Modules need to be done based on your particular case. I am not providing you the code in this Posting. Maybe this will be the subject of a subsequent Post.

** Note: This process applies to S/4 HANA On-Premise (ECC as well) only. For S/4 HANA Cloud the solution is completely different and based on the new Output Management Solution that works with BRF+ technology. I am not aware that this has changed for S/4 HANA 2020 version either. If you know, please let me know ...

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

Some Reference OSS Notes:

◈ Payment Advice: OSS 1033893, 836169
◈ Dunning: OSS 1042992
◈ Customer correspondence (Ex. Statement): OSS 1360070
◈ Interest : OSS 956981

May 3, 2021

Send any Material price from one Plant to another without any custom development

A typical requirement from multiple clients that I had in the past, was to be able to send, copy or propagate Material prices (costs) from one Plant to another. In certain manufacturing scenarios that is not a problem, because one Plant might be manufacturing one product to a certain stage and the other Plant picks it up and continues manufacturing this Material. In this case, the 2nd Plant has a BOM (Bill of Material) that includes the Supplying Plant. This way when you do the Cost calculation, everything flows automatically. 

But ... 

  • What happens when you reach the final Production Plant and then you send it to other Plants that are just Warehouses or Distribution Centers ? (with no transformation here)
  • How do you update the prices in those DCs when your standard costs changes in the Manufacturing Plants, so you can revalue your inventory ?
  • Is there a way to do it for hundreds or thousands of Materials and multiple Plants without having to develop a mass upload program ? (There is a new Fiori App to upload Material prices from XLS, maybe I can talk about it on another post. But it is not the same as this solution and requires manual work and one XLS per Currency Type that you might have).
  • How can you avoid doing manual MR21 price changes and tons of copy & paste in that screen ?
  • How can you avoid doing a custom program development to do this ?
  • How can you avoid doing an LSMW out of MR21 to automate this ?

Well ... There is a way that I found a few months, that works like a charm and does not require any custom developments !!! zero !!!

The Solution

Transaction CKML_PRICES_SEND could do that for you with some extra tweaks ... !
First reaction someone that knows FICO would tell me ... "well it starts by CKML, it is a Material Ledger Tcode, I don't have Material Ledger or I don't want to deal with Material Ledger ...". Even if it starts by CKML, it is not Material Ledger exclusive, it can be used without Material Ledger being active too.

Note: As per OSS Note 646630 - Send Material Prices and BAPI_MATVAL_PRICE_CHANGE usage, this solution has been arround since R/3 4.7 and it is part of the Enterprise Extension EA-FIN. So you can use it in ECC and S/4 HANA any version as well. I am using it in S/4 HANA 1909.

This Transaction is designed to be used with Distributed Systems where you need to send Material Prices to other SAP systems, but with a few 100% standard tricks, no code modification, you could use it within your same system. 

This Transaction triggers and Outbound Idoc (Message Type MATERIALVALUATION_PRICECHANGE) that contains all the necessary info for price changes. The Idoc will go out from your system and come back right into as an Inbound Idoc. Once successfully posted, your Target Plant will have its Price updated. It will trigger one Idoc per Material. You have to execute it individually per Target Plant. You could do it for all Materials, or for certain ones, Valuation types, Stock Type, Material Type and many other filtering options.

How ?

Step #1 - Do config in Table VCKML_PRICE_SEND (SM30)

The Target Plant needs to have an entry in this Table, so you need to add it here manually and save it in a Transport. This is the only step that needs to be done in your Golden configuration Client. All the other Steps need to be done individually in the all the Transactional environments (Unit Testing, QA, pre-PROD and PROD).

Step # 2 - Define a Logical System

Tcode SALE or BD54 directly, to create a "fake" Logical System. (This depending on your environment you might be able to do it yourself as an SAP Finance Consultant or you will have to ask your Basis Team to do it for you).

This fake Logical System will be used later in the Distribution Model. We need a "fake" one because within the Model, you could not use as Source and Target the same Logical System, so that is why we have to fake it. If you understand what I am talking about, you might be guessing already how this all ends .... If not, keep on reading ...

In my case my real Logical System is SX4CLNT050, so I created a fake Logical System called SX4CLNTX50.

Step # 3 - Create an ALE Distribution Model

As I mentioned, this needs to be done on each environment as it is specific to the Logical System names that you will have on each environment.

Tcode SALE

Create the Distribution Model

Add a BAPI 

BAPI MaterialValuation
Method PriceChange

End result will be like this, where the Receiver server will be your dummy / fake Logical System.

Step # 4 - Create a Port that calls the RFC of your own Client

Tcode: WE21. Before creating the Partner Profiles, you need to define a Port that will be used by the Outbound Idoc. In this case, the Port needs to be pointing to an RFC for the same Client that you are in. In my case SX4CLNT050. By doing this, you will trick the system to send the Idoc to a Port that it is also within the same system (go out, to come back in within itself). This is the KEY part of this whole Solution to make it work.

Step # 5 - Maintain Outbound Partner Profile for Logical System

Tcode: WE20. Here the Partner System (LS) will be the same I input in my Distribution Model and fake Logical System "SX4CLNTX50" as Receiver with the Port that I just created that points to an RFC of the same Client.

Step # 6 - Create Inbound Partner Profile
Now we will create the Inbound Partner Profile for the real Logical System (SX4CLNT050).

Process Code It could be BAPI or BAPP

Make sure this is ACTIVE, because it could become INACTIVE in some cases.

Once you completed the Setup and different steps, you are ready to Send your Material Prices with CKML_PRICES_SEND

An Outbound IDOC will be created and then another Inbound IDOC will be created as well. The Inbound will end up posting the PRICE CHANGE Document.


  • This process will still work if the Sending Plant Material has Price Control S - Standard (or V - Moving avg.) and the Target Plant Material has S or V. It will still update it. For sure, this does not apply to a Target S Price where it is a Costed Material with a Cost Component split. In that case you still need to execute a Cost Estimate calculation.
  • Each MATVAL_PRICES IDoc segment will represent the Different Material Valuations / Currency Types active in the system (Ex. In my case 10, 30, 31)
  • This process only works within CoCodes that have the same currencies. You cannot transfer a price from one CoCode that has Currency 10 = CAD to Currency 10 = 10 USD. It will not work, you will get a currency error because the Outbound Idoc contains CAD and the Inbound Idoc too while it should have 10 - USD, there is no transformation in between. So the only way for you would be to pass it through a Middleware, and recalculate with the new Currency, if needed.
  • For an unknown reason, my Inbound IDOCs are not getting process automatically, instead I have to go and trigger the process to post them manually based on their actual status. So you can always schedule the program that posts them periodically to remediate this situation.

Once the Document has been posted, you could verify it by Displaying the Material Document (CKMPCD) or the Material Master Accounting View or the FI Document too.

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