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: 

User Exit for 'BAPI_ACC_DOCUMENT_POST'

Former Member
0 Kudos

Hello Experts,

I am using BAPI_ACC_DOCUMENT_POST for posting document. In that BAPI i cannot update posting key directly so i used extension1 parameter of this BAPI. I create new project in CMOD, use Enhancement 'ACBAPI01' containg component 'EXIT_SAPLACC4_001'. I make code in that. I also hardcode 'BREAK-POINT' syntax in that exit and activate all steps.

But when i go through post document, Document posted sucessfully and it is not stopped at user exit where i want to do some modification. So any idea to solve this problem...

Thanks in Advance...

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Better you use the badi 'BADI_ACC_DOCUMENT'. I did in that way only.

For passing the posting key you need to use the extention structure of BAPI_ACC_DOCUMENT_POST and then use BADI ACC_DOCUMENT

with the other parameters you have to populate the extension table of bapi

data : it_ bapiparex type table of bapiparex,

wa_bapiparex type bapiparex

  • Populate the Extension table

wa_bapiparex-structure = 'POSTING_KEY'.

wa_bapiparex-valuepart1 = '10'. " Item number

wa_bapiparex-valuepart2 = '40'. " Posting Key

APPEND wa_bapiparex TO it_bapiparex.

  • Call the Bapi to post the document

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = wa_docheader

TABLES

accountgl = it_bapiacgl09

accountpayable = it_bapiacap09

currencyamount = it_bapiaccr09

return = it_bapiret2

extension2 = it_bapiparex

Now create an implementation of BADI ACC_DOCUMENT in SE19 and

write the following code in method CHANGE of BADI

DATA: wa_extension TYPE bapiparex,

wa_accit TYPE accit.

LOOP AT c_extension2 INTO wa_extension.

  • Extend BAPI to have Posting Keys defined by user

IF wa_extension-structure = 'POSTING_KEY'.

CLEAR wa_accit.

READ TABLE c_accit INTO wa_accit

WITH KEY posnr = wa_extension-valuepart1.

IF sy-subrc = 0.

wa_accit-bschl = wa_extension-valuepart2.

MODIFY c_accit FROM wa_accit INDEX sy-tabix TRANSPORTING bschl.

ENDIF.

ENDIF.

ENDLOOP.

Hope this solves your problem

Regards,

Dhina...

3 REPLIES 3

Former Member
0 Kudos

Hi,

Better you use the badi 'BADI_ACC_DOCUMENT'. I did in that way only.

For passing the posting key you need to use the extention structure of BAPI_ACC_DOCUMENT_POST and then use BADI ACC_DOCUMENT

with the other parameters you have to populate the extension table of bapi

data : it_ bapiparex type table of bapiparex,

wa_bapiparex type bapiparex

  • Populate the Extension table

wa_bapiparex-structure = 'POSTING_KEY'.

wa_bapiparex-valuepart1 = '10'. " Item number

wa_bapiparex-valuepart2 = '40'. " Posting Key

APPEND wa_bapiparex TO it_bapiparex.

  • Call the Bapi to post the document

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = wa_docheader

TABLES

accountgl = it_bapiacgl09

accountpayable = it_bapiacap09

currencyamount = it_bapiaccr09

return = it_bapiret2

extension2 = it_bapiparex

Now create an implementation of BADI ACC_DOCUMENT in SE19 and

write the following code in method CHANGE of BADI

DATA: wa_extension TYPE bapiparex,

wa_accit TYPE accit.

LOOP AT c_extension2 INTO wa_extension.

  • Extend BAPI to have Posting Keys defined by user

IF wa_extension-structure = 'POSTING_KEY'.

CLEAR wa_accit.

READ TABLE c_accit INTO wa_accit

WITH KEY posnr = wa_extension-valuepart1.

IF sy-subrc = 0.

wa_accit-bschl = wa_extension-valuepart2.

MODIFY c_accit FROM wa_accit INDEX sy-tabix TRANSPORTING bschl.

ENDIF.

ENDIF.

ENDLOOP.

Hope this solves your problem

Regards,

Dhina...

0 Kudos

Hello Dhina..

I go through with ur instruction..In SE19 filter type AWTYP is used..so which REFRENCE TRANSACT. i used for that..

Thanks in Advance...

0 Kudos

Thanks Dhina...Problem Solved..