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_incominginvoice_save errors

Former Member
0 Likes
925

Hi,

I am using bapi_incominginvoice_save to create a logistical invoice (similar to transaction MIRA). In my program, after BAPI execution I check the contents of the 'RETURN' parameter for any problems that may have occurred. However, I have found that certain 'E' messages do not get passed to the BAPI's 'RETURN' parameter but instead result in the end the program. As a result the subsequent statements in the calling program are not executed. Is there some configuration that needs to be setup to ensure all messages are passed to the RETURN parameter rather than executed at runtime?

An example of one such message is: purchase order incomplete.

Any help or suggestions are very much appreciated.

Thanks,

Vicki

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
586

If these abort come from standard SAP code, look for a note or send an OSS message.

IF they come from client developpement, BADI for example, maybe theses need some corrections.

Take a look at OSS <a href="https://service.sap.com/sap/support/notes/771655">Note 771655 - BAPI invoice verification: no posting</a>

Regards

2 REPLIES 2
Read only

RaymondGiuseppi
Active Contributor
0 Likes
587

If these abort come from standard SAP code, look for a note or send an OSS message.

IF they come from client developpement, BADI for example, maybe theses need some corrections.

Take a look at OSS <a href="https://service.sap.com/sap/support/notes/771655">Note 771655 - BAPI invoice verification: no posting</a>

Regards

Read only

0 Likes
586

Thanks Raymond. I think you are right to suggest OSS.

I believe what is happening is that the BAPI calls the function module "me_read_header_invoice" which checks the purchase order. One of the checks this function makes is whether the PO is complete (In the procedure bestellkopf_lesen line 94)

IF ekko-memory ne space.

PERFORM ENTSPERREN_EKKO USING H-EBELN.

MESSAGE E045(MEPO) WITH EKKO-EBELN "<<<<<<<<<<<<<<<<<

RAISING PARKED_DOCUMENT.

EXIT.

ENDIF.

However, if you look at the functin call this exception PARKED_DOCUMENT is not checked. (in the include: LMRM_BAPIF0W).

CALL FUNCTION 'ME_READ_HEADER_INVOICE'

EXPORTING

display = 'X'

ebeln = s_selectpo-po_number

re_kursf = i_rbkpv-kursf

re_waers = i_rbkpv-waers

IMPORTING

iekko = s_ekko

EXCEPTIONS

not_found = 1

wrong_type = 2

not_activ = 3

not_released = 4. "<<<<Line 32

To overcome this I suggest the following standard SAP code change is made.

CALL FUNCTION 'ME_READ_HEADER_INVOICE'

EXPORTING

display = 'X'

ebeln = s_selectpo-po_number

re_kursf = i_rbkpv-kursf

re_waers = i_rbkpv-waers

IMPORTING

iekko = s_ekko

EXCEPTIONS

not_found = 1

wrong_type = 2

not_activ = 3

not_released = 4 "<<<<<Line 32 fullstop removed

others = 5. "<<<<<Line inserted

Does this sound like I am on the right track?