09-29-2008 1:12 PM
Hi,
I am ABAP-ing a bit in BI and need some help.
I am making a start routing when uploading data from a DSO to an InfoCube. What I would like it to do is to only upload rows where field x starts with Z. If the field contains anything else it can be deleted. Everything starting with Z should be transfered to the InfoCube.
The syntax should be something like:
DELETE source_package WHERE "InfoObject" NOT LIKE 'Z'.*
Any ideas?
Thanx!
09-29-2008 1:16 PM
Hi,
Try using the % sign as the wildcard.
DELETE source_package WHERE "InfoObject" NOT LIKE 'Z%'.
Regards,
Darren
09-29-2008 1:22 PM
It seems like NOT LIKE is not the correct syntax in this case. I get the following message when checking my code:
E:Field "LIKE" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. "DATA" statement. "DATA" statement.
09-29-2008 1:25 PM
>
> Hi,
>
> Try using the % sign as the wildcard.
>
> DELETE source_package WHERE "InfoObject" NOT LIKE 'Z%'.
>
> Regards,
> Darren
WRONG
LIKE is not supported with internal tables.
09-29-2008 1:27 PM
09-29-2008 1:28 PM
Hi,
Try
DELETE from source_package WHERE "InfoObject" NOT LIKE 'Z%'.
Cheers,
Darren
09-29-2008 1:29 PM
>
> DELETE source_package WHERE "infoObject" Eq 'Z%'.
WRONG
This will delete only records which have first character Z and second character exactly %.
09-29-2008 1:30 PM
WRONG
source_package is an internal table
The trick is to actually write a little program to test, before wildly guessing.
Here's a sample program that works, showing the correct approach:
TYPES: BEGIN OF ty,
fld TYPE c LENGTH 3,
END OF ty.
DATA: ls TYPE ty,
lt TYPE STANDARD TABLE OF ty WITH NON-UNIQUE KEY table_line.
DATA: lr_iobj TYPE RANGE OF ty-fld,
ls_iobj LIKE LINE OF lr_iobj.
ls_iobj-sign = 'E'.
ls_iobj-option = 'CP'. " Contains pattern
ls_iobj-low = 'Z*'.
INSERT ls_iobj INTO TABLE lr_iobj.
ls-fld = 'ZAA'.
INSERT ls INTO TABLE lt.
ls-fld = 'ZAb'.
INSERT ls INTO TABLE lt.
ls-fld = 'AAA'.
INSERT ls INTO TABLE lt.
DELETE LT WHERE fld IN lr_iobj.
LOOP AT lt INTO ls .
WRITE: / ls-fld.
ENDLOOP.
09-29-2008 1:34 PM
>
> DELETE from source_package WHERE "InfoObject" NOT LIKE 'Z%'.
Even WRONG
InfoObject Is refrenced nowhere to source_package!
09-29-2008 1:36 PM
>
> >
> > DELETE source_package WHERE "infoObject" Eq 'Z%'.
> WRONG
>
> This will delete only records which have first character Z and second character exactly %.
Since Infoobject is not refrenced to source_package it won't delete nothing.
09-29-2008 1:17 PM
hi,
put all packages in one InetrnalTabel itab.
delete itab where package NE 'Z*'.
Regards,
deepthi.
09-29-2008 1:24 PM
>
> hi,
> put all packages in one InetrnalTabel itab.
>
> delete itab where package NE 'Z*'.
>
>
> Regards,
> deepthi.
WRONG
This will delete everything which does not have as first character Z and as second character the actual character *
09-29-2008 1:17 PM
Use a range, with sign E option CP and low Z*
Then DELETE source_package WHERE "InfoObject" IN my_range.
DATA: lr_iobj TYPE RANGE OF TYPE /bic/oiiobj,
ls_iobj LIKE LINE OF lr_iobj.
ls_iobj-sign = 'E'.
ls_iobj-option = 'CP'. " Contains pattern
ls_iobj-low = 'Z*'.
INSERT ls_iobj INTO TABLE lr_iobj.
DELETE source_package WHERE /bic/iobj IN lr_iobj.
btw - in Start Routines you use fieldname not infoobject. So /BIC/myiobj
matt
Edited by: Matthew Billingham on Sep 29, 2008 2:20 PM
09-29-2008 1:17 PM
09-29-2008 1:18 PM
Hi ,
I think this is the correct way..
DELETE source_package WHERE "infoObject" NOT LIKE 'Z%'.
09-29-2008 2:20 PM
The answer from Matthew Billing to create a range worked with a bit of modification to it...
Thank you all for your time!
10-05-2015 7:38 PM