Skip to content

Instantly share code, notes, and snippets.

@JouryJonkergouw
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JouryJonkergouw/e61431f972e9358eb524 to your computer and use it in GitHub Desktop.
Save JouryJonkergouw/e61431f972e9358eb524 to your computer and use it in GitHub Desktop.
DATA:
l_ts_tcurx TYPE SORTED TABLE OF tcurx WITH UNIQUE KEY currkey,
lv_shift TYPE i.
FIELD-SYMBOLS:
<lfs_tcurx> TYPE tcurx.
*- Note: The USR06 field is attached to the Business Content InfoObject
*- 0PS_USR7 and not 0PS_USR06, hence why the ABAP code is using 0PS_USR7.
*- __________________________________________
*- | ECC Field | Business Content InfObject |
*- | USR00 | 0PS_USR1 |
*- | USR01 | 0PS_USR2 |
*- | USR02 | 0PS_USR3 |
*- | USR03 | 0PS_USR4 |
*- | ..... | ........ |
* |__________________________________________|
*- Select number of decimals from the TCURX table to determine how
*- many decimals to shift since PS_USR7 is not populated in the right
*- way.
SELECT CURRKEY CURRDEC FROM tcurx
INTO CORRESPONDING FIELDS OF TABLE l_ts_tcurx
WHERE currdec <> 0.
" Only interested in decimals <> 0
LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.
*- If USR7 field is populated shift a number of decimal places
*- amount coming from ECC is not correct.
IF <result_fields>-PS_USR7 IS NOT INITIAL.
CLEAR: lv_shift.
READ TABLE l_ts_tcurx WITH KEY currkey =
<result_fields>-PS_USR7CUR
ASSIGNING <lfs_tcurx> BINARY SEARCH.
IF sy-subrc EQ 0.
lv_shift = <lfs_tcurx>-currdec.
ELSE.
lv_shift = 3. " Default value
ENDIF.
<result_fields>-PS_USR7 = <result_fields>-PS_USR7 /
10 ** ( 2 - lv_shift ).
ENDIF.
ENDLOOP.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment