Register Login

Problem when doing a Batch Invoice upload

Updated May 18, 2018

Hi All,

 

I am currently experiencing an issue with mass invoice uploads. I have create a program which reads an excel document with purchase orders. This template is also used within a Mass Goods Receipt program which I have also created.

 

In the scenario in which I receive an error, the line items of the purchase order is as follows: 1, 2 and 4. The Goods Receipt process works fine, however when I do a Invoice Receipt I get the follow error "Enter a reference to a valid goods receipt (line 000004)". I have managed to detect the problem where the error occurs. In BAPI - BAPI_INCOMINGINVOICE_CREATE, PERFORM importing_data_check, PERFORM itemdata_check, the following function module MMPUR_EKBE_READ_EBELN_EBELP returns data from table ekbe based on the purchase order and po item input. After this a read on the returned table is done, code as follows:

 

READ TABLE tab_ekbe INTO s_ekbe

                        WITH KEY ebeln = i_itemdata-po_number

                                 ebelp = i_itemdata-po_item

                                 lfbnr = i_itemdata-ref_doc

                                 lfgja = i_itemdata-ref_doc_year

                                 lfpos = i_itemdata-ref_doc_it.

 

IF sy-subrc NE 0.

      e_subrc = 4.

      CONCATENATE i_itemdata-ref_doc

                  i_itemdata-ref_doc_year

                  i_itemdata-ref_doc_it

             INTO f_msgv1 SEPARATED BY space.

      PERFORM bapireturn_fill USING  'M8'

                                     'E'

                                     '429'

                                     i_itemdata-po_number

                                     i_itemdata-po_item

                                     f_msgv1

                                     i_itemdata-invoice_doc_item

                            CHANGING te_return.

    ENDIF.

 

 

The lfpos field on tab_ekbe contains a value of 3 whereas the field  i_itemdata-ref_doc_it(This value is being read from the excel upload file). contains a value of 4, thus going into error as above. I changed the value in field  i_itemdata-ref_doc_it to 3, however I now receive the following error "System error: Error in routine MRM_DRSEG_FILL(SAPLMRMH)".

 

Can anyone help me with a possible solution for this problem?

 

Apologies for the long post.

 

Thanks and Regards,

Preneshen

 


×