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: 

Deleting datapackages where the string starts with Z*

former_member214693
Participant
0 Kudos

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!

16 REPLIES 16

Former Member
0 Kudos

Hi,

Try using the % sign as the wildcard.

DELETE source_package WHERE "InfoObject" NOT LIKE 'Z%'.

Regards,

Darren

0 Kudos

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.

matt
Active Contributor
0 Kudos

>

> 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.

0 Kudos

DELETE source_package WHERE "infoObject" Eq 'Z%'.

0 Kudos

Hi,

Try

DELETE from source_package WHERE "InfoObject" NOT LIKE 'Z%'.

Cheers,

Darren

matt
Active Contributor
0 Kudos

>

> DELETE source_package WHERE "infoObject" Eq 'Z%'.

WRONG

This will delete only records which have first character Z and second character exactly %.

matt
Active Contributor
0 Kudos

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.

0 Kudos

>

> DELETE from source_package WHERE "InfoObject" NOT LIKE 'Z%'.

Even WRONG

InfoObject Is refrenced nowhere to source_package!

0 Kudos

>

> >

> > 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.

Former Member
0 Kudos

hi,

put all packages in one InetrnalTabel itab.

delete itab where package NE 'Z*'.

Regards,

deepthi.

matt
Active Contributor
0 Kudos

>

> 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 *

matt
Active Contributor
0 Kudos

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

GauthamV
Active Contributor
0 Kudos

hi,

try like this.

DELETE source_package WHERE InfoObject NE 'Z*'.

P561888
Active Contributor
0 Kudos

Hi ,

I think this is the correct way..

DELETE source_package WHERE "infoObject" NOT LIKE 'Z%'.

former_member214693
Participant
0 Kudos

The answer from Matthew Billing to create a range worked with a bit of modification to it...

Thank you all for your time!

Former Member
0 Kudos

This message was moderated.