on ‎2024 Feb 02 12:45 PM
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.
Request clarification before answering.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 33 | |
| 17 | |
| 14 | |
| 13 | |
| 9 | |
| 4 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.