cancel
Showing results for 
Search instead for 
Did you mean: 

Billing Document Output Determination - Email recipient using BRF+

rchudziak
Participant
0 Kudos

Hi,

I am trying to set up the e-mail receivers in transaction OPD for a Billing Document.

The solution from the post below works as expected for the default mail address (which is selected from the business partner): https://answers.sap.com/questions/13416373/in-the-app-output-parameter-determination-how-to-a.html

What I would like to achieve is to query the database table using a function module to get the company's clerk email address.

1. I took a copy of the BRF application OPD_APOC_SYSTEM under customer namespace
2. I have created a function module with one exporting parameter (email) and hard coded the e-mail inside the FM - just for testing
3. I have created an expression (procedure call) and mapped it to the FM created above (this resembles the constant expression as provided with the standard object)

4. I have entered the expression in tx. OPD (Billing Document - Email Recipient) - just like for the constant expression in the original sap forum question

This seems to work fine. When creating an invoice, the debugging break point in the FM gets triggered and the hard coded e-mail address (inside the FM) is returned.

Now, the issue is with importing parameters. I would like to select the e-mail address based on 'Role' and 'Receiver ID' as shown in the decision table columns above - I want to pass them to the function module. But these parameters seem to be contained in the context of application OPD_V3_BILLING_DOCUMENT - with visibility Application. Which means I am unable to use these parameters inside my application OPD_APOC_SYSTEM and map the context parameter to the importing parameter of the function module. They appear as 'Filtered Objects' in the search criteria:

with the source Application of ‘OPD Billing Document' whereas my application is 'APOC System'. Obviously I am unable to edit OPD_V3_BILLING_DOCUMENT as this is a standard SAP object.

Is there a way to pass the context parameters from one BRF application e.g. OPD_V3_BILLING_DOCUMENT to another e.g. OPD_APOC_SYSTEM, or am I on the wrong track and should approach it from a different angle. Or is it just SAP's limitation?

Accepted Solutions (1)

Accepted Solutions (1)

rchudziak
Participant

Resolved this by taking a copy of class CL_BILLING_OUTPUT_CONTROL and editing method IF_APOC_COMMON_API~GET_DATA_FOR_ROLE to overwrite the default email address.

Then this class is set to be used in SPRO->Cross-Application Components->Output Control->Define Output Types for a Billing document custom output type

So looks like achieving this through BRF+ may not be possible.

vishal006
Explorer
0 Kudos

Hi radek_c ,

I had a similar requirement wherein we were trying to setup email receivers in OPD for Sales Quotation.


I followed similar steps as you did, the only change was that I created a custom application instead of copying the standard. Once that was done I added a function module with 2 importing parameters('Role' and 'Recipient') and 1 exporting parameter('Email'). This FM was mapped with the expression(Procedure call)


Now for the importing parameters, unlike you I did not use the parameters from the context of standard application. As you mentioned these have the scope 'Application' and cannot be used in custom z application.
Instead I added two elements i.e Recipient and Role individually in the context of my FM.


These elements have the values of Role and Recipient from the decision table columns. These were then mapped with respective input parameters of FM.

This way I was able to write custom logic for Email based on Role and Recipient.



goncalonunes
Discoverer
0 Kudos

Hello vishal006 ,

How are you doing?

We are trying to achieve exactly the same. We followed the approach you mentioned but, still, we cannot access the OPD Sales Context Parameters in our custom BRF. Can you please elaborate further? You created a Function that has your procedure as top expression but is it used anywhere?

Thanks a lot in advance for your time.

Best regards,

Gonçalo

vishal006
Explorer
0 Kudos

Hello goncalonunes,

Sorry for the late reply, hope you are doing good.

Sales context parameters should be available as elements under add existing data object.
Also yes I created a custom FM, which I have used in the Function call.
Steps which I followed:

  1. Created New Application
  2. Created a function call inside that Application
  3. Created a top expression in that function call
  4. Added custom Function module which contains logic to determine email
  5. Mapped the parameters with existing data object elements

Hope this solves your issue.

Answers (0)