Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

FM or BAPI to get document currency?

Former Member
0 Kudos

I am in search for FM or BAPI which will help me in solving my program.

I am using "BAPI_GL_GETGLACCBALANCE" to get the amount in Local currency, by using CURRENCYTYPE value '10'.

If I use the same BAPI to get document currency, by using

CURRENCYTYPE value '00', i get error message "Account does not exit". Is there any way to get the document currency for the given account using FM / BAPI.

Prabhu Rajesh.

1 ACCEPTED SOLUTION

andreas_mann3
Active Contributor
0 Kudos

Hi Prabhu ,

look at function group F009.

fm's :

FOR_ALL_SKC1C

READ_SKC1C

or own select of GLT0 as in your BAPI:

  SELECT * FROM GLT0
           WHERE RLDNR = '00'
           AND   RRCTY = '0'
           AND   RVERS = '001'
           AND   BUKRS = ACCOUNT_BALANCE-COMP_CODE
           AND   RYEAR = ACCOUNT_BALANCE-FISC_YEAR
           AND   RACCT = ACCOUNT_BALANCE-GL_ACCOUNT
           AND   RPMAX = '016'.
    
  SUMME = SUMME + GLT0-TSLVT.
  DO 16 TIMES VARYING GLT0VARY FROM GLT0-TSL01 NEXT GLT0-TSL02.
    SUMME = SUMME + GLT0VARY.
  ENDDO.

  ENDSELECT.

regards Andreas

3 REPLIES 3

Former Member
0 Kudos

Sorry I would like to edit my error message to

"Balance Cannot be displayed in Currency type 00

(transaction currency)".

Regards,

Prabhu Rajesh.

0 Kudos

Here is what the FM documentation has to say.

<b><i>This method provides the ending balance of a G/L account for the fiscal year selected.

The user decides whether the balance is provided in the transaction or company code currency. Exceptions are G/L accounts kept in various transaction currencies. In such cases, only the company code currency is allowed.</i></b>

Just an addition to Andreas's post (which is probably your solution), you need to consider field GLT0-RTCUR (Currency) as well, since these accounts could have records in GLT0 with multiple currency codes.

Rishi

andreas_mann3
Active Contributor
0 Kudos

Hi Prabhu ,

look at function group F009.

fm's :

FOR_ALL_SKC1C

READ_SKC1C

or own select of GLT0 as in your BAPI:

  SELECT * FROM GLT0
           WHERE RLDNR = '00'
           AND   RRCTY = '0'
           AND   RVERS = '001'
           AND   BUKRS = ACCOUNT_BALANCE-COMP_CODE
           AND   RYEAR = ACCOUNT_BALANCE-FISC_YEAR
           AND   RACCT = ACCOUNT_BALANCE-GL_ACCOUNT
           AND   RPMAX = '016'.
    
  SUMME = SUMME + GLT0-TSLVT.
  DO 16 TIMES VARYING GLT0VARY FROM GLT0-TSL01 NEXT GLT0-TSL02.
    SUMME = SUMME + GLT0VARY.
  ENDDO.

  ENDSELECT.

regards Andreas