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: 

BAPI_PO_CREATE1 : Document contains no items

Former Member
0 Kudos

Hi all !

I have a problem creating several purchase orders.

I try to create a purchase order from a purchase requisition.

(I don't use ME59N transaction because i have to modify some fields of purchase requisition due to customer specific rules).

To do that, i have my purchase requisition in a table. I loop at that table and call BAPI_PO_CREATE1 in that loop.

Basically my code looks like this :

LOOP at it_requisition.
  clear tables & structures of bapi.
  fill structures and tables of bapi with datas from it_requistion.
  call bapi_po_create1.
  if no error.
    commit and wait.
  else.
    rollback.
  endif.
ENDLOOP.  "it_requisition

When I have only 1 or a few orders to create, it works fine.

But when I have a huge number of orders to create, I sometimes have the following messages :

MEPO-071 : Documents contains no items

06-010 : Item [item number] does not exist

<i>Any support would be welcome.

Any good idea would be kindly appreciated.

Big reward for any solution that works :p</i>

1 ACCEPTED SOLUTION

anilnal
Explorer
0 Kudos

Hi,

Had an exactly similar issue just now and i think there is something to do with user intervention while executing the BAPI..

This could sound wierd.. but I think it wouldn't come back in case you login back and execute the report or yours directly without any breakpoints or debugging.

10 REPLIES 10

Former Member
0 Kudos

Hi,

Looks strange. Can you cross check if the materials mentioned in the Purchase requisition are all not in deleted status?

This is what I can think of now.

Let me see if I can provide some more info later. My servers are down.

Regards

Subramanian

0 Kudos

Hi,

Thanks for your answers Subramanian and Eswar.

@Subramanian : I do not use materials in my purchase orders. Instead, I use the short text field.

@Eswar : For the items number, I explicitly give the item number, starting from 10 and going 10 by 10.

I think the problem I'm facing is more a problem of dealing with multiple creation of orders. I can create them one by one without problem. But I have about 10 000 a day to create, so that is not a solution.

0 Kudos

Hi Yann

Even i deal with the huge number of document creation with schema SO -> PR -> PO.

Will be creating a SO, which generates PR. Using PR details will be creating PO.

We execute this for huge amount of data everyday and havent faced any such problem.

Can you post your code, maybe that can lead to some clues..

Regards

Eswar

Also try to create the only for the PR which has failed to confirm there is no problem with the data...

0 Kudos

Hi Yann

W.R.T the message id and message number in your post, i somehow feel the error might be encountered at the following code in include: LMEPOF2I. Below is the code for your reference:

* process items automatically, when the item has an error because of
* lock problems (e.g. material master)
* (performance can be improved by a global field)
    LOOP AT pot WHERE item_with_error NE space
                AND ( enq_err_mat NE space OR
                      enq_err_con NE space ).
      lf_ebelp = pot-ebelp.
      READ TABLE cht_ekpo WITH KEY ebelp = lf_ebelp BINARY SEARCH.
      CHECK sy-subrc NE 0.
      lf_tabix = sy-tabix.
      PERFORM get_item USING    lf_ebelp
                       CHANGING ls_ekpo
                                lf_success.
      IF ofekko-waers NE space. ls_ekpo-waers = ofekko-waers. ENDIF.
      IF NOT lf_success IS INITIAL.
        INSERT ls_ekpo INTO cht_ekpo INDEX lf_tabix.
      ELSE.
*      Position zur Einteilung nicht vorhanden
<b>        MESSAGE ID 'MEPO' TYPE 'E' NUMBER '071' WITH lf_ebelp.</b>
      ENDIF.
    ENDLOOP.
  ENDIF.

Though there are other instances whereby the error can be encountered, the rest will occur even when we create an order alone with the same data.

So please check if any of the following options would be feasible when creation of PO failed with error message MEPO - 071:

1. Re-attempt creating the PO again with the same data after a delay of 1 or 2 secs...(maybe this can overcome the incase of any lock entries)

2. Move the entry of IT_REQUSITIONS to last so it can be re-processed again...

Ofcourse, i do agree that we need to handle extra precautions of overcoming the recursiveness...

These are the thoughts i could get on Friday evening and close to kick-off time...:)

Regards

Eswar

0 Kudos

Thank you Eswar.

I will try to reprocess PO creation after a delay if they have the MEPO071 message.

I come back as soon as i have tested.

Have a good week-end !

0 Kudos

<u>Bad news:</u> it does not work to reprocess the item in the same program.

I will try to log those PR and reprocess them in a different mode if i don't find another way.

<u>"Good" news:</u> I think i found the origin of the problem but still don't know how to solve :

The error occurs in include LMEP0F21 line 562 :

READ TABLE cht_ekpo WITH KEY ebelp = lf_ebelp BINARY SEARCH.

However, table cht_ekpo (wich contains my items) has been sorted in reverse order (say i have 4 items, the first line of the table is item 40, the second one item 30 and so on).

Where this table has been sorted in reverse order ?

Why the standard doesn't make a SORT instruction before the binary search ... i don't know but I have open an OSS message and i'll let you know about the answer.

Anyway, thanks to all for your help

Yann

Former Member
0 Kudos

HI Yann

I would recommend you to explicitly give the item number for each PO item.

Say start with 00010 and increment by 10 for each item. This would help you when you pass the schedules, conditions ...etc.

Also note that the same item number should be used for UPDATE structures as well...

That should resolve the problem you are encountering...

Kind Regards

Eswar

anilnal
Explorer
0 Kudos

Hi,

Had an exactly similar issue just now and i think there is something to do with user intervention while executing the BAPI..

This could sound wierd.. but I think it wouldn't come back in case you login back and execute the report or yours directly without any breakpoints or debugging.

Former Member
0 Kudos

Hi all,

Thanks to everyone for your help.

I finally solved my problem applying <b>OSS note 893531</b>.

This note is to correct side effects of another one !

Anyway, thanks again, and i hope that thread will help others ...

Yann

Former Member
0 Kudos

Hi All

My requirment is creating a return PO my zprogram is copied from sap standard transaction ME59N and customising according to my requirment.

Iam getting error is company code not defined and in debugging i finded that error is from sap standard and in debug mode i passed the company code,after passing also i am getting error that is 'document contains no item'.Please help me on this

Thanks

Vamsi