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

Duplicate Invoice PROBLEM with IDOC

Former Member
0 Likes
5,418

Hi Experts,

When I'm trying to post an invoice with already existing "reference number", system is stopping by giving a msg "a duplicate invoice has been found under XYZ account doc". But when I'm trying to do the same with IDOC for that particular vendor a new invoice is posting with already existing "refer no". In short system is posting a duplicate invoice when I'm trying to post it through IDOC.

Can anyone please suggest where should I look up so that a "duplicate invoice" should not get posted when processing though IDOC or am I missing any other steps in IDOC configuration.

I have followed all required steps in for duplicate invoice check by checking "refer no" field and checking "double invoice check" in vendor master.

<< Removed >>

Thanks in advance.

Regards

Amit kumar

Please do not offer rewards.

Edited by: Rob Burbank on Jun 16, 2010 9:46 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,520

I have the same problem.

I am using IDOC_INPUT_INVOIC_MRM to process the idoc.

We could add logic in the user exit, but surely this should not be necessary. It should behave the same for the idoc as in the foreground

Anyone have any more ideas?

Thanks, Joanne

22 REPLIES 22
Read only

Former Member
0 Likes
4,520

Hi,

use this exit EXIT_SAPLMRMH_015 in enhancement MRMH0002 and write your code to validate.

--

Reddy

Read only

Former Member
0 Likes
4,520

Hi,

Can you Please mention what method you are using to create IDOC.If you are using 'MASTER_IDOC_DISTRIBUTE' to generate idoc you have to check the dupliacate entries before populating into table which you are going to pass to master_idoc_data .

Thanks and Regards,

P.Bharadwaj

Read only

brad_bohn
Active Contributor
0 Likes
4,520

Don't offer points. Check your message configuration and if you want to understand how the IDOC process handles and reacts to the duplicate check in LIV, then you should debug the process code. The process works without needing a user exit.

Read only

Former Member
0 Likes
4,521

I have the same problem.

I am using IDOC_INPUT_INVOIC_MRM to process the idoc.

We could add logic in the user exit, but surely this should not be necessary. It should behave the same for the idoc as in the foreground

Anyone have any more ideas?

Thanks, Joanne

Read only

4,520

You can insert logic to perform the duplicate check in EXIT_SAPLMRMH_015, as stated above.

If you insert a call to function module 'MRM_DUPLICATE_INVOICE_CHECK', as per OSS 394316, in that user exit, it may work.

However, by debugging that function module, I found that the check was skipped and that it only works for Argentina!

Not a problem though - all the logic you need is the function call to FI_VENDOR_DATA (to check whether the vendor has the duplicate check flag), and then the function call to MRM_FI_DOCUMENT_CHECK. If you put this code in the user exit (instead of 'MRM_DUPLICATE_INVOICE_CHECK') it should work fine.

However, I agree that this check should take place as standard and should not have to be added as custom code in a user exit

Hope this helps

Ben

Read only

0 Likes
4,520

Hi Ben,

Thanks for the help. But I am using function module 'BAPI_IDOC_INPUT1' to process the IDOC and I dont see any user exit. so where should I write the code. Please help me out here. I am not very much familiar with IDOC.

Thanks in advance.

Regards

Amit kumar

Read only

0 Likes
4,520

check the table TBDBE, you will get actual FM which is called by the mentioned BAPI. search exit in that FM.

--

Reddy

Read only

0 Likes
4,520

Hi,

Which message type you are using ? BAPI_IDOC_INPUT1 calls different function module depending upon the message type.

You can get the Actual Function module name from table TBDBE by passing message type as the parameter.

Edited :

I think enhancement "MRMH0002", component "EXIT_SAPLMRMH_014" can be used.

Regards

Vinod

Edited by: Vinod Kumar on Jul 1, 2010 5:45 PM

Read only

0 Likes
4,520

Hi Amit,

Yes, BAPI_IDOC_INPUT1 is just the initial handler, which then calls the appropriate function. Assuming you are using the INVL process code (logistics invoice verification) to process the idoc, then BAPI_IDOC_INPUT1 will call IDOC_INPUT_INVOIC_MRM.

Try debugging an idoc in WE19 and you'll soon see which function is called

Good luck, Ben

Read only

0 Likes
4,520

Hi Vinod,

I am using message type ACC_DOCUMENT and the Bapi BAPI_IDOC_INPUT1 is calling function module IDOC_INPUT_ACC_DOCUMENT. So can I still use EXIT_SAPLMRMH_014 to do the coding to prevent duplicate invoice creation?

Thanks in advance.

Regards

Amit kumar

Read only

0 Likes
4,520

Hi,

In this case, you cannot use the enhancement mentioned in above post. You have to use the BTE implementation for event "RWBAPI01". But in this BTE you have to do the validation based on the accounting document data. Populate the

record in Table structure C_RETURN with TYPE = 'E' in case of failed validation.

Regards

Vinod

Read only

0 Likes
4,520

Hi Vinod,

Can you please explain how we can implement BTE ? I have never worked on BTE implementation.

Thanks in advance.

Amit kumar

Read only

0 Likes
4,520

Hi,

Refer to SDN Wiki : [Business Transaction Events - BTE|http://wiki.sdn.sap.com/wiki/display/Snippets/BusinessTransactionevents%28BTE%29]

Skip Step Number 1, as you are already having the Business Transaction Event : RWBAPI01. You have to

copy the standard function module "SAMPLE_INTERFACE_RWBAPI01"(related to BTE:RWBAPI01) to a

Z-function module and do the required changes & follow the steps mentioned in the Link mentioned above.

You have to write the code for the validation inside this Z-FM. Populate the internal table RETURN based on

the result of the validation.

Regards

Vinod

Read only

0 Likes
4,520

Hi Vinod,

I check in my system and found out that the same thing is implemented in my sap system also. But the event 00001110 has been used instead of 'RWBAPI01' as suggested by you. If I try to create duplicate invoice manually then the system does not allow it because of the written code in BTE implementation. But Duplicate invoice is created by IDOC and system does not give any error. so will it solve my problem by implementing event RWBAPI01?

Regards

Amit kumar

Read only

0 Likes
4,520

Hi,

Yes, You have to implement the BTE "RWBAPI01". This BTE is called while you post Invioce to FI through BAPI or IDOC.

Regards

Vinod

Read only

0 Likes
4,520

Hi Vinod,

Thanks for your help so far. I have implemented the same. But the event RWBAPI01 is not getting triggered when I post the invoice using IDOC. Can you please help me out here?

Thanks in advance.

Regards

Amit kumar

Read only

0 Likes
4,520

Hi,

Function module IDOC_INPUT_ACC_DOCUMENT calls the bapi BAPI_ACC_DOCUMENT_POST (see Line number 315). Inside the BAPI start debugging on the statement

perform call_customer_function tables extension1.

If your BTE is properly implemented, you BTE code will be executed during this sub-routine call.

Regards

Vinod

Read only

0 Likes
4,520

Hi Vinod,

Thanks a lot. I debugged the function module and found out that the event is not getting triggered because EXTENSION1[] is blank. Can you please suggest what is missing?

You are a great help.

Regards

Amit kumar

Read only

0 Likes
4,520

Hi,

To fill data in EXTENSION1 you should have a record in the segment "E1BPACEXTC" of inbound IDOC.

Regards

Vinod

Read only

0 Likes
4,520

Oh.. we don't have mentioned segment in the IDOC. Any other to way to populate it??

Read only

0 Likes
4,520

Hi,

I think NO, there are no other exits or Enhancements available in this process code to populate a custom segment. You may have to populate this segment at source only.

Regards

Vinod

Read only

0 Likes
4,520

solved

Edited by: amitku1201 on Jul 19, 2010 2:33 PM