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: 

Regarding BAPI Function Module in BDC

Former Member
0 Kudos

Hi all,

Iam using the following function module

CALL FUNCTION 'BAPI_GL_ACC_EXISTENCECHECK'

EXPORTING

<b>companycode = 'IN14'</b>

glacct = lv_saknr

IMPORTING

return = lv_return.

In this function module we are having Company Code as IN14, i need to give both IN14 and IN25 i,e i need to use this program for IN14 and IN25.

Thanx in Advance

I will provide points for best solution.

2 REPLIES 2

Former Member
0 Kudos

Hi,

You need to call the function module 'BAPI_GL_ACC_EXISTENCECHECK' twice, then only you will check the both. based on LV_RETURN heck for the other company code, if the first Company code is having the GL accoutn then no need to check for the second comnay code, if the first one is not having then check the for the second one, if the both company codes does not have the GL accoutn then pass the message

Regards

Sudheer

Former Member
0 Kudos

You have to call the function module twice.

instead you can write two select statements to check for tables t001, ska1 and skb1.

select t001bukrs t001ktopl ska1saknr into table itab1 from t001 join ska1 where t001ktopl = ska1ktopl and ska1saknr in (IN14, IN25 ).

if sy-subrc = 0.

select saknr from skb1 into table it_saknr for all entries in itab1 where skb1bukrs = itab1-bukrs and skb1saknr = itab1-saknr.

if sy-subrc = 0.

read table it_saknr index 1 into wa_saknr.

  • take the first one in the internal table

else.

does not exist.

endif.

else.

does not exist.

endif.