cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a BRF+ Function from Workflow: Amount import parameter

sbl
Active Contributor
0 Kudos

Hi

I have a BRF+ function with a type AMOUNT in the signature as input parameter

I have tried to create a task by including the BRF+ function but I got a problem saying that the AMOUNT was not linked to DDIC

So I changed the link to NETWR.

I generated the task but now I am facing a problem, eventhough in my BRF+ function the type is correct and contain the Amount and currency, in the linkage I only have NETWR so I can not transfer the currency in the binding of the task.

I have checked the task generated container and the type is NETWR.

The generated class is only providing

call method _set_value(

      name      = 'NETWR'

      fdt_name  = 'NETWR'

      value     = NETWR ).

So I don't know how to transfer the amount and currency to the BRF+ directly from a generated task

I could set up a function module calling the BRF+ but I thought the integration should cover this challenge ....

Is there a way to do it that I have missed in the direct generation ?

Cheers

Stephane

Accepted Solutions (1)

Accepted Solutions (1)

sbl
Active Contributor
0 Kudos

Hi

I think I found the way it is to link it to data dictionnary FDT_S_AMOUNT

Then everything is here

Cheers

Stephane

sbl
Active Contributor
0 Kudos

Funny  I execute the function

FUNCTION Z_MM_0530_AMOUNT.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     REFERENCE(IV_PRICE) TYPE  NETWR

*"     REFERENCE(IV_CURRENCY) TYPE  WAERS

*"  EXPORTING

*"     REFERENCE(ES_AMOUNT) TYPE  FDT_S_AMOUNT

*"----------------------------------------------------------------------

ES_AMOUNT-NUMBER = IV_PRICE.

ES_AMOUNT-CURRENCY = IV_CURRENCY.

Entering as parameter 20,00 EUR I get 20,00 EUR

If I do the same in class method I get 2.000EUR

Can someone explain the difference ?

Cheers

Stephane

Jocelyn_Dart
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Stephane, You are getting close to the right answer... but I think you may have made it a little harder for yourself than it needed to be...

If you make sure you are in Expert mode (in Personalization) in the BRFPlus workbench, and you go to the rule function you want to call, you should see an option to Generate Coding Template. 

This coding template will actually show you all the code you need to call your BRFPlus function including showing you how to format amount/currency and date/time fields. If you select the option to add comments it will even add a few more clues as to what needs to go where.

IMO the coding template is one of the better features of DSM/BRFPlus as it's a huge timesaver with these sorts of issues.

BTW if you are moving from BRFPlus to DSM, make sure you generate the coding template again in DSM as slightly different utility classes are used for deployed DSM rule functions vs local BRFPlus functions.

Hope that helps

Rgds,

Jocelyn

P.s. The difference you are seeing in testing... is because one of your tests is automatically applying the input/output conversion exit to NETWR based on the data element settings.  The input/output conversion exit is what applies the currency-based decimal point placement to the amount. I would guess that however you are testing it for your class this is not being automatically applied.  Regardless strongly recommend you get the correct code from the coding template... and it should all become a lot easier.

sbl
Active Contributor
0 Kudos

Hi Jocelyne,

Most of the time I am using the Template  provided by the BRF+, however in this case I wanted to use the BRF+ function directly in the workflow (using the integrate BRF+ function which generate both the class and the task) .

And then in case if I use for instance Netwr as input parameter in the BRF+ function it does not ask for the currency. So I had to put specifically FDT_S_AMOUNT in order to have th binding done to the DDIC.

When I generate both task and class it is asking for the structure FDT_S_AMOUNT...

You are right what I certainly should have done is making my own class and mapping the field there but I thought that the generation within the workflow would have worked.

Cheers

Stephane

Jocelyn_Dart
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Stephane,

Ok so great you are already familiar with the coding template. 

From the description it sounds like the workflow integration itself is ok so far as it goes.  However it also sounds like we need more documentation on these sorts of aspects and prerequisites for integration - which a few of us have been discussing lately. So thanks for raising this one...

Although it's from a different direction, there is a bit of a description of what's needed for amount/currency format in 

There are similar prerequisites for date formats and quantity formats, so all of these formats need to be understood .There are a couple of options for picking up the correct data type depending on your integration approach.  The answer that you found is a good one so congrats on working it out!

Definitely something we need to cover in a future blog...I'll add it to the list!

Jocelyn

Btw I'm thinking it might still have been helpful to generate the template to see how it mapped the context signature - as you would have seen how the amount/currency format is handled in the template also. 

Answers (1)

Answers (1)

0 Kudos

Hello ,

I am trying to explore BRFplus from past few days now.Every day I find something new.

As while going through the discussion between both of you I found some CODE TEMPLATE.

Because I am merely a beginner can any one of you help me from where to find this Code Template?

I will also go through the Link that Jocelyn had given for WOrkflow and BRFplus integration.

Also if you can help me in giving any link(explained with example or screenshot) about Dynamic Expression, Formula Expression and Random Number Generation in BRFplus.

Thanks in Adv. and from next time I will open a new thread.

Lav Bharadwaj

replytolav@gmail.com

0 Kudos

Hi Lav,

please open already for this post a new thread for your questions as they are not related to this topic here. In addition before doing so please search the SCN if there are not threads answering your questions following the RoE

Thanks

BR

Christian