Skip to Content
author's profile photo Former Member
Former Member

Delete records in update routine

Hi Everyone,

I have a keyfigure called " <b>Quantity</b> " and I would like to not update the quantity if my Characteristic CS_ITEM has a value "HEADCO" and Characteristic CURTYPE has a value "10". Can you please suggest some abap code in either update rule or start routine to skip or not update records if these values are present mentioned above.

Thanks

Asad

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Posted on Oct 13, 2006 at 04:02 PM

    Hi:

    write in start routine. its better.

    Its very easy.

    delete data_package where CS_ITEM = 'HEADCO' and

    CURTYPE = '10'.

    Message was edited by: Ram Chamarthy

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 13, 2006 at 04:05 PM

    Hi Asad,

    do you just have one KF or more of them, and do you want this condition only for the Quanitity KF or all of them...reason to ask is that if you code in the Start Routine, it will apply to all the KF.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 13, 2006 at 04:09 PM

    Hi:

    Like bhanu asked, the COde will skip/delete records as you suggested.

    If you only want to make Quantity = 0 and leave therest of the record as it is, then write this code in start routine.

    loop at data_package where CS_ITEM = 'HEADCO' and

    CURTYPE = '10'.

    data_package-quantity = '0'.

    modify data_package.

    endloop.

    Also, in my previos post, dont use " use singel quotes (')in ABAP Code as shown in this code.

    Ram C.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Guys,

      Perhaps I should have told you that there's already a start routine there. It seems like records are being copied to another field and that includes Curtype field. I added a code in there but it didn't do anything.

      data : itab like DATA_PACKAGE occurs 1 with header line.

      itab[] = DATA_PACKAGE[]. "copy all records to itab"

      loop at DATA_PACKAGE into itab.

      itab-/BIC/ZBALANCE = itab-BALANCE.

      itab-/BIC/ZCURRENCY = itab-CURRENCY.

      itab-/BIC/ZCurtype = itab-curtype.

      <b>if itab-/BIC/ZCurtype = '10' and itab-CS_ITEM = 'HEADCO'.

      <b>delete DATA_PACKAGE.</b> Endif.</b>

      append itab. "Add additional records

      endloop.

      refresh DATA_PACKAGE.

      DATA_PACKAGE[] = itab[].

      Can you please let me know if this routine is causing the problem? ( I mean when want to delete or not update Quantity where curtype is '10' and CS_ITEM = 'HEADCO', it's not allowing me. I am a novice in ABAP and your help is much appreciated. Thanks and looking forward for your response.

  • Posted on Oct 13, 2006 at 05:34 PM

    Hi:

    THe COde should still work. Don't mix this COde with old COde. Write after the old COde is finished.

    <i>data : itab like DATA_PACKAGE occurs 1 with header line.

    itab[] = DATA_PACKAGE[]. "copy all records to itab"

    loop at DATA_PACKAGE into itab.

    itab-/BIC/ZBALANCE = itab-BALANCE.

    itab-/BIC/ZCURRENCY = itab-CURRENCY.

    itab-/BIC/ZCurtype = itab-curtype.

    append itab. "Add additional records

    endloop.

    refresh DATA_PACKAGE.

    DATA_PACKAGE[] = itab[].</i>

    Code-1:

    delete data_package where CS_ITEM = 'HEADCO' and

    CURTYPE = '10'.

    OR

    Code-2:

    delete data_package where CS_ITEM = 'HEADCO' and

    ZCURTYPE = '10'.

    Try both these and tell me.

    NOTE: Don't write both the Codes. Try Code-1 first. If it doesn't work, try COde-2.

    Ram C.

    Message was edited by: Ram Chamarthy

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.