Start routine logic to delete sourcepackage if there are no entries in itab

Hi there,
I am trying to Delete entries from a source_package where
source_package-material does not exist in itab_ds001(this internal table contain 3000 records, and has columns material, and Batch) and
source_package-batch does not exist in itab_ds001(this internal table contain 3000 records, and has columns material, and Batch)
I knew, it can be achieved with 2 loops,
But the problem is, My full load deal with 4 million records
--> 4 million times 3000 internal loops.,...takes lot of time to execute.
so I am looking for some ABAP coding help from experts
appreciate your time

Hi, it is very easy.
LOOP AT source_package assigning <source_fields>.
READ TABLE itab_ds001 Transporting no fields
With key material = <source_fields>-material.
IF sy-subrc NE 0.
DELETE source_package index sy-tabix.
ENDIF.
READ TABLE itab_ds001 Transporting no fields
With key batch = <source_fields>-batch
IF sy-subrc NE 0.
DELETE source_package index sy-tabix.
ENDIF.
ENDLOOP.
Hope it is helpful

Similar Messages

  • Start Routine logic to delete records which do not satisfy a condition

    Hello,
    Iam trying to code a start routine to delete the records from the source_package if a certain set of conditions are not met.
    It is failing at the last statement.
    Pls help.
    Thanks
    Jagadish
    code is as follows..
    LOOP AT SOURCE_PACKAGE assigning <SOURCE_FIELDS>.
    IF not (
    ( <SOURCE_FIELDS>-/BIC/ZCLSD_DT BETWEEN <SOURCE_FIELDS>-/BIC/ZWEEKOF
    AND <SOURCE_FIELDS>-/BIC/ZNONWKOF )
      AND
      ( <SOURCE_FIELDS>-/BIC/ZCLSD_DT IS  INITIAL )
    DELETE SOURCE_PACKAGE FROM <SOURCE_FIELDS>.
    (is failing at the delete statement.)
    ENDIF.
    ENDLOOP.

    Thanks Pratap,
    I used an internal table to load the records and used a delete statement out side the LOOP.
    By using a Work Area assignment instead of the Source_fields, The delete statement is giving me an error saying "Conversion of Numeric Value to type Object is not valid".
    Here is the code I have modified...
       TYPES: BEGIN OF LINE,
                WO(6) type c,
              END OF LINE.
       DATA: WA TYPE LINE,
             ITAB TYPE TABLE OF LINE.
    LOOP AT SOURCE_PACKAGE assigning <SOURCE_FIELDS>.
    IF NOT (
    ( <SOURCE_FIELDS>-/BIC/ZCLSD_DT BETWEEN <SOURCE_FIELDS>-/BIC/ZWEEKOF
        AND <SOURCE_FIELDS>-/BIC/ZNONWKOF
      AND
      <SOURCE_FIELDS>-/BIC/ZAPRD_DT IS NOT initial )
    Append <SOURCE_FIELDS>-/BIC/ZWO_NBR to itab.
    ENDIF.
    ENDLOOP.
    loop at itab into WA.
    DELETE SOURCE_PACKAGE where /bic/ZWO_NBR = WA-wo.
    endloop.

  • ABAP assistance - start routine logic in update rule

    I have used an existing update rule and have based my logic around the same.  The purpose of the rule is to look up customer master data and get a subset of customer numbers from the transaction records so that the values for customer number from the transactional data will not be updated if it does not match with existing master data customer numbers.
    The loads are full and we drop the data before we load.
    I have listed the logic below (the number at the front is to be considered as the line number) and a list of open questions that I have thereafter:
    Start routine logic:
    1  DATA: l_index LIKE sy-tabix.
    2  DATA: BEGIN OF ls_customer,
    3        customer TYPE /BI0/OICUSTOMER,
    4        objver TYPE RSOBJVERS,
    5     END OF ls_customer,
    6      lt_customer LIKE TABLE OF ls_customer.
    7  REFRESH: lt_customer.
    8  LOOP AT DATA_PACKAGE.
    all customers from data package
    9    ls_customer-custno = DATA_PACKAGE-custid.
    10  ls_customer-objver = 'A'
    11    APPEND ls_customer TO lt_customer.
    12   ENDLOOP.
    12  SORT lt_customer.
    13  DELETE ADJACENT DUPLICATES FROM lt_customer.
    14   IF NOT lt_customer[] IS INITIAL.
    15    SELECT /BI0/OICUSTOMER RSOBJVERS
    16      FROM /BI0/PCUSTOMER
    17      INTO CORRESPONDING FIELDS OF TABLE lt_customer
    18      FOR ALL ENTRIES IN lt_customer
    19      WHERE ls_customer-custno = DATA_PACKAGE-custid
    20      AND ls_customer-objver = 'A'
    21    SORT lt_customer BY customer ASCENDING                    
    22  ENDIF.
    Questions
    Line
    1 - what is the purpose of this line? What is it that is being declared
    2 - in some code I have seen this line with OCCURS 0 at the end what does this mean with and without the term?
    4 - I am using the Data Element name is this correct or should I use the field name?
    3 - 5 here I declare an internal structure/table is that correct?
    6 - here I declare a work area based on the internal table is that correct?
    7 - What would happen if I avoided using the REFRESH statement?
    8 - 12 - Is this syntactically correct, I am trying to get a set of data which is the customer numbers which match the master data customers and the master data record is án active version and than appendíng to the work area?
    13 - My understanding is this will reduce the number of records in the work area is this correct and needed?
    14 - 22 I am trying to identify my required set of data but feel I am repeating myself, could someone advise?
    Finally what logic would I actually need to write in the key figure object, could I use something like:
    Result = lt_customer.
    Thanks
    Edited by: Niten Shah on Jun 30, 2008 8:06 PM

    1. This line is not required
    2. OCCURS 0 is the OLD way of defining an internal table with that structure.  As it is, it just defines a flat structure.
    3. Data element is usually best
    3-5 Yes
    6. No.  Here you are declaring a table of the type of the flat structure.  Just as the ABAP says!
    7. Nothing.  But by putting this in, you ensure that you know the state of the table (empty) before you start looping through the data package
    8-12. You can tell if it is syntactically correct by pressing Ctrl-F2 when in the editor.  Looks ok.
    13. Ensures your list of customers contains no duplicated.  The code up to this point is building a list of all the unique customers in the data package.
    14-22. Goes to the database and brings back ONLY those customers which are found in the master data.  Looks ok.
    This is a start routine (that's why you've got a data package).  You don't use result.  You should update the datapackage.  But this you haven't done.  Double click on the table name /BIC/PCUSTOMER to get the correct field names.
    So you have to loop through the data package again, and check if the customer in the datapackage is lt_customer.  If it is, fine, otherwise you blank it and report an error, or set an error message or whatever.
    I wouldn't do it like this.  I'd do something like this:
    STATICS: st_customer TYPE HASHED TABLE OF TYPE /bi0/oicustomer
                                  WITH UNIQUE KEY TABLE_LINE.
    * st_customer retains its value between calls, so only populate if empty
    * In one run of the infopackage, this will mean you do only one read of
    * the master data, so very efficient.
    IF st_customer IS INITIAL.
      SELECT customer FROM /BI0/PCUSTOMER
                              INTO TABLE st_customer
                              WHERE objvers EQ 'A'. " Only active values
    ENDIF.
    * Go through data package
    LOOP AT DATA_PACKAGE.
    * Check whether the customer exists.
      READ TABLE st_customer TRANSPORTING NO FIELDS
                  WITH TABLE KEY table_line = DATA_PACKAGE-custid.
      CHECK sy-subrc IS NOT INITIAL.
    * If you get here, the customer isn't valid.  So I'm just setting it blank
      CLEAR DATA_PACKAGE-custid.
      MODIFY DATA_PACKAGE. " Updates the datapackage record
    ENDLOOP.
    Even this is not fully optimised, but it's not bad.
    I strongly suggest that you get yourself sent on the basic ABAP programming course if you're going to do a lot of this.  Otherwise, read the ABAP documentation in the help.sap.com, and, from the editor, get the cursor on each ABAP keyword and press F1 to read the ABAP help.
    matt

  • I delete some emails ,there are moved to trash . I delete them from trash folder too and they still appear in a folder called 'all messages". I repeat the same actions and after a while they appear again!what should i do to delete them permanently??

    I delete some emails ,there are moved to trash . I delete them from trash folder too and they still appear in a folder called 'all messages". I repeat the same actions and after a while they appear again!what should i do to delete them permanently??

    If you are using Apple's Mail app 6.5 is the latest version irrespective of what a previous poster says. It does sound though that you are using a gmail account online via a web browser. Please confirm and fill in missing information.

  • Under Options , Applications There are multiple entries for the same item (Acrobat Document). how can I delete the duplicates?

    Under Options, Applications there are multiple entries for the same item. (Adobe Acrobat) . Three show Adobe Acrobat Reader 9.3 and the other shows (ask) or (save file) with no ability to select Acrobat Reader . Is there a way to edit this list to remove the duplicates and
    the incorrect entry? Adobe installed a very quick update today.

    They are all different. Hover your mouse pointer over each of the "Content Type" descriptions and you should see a "tooltip" to see that each has a different description.
    You need to update your plugins. It is important to keep them updated due to continuing security fixes and improvements in those plug-ins:
    * Adobe Shockwave for Director Netscape plug-in, version 11.5 (you '''<u>may</u>''' need to update)
    * Shockwave Flash 10.1 r53
    * Next Generation Java Plug-in 1.6.0_20 for Mozilla browsers
    #Check your plugin versions: http://www.mozilla.com/en-US/plugincheck/
    #*'''Note: plugin check page does not have information on all plugin versions'''
    #'''Update Shockwave for Director'''
    #*NOTE: this is not the same as Shockwave Flash; this installs the Shockwave Player.
    #*Use Firefox to download and SAVE the installer to your hard drive from the link in the article below (Desktop is a good place so you can find it).
    #*When the download is complete, exit Firefox (File > Exit)
    #*locate and double-click in the installer you just downloaded, let the install complete.
    #*Restart Firefox and check your plugins again.
    #*'''<u>Download link and more information</u>''': http://support.mozilla.com/en-US/kb/Using+the+Shockwave+plugin+with+Firefox
    #'''Update Shockwave Flash'''
    #*Use Firefox to Download and SAVE to your hard drive from the link in article below
    #*SAVE to your Desktop so you can find it
    #*After download completes, close Firefox
    #*Click on the file you just downloaded and install
    #**Note: Vista and Win7 users may need to right-click the installer downloaded and choose "Run as Administrator"
    #**Note: Most browsers other than IE will also get updated with this one download
    #**Note: To update IE, same procedure '''<u>but use IE</u>''' to go: http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_ax.exe
    #*After installation, restart Firefox and check your version again.
    #*'''<u>Download link and other information</u>''': https://support.mozilla.com/en-US/kb/Managing+the+Flash+plugin#Updating_Flash
    #* Also see: http://support.mozilla.com/en-US/kb/Installing+the+Flash+plugin
    #* Also see (if needed): http://kb2.adobe.com/cps/191/tn_19166.html#main_Uninstall
    #'''Update Java:'''
    #* Download and update instructions: https://support.mozilla.com/en-US/kb/Using+the+Java+plugin+with+Firefox

  • HT4436 Why don't all my contacts and calendar events on my iMac (version 10.7.4) stream onto iCloud? For instance, there are 470 entries in my address book but only 270 on iCloud. And not all my appointments in iCal are transferred.

    Why don't all my contacts and calendar events on my iMac (version 10.7.4) stream onto iCloud? For instance, there are 470 entries in my address book but only 270 on iCloud. And not all my appointments in iCal are transferred either.
    I have the same problem transfering Address book on iMac to contacts on iPhone (old version 3G - on iCloud). this is a hard wired connection

    Might you have 200 entries in On My Mac groups and some of your appointments in On My Mac calendars?

  • CCMS  there are no entries in "displays alerts" after unicode upgrade.

    Hello
    After an Unicode upgrade of an SAP 4.7, there are no entries in "displays alerts".
    Table ALALERTDB empty.
    Thanks

    Hi Gervase,
    I don't know what you have done yesterday, but now I can see note 1032334. Thanks.
    I closed the sap call again.
    Anyways, it was very strange, in transaction SNOTE I tried to download this note but then the message appeared "this note is not released, please inform your sap support". And on sap support portal it was near the same. Now I will implement it and give you a feedback if you wish.
    kind regards
    Diana

  • Start Routine Logic Updating Field in Target ODS

    Hi,
    I am creating a  Start Routine to Update Field (date) from one ODS to another based on the Key Structure: Document Number, Line Item Number.
    I am encountering a situation as follows:
    Source
    Doc Num 1 Line Item 10 Date 1/1/1
    Target
    Doc Num 1 Line Item 10 Date 1/1/1
    DocNum 1 Line Item 20
    DocNum 1 Line Item 30
    DocNum 1 Line Item 40
    The Routine I have now correctly updates line item 10 with the date 1/1/1.
    I am trying to modify the code to only update the target ods if all of the line items are in the source.  In this example Line Item 10 would not get updated since Line Items 20,30,40 are not in the Source ODS. 
    Has anyone encountered something like this.
    Thanks for any help.

    Hi,
    If you have all the line items in target for which you want to do updates  you can do this in transformation start routine.
    Try this first hand logic :
    1. Create a internal tables(say SOURCE_INTERNAL_TABLE and TARGET_INTERNAL_TABLE)
        with fields document number and another field integer say COUNTER
    2. Read active table of source for all the document numbers in source package.
    3. Update the SOURCE_INTERNAL_TABLE for all the document number with appropriate counts
        (All the records of same document number should be in same data package)
    4. Update the TARGET_INTERNAL_TABLE by reading the target ODS as done for source.
    5. LOOP  AT SOURCE_PACKAGE
         if COUNTER in SOURCE_INTERNAL_TABLE and TARGET_INTERNAL_TABLE is not same
         then delete the record from source package itself
       END LOOP
    6. Your next code
        (Please take care that you are not referring the deleted records otherwise it will through a dump)
    If you don't have all the line items in target then you need to bring them somewhere in BI (document number and item number only sufficient with both as a key fields) so as to refer them in your start routine.
    Please update me if anything is wrong or if any corrections in logic.
    Thanks and Regards,
    Prashant Vankudre.

  • Need Start routine logic

    Hi,
    Can anyone please let me know the code in start routine for the below.
    I want to delete the unwanted datapackage in start routine for the below condition.
    For  system PCR
    For purch.org Z300, only those purchase orders shall be loaded to further layers which have the text "FCM" in the field Incoterms2 (ZPURINC2), the other purchase orders of this purch org and this system can be deleted.
    thankyou........
    Regards...
    Balaji

    Hi,
    Delete Source_package where SYSTEM = 'PCR' and PURCH.ORG = 'Z300' and ZPURINC2 NE 'FCM'.
    Check the definition of source_package in the start routine screen and use the exact infoobjects while defining the Delete statement
    Regards
    Githen

  • Start Routine logic problem !

    Experts ,
    in my start routine,
    my Source-field-fieldname has value "ABC123"
    and i need to assing this value in reverse order like "123ABC" to the Infoobject.
    How do i get this output ?
    thankss

    Hi Honar ,
    Please use this code to reverse the strings.I think you want it like
    Input : "ABA123"
    Output : "321CBA"
    for this use below code
    data : v_Input (20) type c .
    data : v_Output(20) type c.
    LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS> .
    v_Input =   <SOURCE_FIELDS>-FIELDNAME .
    CALL FUNCTION 'STRING_REVERSE'
    EXPORTING
    string =v_Input
    lang = 'E'
    IMPORTING
    RSTRING = v_Output
    EXCEPTIONS
    TOO_SMALL = 1
    OTHERS = 2
    <SOURCE_FIELDS>-FIELDNAME = v_Output .
    ENDLOOP .
    This will work .
    If you have different requirement then please tell me .
    Regards,
    Jaya

  • Start routine code for deleting records in different language

    Hello,
    can someone please specify the exact code to be used in start routine, and whre exactly it needs to be pasted?
    this code is needed for master data notifaction type which is loaded for both languages German and English.
    german records are to be avoided.
    thanks,

    Ciao Claudio,
    this issue about languages selection is an old situation...
    The problem is that language selection is not possible, even if you have this field checked for selection !!!
    Look at OSS Note 324684...
    "If a field of a DataSource - typically with field name 'LANGU' or 'SPRAS' - is assigned to InfoObject '0langu', the field is not provided in the selection fields although the field actually can be selected. In this case, all languages of the language vector active in the BW System are requested by the source system but the language selection cannot be defined in the Scheduler.
    A precondition is that the language field of the DataSource in the source system is maintained as selection field. This setting is done in Transaction RSA6 (or RSO2 for customer developments)."
    Bye,
    Roberto

  • Start routine logic

    All Open Items  +   (Status Closed  and BLINEDATE <= Last day of the current Month  and Clearing Date > Last Day of the current Month  )
    Need to implement above routine in the star routine,
    To find open item we have a char FI_DOCSTAT if this is u2018Ou2019 it is a open item
    And if this is u2018Cu2019 that is a closed item.
    I know how to get that last month
    Unable to find the logic for the same.
    If you have some time please try to give the logic.
    Thanks,
    Satish

    Hi,
    Take the system date and calculate the Last Date of the month(through FM) then filter out the records.
    Regards,
    Pradeep.
    Edited by: Pradeepkdas on Jan 27, 2012 1:27 PM

  • Logic Pro 9: Delay when there are too many tracks

    Hello
    I'm using the latest Logic Pro 9 with OSX 10.9.5. on a MacMini (late 2012)
    Every time I reach a certain number of tracks in a project (around 70 or 80, complex Dance Music) I suddenly have a huge delay between "what I see" and "what I hear"..
    This means: If I press play, everything looks normal, but the audio arrives half a second later than what I see.
    When I want to play a midi note, I have a delay too.
    This is very irritating.
    I tried out everything in the audio settings (buffer size etc.)
    I also tried to freeze all the tracks, it didn't work.
    The only thing working is to delete many tracks. (Of course I don't want that)
    Any ideas?
    Thank you

    Hi, Matley.
    It could be that your memory is full.
    I have one project that has 60 odd tracks. Some audio, some software instruments. If I open this after I've opened a few other LP projects it won't run properly. If you are using lots of software instruments - especially those  that are CPU intensive - your RAM will max out and everything slows down or doesn't run properly.
    I have 16G of RAM on my 2012 mac mini.
    This article may help -  https://support.apple.com/en-au/HT203930
    Another thing to try is Low Latency mode. This limits the amount of RAM plugins use. I've had to use it occasionally and it does makes a large project run smoother.
    Hope this helps.
    regards,
    Scorpii

  • HT5622 I bought an Ipad on EBay.  The person that I bought it from deleted nothing.  There are too many Apple ID's on it to create another.  I don't have the password to log on to any of the existing ID's.   How do I get rid of the existing ID's?

    Help!

    While Demo's suggestion will remove the existing Apple IDs from the device, it is my understanding that there is a lifetime cap on the number of Apple IDs that can be created with each device. If a device has reached that limit, I would not expect that erasing the device would allow creation of more Apple IDs.
    The relevant sentence in the iCloud Terms and Conditions is in the third paragraph of REQUIREMENTS FOR USE OF THE SERVICE (the first major section:
    "Apple reserves the right to limit the number of Accounts that may be created from a device and the number of devices associated with an Account. High-speed Internet access is strongly recommended for use."
    (See http://www.apple.com/legal/internet-services/icloud/en/terms.html for the context.)
    You should be able to link an existing iCloud account to the iPad. If you don't have one, you may be able to create one using a browser on a desktop of notebook computer.
    Message was edited by: markwmsn - added last paragraph

  • I had to delete the entry when I changed the password, and now I cannot find a way to save it. there are two entries affiliated with the website

    The user name and password in question is for the website www,webkinz.com. One day there was a problem logging in so support changed my password. The problem occurs at webkinznewz where there is a frequent transfer of money and prizes from games to the main account. The newspaper has a differnt user name and password. Now when I try to transfer anything my newz name and password show up. Even when I change it manually it does not offer to save it

    Make sure that you not run Firefox in (permanent) [[Private Browsing]] mode.
    * You enter Private Browsing mode if you select: Tools > Options > Privacy > History: Firefox will: "Never Remember History"
    * To see all History and Cookie settings, choose: Tools > Options > Privacy, choose the setting <b>Firefox will: Use custom settings for history</b>
    * Uncheck: [ ] "Permanent Private Browsing mode"
    * http://kb.mozillazine.org/User_name_and_password_not_remembered

Maybe you are looking for

  • How can we execute a procedure with object type as its parameter, by passing partial elements.

    Can somebody help... I have a procedure which takes parameter as IN OUT extended object type .Below is the example. PROCEDURE p_save (example IN OUT xyz_obj) my object type "xyz_obj" have elements with other object types also, and that itself have ar

  • Class /SAPSRM/CL_WF_PROCESS_LEVEL method IS_LAST_LEVEL not working

    We are running SRM 7.0 SP 8 with Process Controlled Workflow. I am trying to use object with reference to class /SAPSRM/CL_WF_PROCESS_LEVEL, method IS_LAST_LEVEL to determine if the current workflow process level is the last in an N-step approval. Bu

  • Java FX not found

    I'm just starting to learn Java and I've been using NetBeans 7.3 I was trying to test out JavaFX but when I tried to import different class files from the JavaFX library it says javafx does not exist. I installed Java JDK 7 which has javafx installed

  • Creating Text Field into a MovieClip

    I create a TextField into a MovieClip but it doesn't appear to be inside. When I move the MovieClip , the textField should move wherever the "father" MovieClip goes. But it doesn't happend. It stays outside the movieclip in the _root. NOTE: "Ventana"

  • No Sound Running Windows 10 9926 in a VM

    I'm trying to test out the speech assistant but I cannot get any sound to play from and RDP connection.  The settings of the connection have sound enabled to the computer that it is connecting from. Windows 10 is showing that sound is enabled.  Mixer