cancel
Showing results for 
Search instead for 
Did you mean: 

Start Routine

Former Member
0 Kudos

Hi All,

I would like to delete records when

AC_DOC_TYP i not equal to to 'ZR' and GL account number is greater than 3 I wrote down this code, but doesn't seem to work. Can someone please assist me. Thanks and here my current code

<b>delete DATA_PACKAGE where AC_DOC_TYP ne 'ZR' and GL_ACCOUNT(1) >= '4'.</b>

Asad

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi again,

your problem is also that GL_ACCOUNT is char type. Normally, SAP does not allow anymore arithmetic operations on such objets.

Just let us know with '0000000004'.

regards

Former Member
0 Kudos

Hi Laurent,

Sorry for replying late. I just got back. I thought about the lenght as well but it didn't really matter. I still get GL accounts >= 4. Please let me know me know what else I can do ? Waiting for your response.

Regards,

Asad

former_member188972
Active Contributor
0 Kudos

As I said the dynamic specification of components using character-type data objects in parentheses is not supported here.

So you cannot write the ABAP statement

Delete ..... where ABAPFIELD(3) <condition>.

But only

Delete ..... where ABAPFIELD <condition>.

Is that the reason because I wrote a not nice code but correct!

Note that on the char type the condition will could be mantained, at runtime the processor convert the variable in the type necesary for the condition if is possible (ex if there are no-number and the condition is > that's not possible).

Regards,

Sergio

Message was edited by: Sergio Locatelli

Former Member
0 Kudos

Hey Sergio,

Thanks to you and others for helping me. You were right about dynamic specification of components as the moment I corrected my statement it worked. Thanks and full points assigned.

Regards,

Asad

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Using a loop will not help, as the problem is not there.

Your problem is with the hard coding on GL_ACCOUNT. Its length is 10. Do you think that 4 is at the first or the last position?

Try with GL_ACCOUNT(1) >= '0000000004'

Regards

former_member188972
Active Contributor
0 Kudos

The dynamic specification of components using character-type data objects in parentheses is not supported here

You can substitute the code with:

loop at DATA_PACKAGE where AC_DOC_TYP ne 'ZR'.

if DATA_PACKAGE-GL_ACCOUNT(1) GE '4'.

delete DATA_PACKAGE.

endif.

endloop.

Hi Asad,

did you resolve your problem?

Message was edited by: Sergio Locatelli

Former Member
0 Kudos

Setence seems correct, are you sure the position for >= 4 is the first one? GL account should have filled by 0 by the left...