cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Approval Reason assigned using net value for sales document types

SAPSupport
Employee
Employee
0 Likes
394

We would like to setup the workflow so that the approval reason (i.e. the workflow is triggered) is only assigned when the sales document value is greater than 10,000 USD. Since the approval reason is assigned through the BAdI, the solution needs to be coded. If we simply use SALESDOCUMENT-TOTALNETAMOUNT > 10,000 any value over this figure will pass the condition, regardless of currency. Example 11,000IND (real value <1USD), will meet the condition and trigger the workflow.


------------------------------------------------------------------------------------------------------------------------------------------------
Learn more about the SAP Support user and program here.

Accepted Solutions (1)

Accepted Solutions (1)

SAPSupport
Employee
Employee
0 Likes

You either have to add a separate condition for each currency or carry out a currency conversion in the BAdI.

The second option would require more ABAP development knowledge but maybe the better solution with Developer Extensibility using the CDS view I_ExchangeRate.

 

As a hint, the ABAP for such a solution may look similar to:

data(lv_netamount_in_usd) = salesdocument-transactioncurrency. 

if salesdocument-transactioncurrency <> 'USD'.

  select single exchangeRate from I_ExchangeRate with PRIVILEGED ACCESS

     where sourcecurrency = @salesdocument-transactioncurrency

         and targetcurrency = 'USD'

         and exchangeratetype = 'M'

             into @data(lv_exchange_rate) .

 

  lv_netamount_in_usd = salesdocument-totalnetamount * lv_exchange_rate.

endif.

^^^ please note this code is only meant as a suggestion and has not been tested.

 

Code the condition logic with the net amount in USD (lv_netamount_in_usd)

Answers (0)