2012 Oct 17 11:25 PM
Hi all
I´m creating a query using COVP table agains a Z table we have.-
What I need is delete records from the COVP when the partner company code is equal to the company code and when the partner company code is blank
For thisI´ve been trying to do this in the "Records processing" section of the query.
//
Delete itab where itab-BUKRS eq itab-PBUKRS and itab-BUKRS eq blank.
//
But I get the error message:
Unable to interpret "WHERE". Possible causes of error: Incorrect spelling or comma error. "
In other topic mr. PPIO recomend me to use other option for the Delete function, but as I don´t know to much for coding I´m comming here
Is there something you can recomend me to make this work?
COVP is the table and inside you might find the below fields
COVP-BUKRS (partner ccd)
COVP-PBUKRS (company code)
What I need is to delete records BUKRS = PBUKRS and if BUKRS is in blank
Regards
2012 Oct 18 4:38 PM
Found the solution
In the record processing I add a sentence
CHECK COVP-PBUKRS <> COVP-BUKRS.
CHECK COVP-PBUKRS <> ' '.
And that was it.
Thanks all that tried to help
Regards
2012 Oct 18 12:41 PM
Hi Yutoks,
Your WHERE condition is wrong i think.
According to your condition it will delete only when itab-BUKRS eq itab-PBUKRS eq blank.
I guess that you have to use an OR condition instead of AND.
Try.
DELETE itab WHERE itab-BUKRS eq itab-PBUKRS OR itab-BUKRS eq ' '.
Regards,
Akhil
2012 Oct 18 12:59 PM
Hello,
write the code as:
DELETE itab WHERE BUKRS eq itab-PBUKRS OR BUKRS eq ' '.
2012 Oct 18 1:30 PM
I must be doing something wrong because even though I tried both I still get the error.
Global syntax check
- Get/GET late code / code for record processing
- Error in code for record processing
- Unable to interpret "WHERE". Possible causes: Incorrect spelling or comma error
Any ideas?
2012 Oct 18 1:50 PM
Hi,
I just tried the above scenario. I put some data into the bukrs and pbukrs fields of the internal table itab.
The following removes all the records satisfying the above given condition.
LOOP at itab into itab_line.
DELETE itab where
bukrs = itab_line-bukrs
AND pbukrs = itab_line-bukrs
OR pbukrs = ' '.
ENDLOOP.
2012 Oct 18 2:07 PM
Where should I paste that? in the Record Processing section? because I get
"Field "ITAB" is unknown. It is neither in one of the specified tablesn or defined by a "DATA" statement."
2012 Oct 18 3:17 PM
Hello,
Try these staements, they should help you -
DELETE ADJACENT DUPLICATES FROM itab comparing BUKRS PBUKRS.
DELETE itab where BUKRS eq ' '.
best regards,
swanand
2012 Oct 18 3:21 PM
hello
For your case it should be
DELETE itab where BUKRS eq ' ' and PBUKRS = ' '. Since you want BUKRS and PBUKRS same and also BUKRS eq ' '.
best regards,
swanand
2012 Oct 18 3:57 PM
I try both, same issue.- It´s looks like the internal table don´t exist or something I mean I thought all querys have an itab
I´m wrong?
Regards
2012 Oct 18 3:57 PM
Hi Yutoks,
Try the code below
DATA:it_covp TYPE STANDARD TABLE OF covp,
wa_covp TYPE covp.
SELECT * FROM covp INTO TABLE it_covp.
LOOP AT it_covp INTO wa_covp.
IF wa_covp-bukrs <> wa_covp-pbukrs.
DELETE TABLE it_covp FROM wa_covp.
ENDIF.
ENDLOOP.
LOOP AT it_covp INTO wa_covp.
IF wa_covp-bukrs <> ' '.
DELETE TABLE it_covp FROM wa_covp.
ENDIF.
ENDLOOP.
DELETE covp FROM TABLE it_covp.
This will do your requirement, but i think there may be much better methods.
Regards,
Akhil
2012 Oct 18 4:38 PM
Found the solution
In the record processing I add a sentence
CHECK COVP-PBUKRS <> COVP-BUKRS.
CHECK COVP-PBUKRS <> ' '.
And that was it.
Thanks all that tried to help
Regards