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: 

BAPI for posting in F-02

Former Member
0 Kudos

Hi All,

I m using the BAPi BAPI_ACC_DOCUMENT_POST for posting in F-02.

My req is to use different posting keys based upon one indicator field(Ex: ind = 'X').

if ind = 'X'.

posting keys

debit = 11.

credit = 12.

else.

debit = 50.

credit = 40.

endif.

pl. provide info on how this can be acheived using the BAPI.

Thanks in Advance,

Avinash

5 REPLIES 5

Former Member
0 Kudos

Hi

You can't assign the posting key, because it's automatically setted by BAPI.

The BAPI use fm FI_GET_POSTING_KEY and find out the key in order transaction key (field KTOSL).

If that fm can't give the key, it's setted by program, this is the code:

if gs_accit-bschl is initial.

case gs_accit-koart.

when 'D' or 'V'.

if gs_accit-shkzg = 'S'.

gs_accit-bschl = '01'.

else.

gs_accit-bschl = '11'.

endif.

when 'K'.

if gs_accit-shkzg = 'S'.

gs_accit-bschl = '21'.

else.

gs_accit-bschl = '31'.

endif.

when 'S'.

if gs_accit-shkzg = 'S'.

gs_accit-bschl = '40'.

else.

gs_accit-bschl = '50'.

endif.

when 'A'.

if gs_accit-shkzg = 'S'.

gs_accit-bschl = '70'.

else.

gs_accit-bschl = '75'.

endif.

when 'M'.

if gs_accit-shkzg = 'S'.

gs_accit-bschl = '40'.

else.

gs_accit-bschl = '50'.

endif.

endcase.

endif.

Max

Former Member
0 Kudos

Hello Avinash,

This BAPI uses FM FI_GET_POSTING_KEY to determine the posting keys. So not much you can do. However you can give a try by passing Blank in KTOSL in structure BAPIACGL09. This will force the program to skip the determination of keys by the above mentioned FM. Also you need to try populating them through exist which is getting called in "OPEN_FI_PERFORM_RWBAPI01_P".This customer exit is called before Save is done.

hope this helps.

Former Member
0 Kudos

Hello Avinash,

Im having the same matter, did you finally solve it? How did you do it?

Thanks for your cooperation,

Gabriel

0 Kudos

You can use this BADI ACC_DOCUMENT.

Regards,

Cleber Santz

simon_broome
Explorer
0 Kudos

Hi

You can use the table EXTENSION2 to specify your modifications. See the function module documentation.

I have acheived this in 4.70 but am now testing ECC 6.0 and it is no longer working - I have checked that the BADI is implemented and active?