10-17-2006 10:10 AM
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
10-17-2006 10:14 AM
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
10-17-2006 10:14 AM
Check EKKO table for the PO header data data and EKPO table for item data and accordingly throw a error.
Regards,
Ravi
10-17-2006 10:14 AM
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
10-17-2006 10:14 AM
10-17-2006 10:18 AM
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
10-17-2006 10:30 AM
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.
10-17-2006 10:35 AM
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.