Application Development and Automation 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: 
Read only

BAPI_ACC_DOCUMENT_POST posting duplicate entries

Former Member
0 Likes
9,197

Hello,

I have been working on BAPI_ACC_DOCUMENT_POST bapi to create a WD application for creating an invoice similar to Tcode FB10. My issue is:-

The BAPI_ACC_DOCUMENT_POST" bapi is allowing the end user to make duplicate invoice payments which is not acceptable. We need the BAPI to return an error message if a duplicate entry exists. For eg:- If we enter a duplicate entry in FB10 it throws an error message telling the user that a duplicate entry exists. But, this is not happening in the case of the BAPI.

Could anyone help me in finding a way to check for duplicate invoice entries and throw an error message. I would greately appreciate your help.

Regards,

Gopal Yarlagadda.

Hi

U need to debug FI_DUPLICATE_INVOICE_CHECK, not the BAPI, it seems the system doesn't find a record in BSIP.

So try to debug that fm while selecting BSIP table:

*------- Index für doppelte Rechnungen lesen ---------------------------
*        Rechnungen können in BSIP mit SHKZG 'H' und SPACE stehen,
*        da SHKZG neu in BSIP zu 4.0A
  not_shkzg = i_shkzg.
  translate not_shkzg using 'SHHS'.

  if i_xblnr = space.
    select * into bsip
             from bsip
             where bukrs = i_bukrs
             and   lifnr = i_lifnr
             and   waers = i_waers
             and   xblnr = i_xblnr
             and   wrbtr = i_wrbtr
             and   bldat = i_bldat
             and   shkzg ne not_shkzg.

*     credit memos & invoice < 4.0
      check not ( i_shkzg = 'S' and bsip-shkzg = space ).

* check if bsip refers to same document
      check not ( i_belnr = bsip-belnr and
                  i_bukrs = bsip-bukrs and
                  i_gjahr = bsip-gjahr ) .

      perform doppelte_belege_pruefen_s using rc.
      check rc = 0.
      exit.
    endselect.
  else.
    select * into bsip
             from bsip
             where bukrs = i_bukrs
             and   lifnr = i_lifnr
             and   waers = i_waers
             and   xblnr = i_xblnr
             and   bldat = i_bldat
             and   shkzg ne not_shkzg.

*     credit memos & invoice < 4.0
      check not ( i_shkzg = 'S' and bsip-shkzg = space ).


* check if bsip refers to same document
      check not ( i_belnr = bsip-belnr and
                  i_bukrs = bsip-bukrs and
                  i_gjahr = bsip-gjahr ) .

      perform doppelte_belege_pruefen_s using rc.
      check rc = 0.
      exit.
    endselect.
  endif.

If a record in BSIP exists, the routine doppelte_belege_pruefen_s is triggered, here an error message should be raised.

Max

41 REPLIES 41
Read only

0 Likes
4,388

That's good

You're right: when I post my code I forgot this little line:

IT_ACCIT-XUMSW = 'X'.

But you've found out it by yourself....good work

Max

P.s.: I believe u should keep that flag in IT_ACCIT table too.

Read only

0 Likes
4,388

Hi Max,

I have the similar problem. I am posting invoice using IDOC. is it possible to do the same in 4.6c system also? I don't see 'ACC_DOCUMENT' Badi in 4.6c. If I do implement the same functionality using BTE then the event is not getting triggered because EXTENSION1 table is blank as we are not populating it. Can you please help me here?

Regards

Amit