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: 

!!!Urgent!!! purchase order

Former Member
0 Kudos

when i am checking po is existing its getting correct value then i need to check if the po exists and its item doesnt exit it should show me an error as an list how cani do it

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

Do like this.

Select * from ekko into table IT_EKKO where EBELN IN S_EBELN.

If not IT_EKKO[] is initial.

SELECT * from EKPO into table IT_EKPO for all entries in IT_EKKO where EBELN = IT_EKKO-EBELN.

endif.

Loop at IT_EKKO.

READ atble it_ekpo with key EBELN = IT_EKKO-EBELN.

if sy-subrc NE 0.

Error Meesage.

endif.

ENDLOOP

If useful reward.

Vasanth

6 REPLIES 6

Former Member
0 Kudos

Check EKKO table for the PO header data data and EKPO table for item data and accordingly throw a error.

Regards,

Ravi

Former Member
0 Kudos

Hello,

Do like this.

Select * from ekko into table IT_EKKO where EBELN IN S_EBELN.

If not IT_EKKO[] is initial.

SELECT * from EKPO into table IT_EKPO for all entries in IT_EKKO where EBELN = IT_EKKO-EBELN.

endif.

Loop at IT_EKKO.

READ atble it_ekpo with key EBELN = IT_EKKO-EBELN.

if sy-subrc NE 0.

Error Meesage.

endif.

ENDLOOP

If useful reward.

Vasanth

andreas_mann3
Active Contributor
0 Kudos

hi,

check table ekko for PO and ekpo for items

A.

Former Member
0 Kudos

Hi ,

u mean to say the po is existing fine and now the items under that po is existing or not ???

am i missing something here or

are u looking for the items which are deleted under that po number in ekko ..

if so in ekpo(item level) u have po with items

check the field loekz --Deletion indicator in purchasing document

or in the entries put loekz = x ,

this will fetch u the items deleted under that po ..

hope this helps ,

regards,

VIjay

Former Member
0 Kudos

SELECT ebeln

ebelp

FROM ekpo

INTO TABLE t_ekpo

FOR ALL ENTRIES IN t_ekko

WHERE ebeln EQ t_ekko-ebeln

AND loekz EQ ' '.

loop at t_ekko.

read table t_ekpo with key ebeln = t_ekko-eblen.

if sy-subrc =0 .

  • item exists

else.

  • item not exists.

endif.

-Anu.

Former Member
0 Kudos

U can directly check the table EKPO for the purchase order and item data. Because, item cannot exists without header data. Unless you want to read EKKO for some other data or in different section of the code.

SELECT SINGLE EBELN POSNR into lbelnr lposnr

FROM EKPO

WHERE ebeln = <yourdata> and

posnr = <youritem>.

If sy-subrc = 0.

it exists

else.

does not exist.

endif.

U can do the same for EKKO for po header data.