Looping through Collection and getting ConcurrentModificationException

I'm trying to loop through a collection to delete some objects referenced by that collection but keep coming up against a ConcurrentModificationException.
BwView view = svci.getViewsHandler().find("Lists");
              Collection<BwSubscription> subarr = new TreeSet<BwSubscription>();
              subarr = svci.getSubscriptionsHandler().getAll();  
              if (subarr == null) {
                   logger.info("Its not working");
              for (BwSubscription sub: subarr) {
                   logger.info("Removing subs " + sub);
                   svci.beginTransaction();
                   svci.getSubscriptionsHandler().delete(sub);
                   logger.info("Deleting calendars :" + sub);
                   svci.endTransaction();
             The loop is allowing me to delete the first entry but then fails with the exception.
I have tried with a generic loop but this doesn't initialise the sub entity so the loop fails and is ignored leading to problems later in the code.
BwView view = svci.getViewsHandler().find("Lists");
              BwSubscription[] subarr = (BwSubscription[])view.getSubscriptions().toArray(new BwSubscription []{});
              if (subarr == null) {
                   logger.info("Its not working");
              for (int i=subarr.length - 1; i>=0; i--) {
                   sub = subarr;
               logger.info("Removing subs " + sub);
               svci.beginTransaction();
               svci.getSubscriptionsHandler().delete(sub);
               logger.info("Deleting calendars :" + sub);
               svci.endTransaction();
Sub is either not initialised or gets initialised as 0 causing an ArrayIndexOutofBoundsException. I'd be grateful for some advice on getting the code to loop correctly.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

While iterating over a collection (using its iterator), a ConcurrentModificationException will be thrown if the collection is modified, except if it is modified using the iterator itself.. The enhanched for-loop you're using is iterating over the collection by implicitly using an Iterator. To do what you want, make the Iterator explicit (change the enhanced for-loop to a while loop) and then use iterator.remove().

Similar Messages

  • Looping through folders and subfolders

    Hi,
    I'm about to create a script to check some tifs and jpgs for the right height and width, resolution and so on.
    I could get it to work if I see the files in the content panel (looping through the files by app.document.getSelection ...
    The script needs to check many files in different subfolders (all in one parent folder), so I don't like to use a collection to reveal all files of all subfolders first and then start the script.
    My plan is to choose the parent folder in the folder panel and the script should  loop through each file of each subfolder ...
    So maybe there's someone who knows a solution for this problem, it would be great!
    Thanks a lot,
    Sebastian.

    Wow,
    That was fast, I'll test it tommorow in the morning, thanks a lot so far!
    Hopefully I'll be able to get our scripts together...
    Thanks
    Sebastian
    Am 05.08.2012 um 20:13 schrieb Paul Riggott <[email protected]>:
    Re: looping through folders and subfolders
    created by Paul Riggott in Bridge Scripting - View the full discussion
    This should get you started...
    #target bridge  
    var folders =[];
    folders = FindAllFolders(Folder(app.document.presentationPath), folders);
    folders.unshift(Folder(app.document.presentationPath));
    for(var a in folders){
    var fileList = folders[a].getFiles(/\.(jpg|tif)$/i);
    for(var p in fileList){
    var thumb = new Thumbnail(fileList[p]);
    var height = thumb.core.quickMetadata.height;
    var width = thumb.core.quickMetadata.width;
    var Resolution = thumb.core.quickMetadata.xResolution;
    if(Resolution ==0) Resolution =72;
    //do your processing here
    //$.writeln(decodeURI(thumb.spec) + "," + height + "," + width + "," + Resolution);
    function FindAllFolders( srcFolderStr, destArray) {
    var fileFolderArray = Folder( srcFolderStr ).getFiles();
    for ( var i = 0; i < fileFolderArray.length; i++ ) {
      var fileFoldObj = fileFolderArray[i];
      if ( fileFoldObj instanceof File ) {  
      } else {
             destArray.push( Folder(fileFoldObj) );
      FindAllFolders( fileFoldObj.toString(), destArray );
    return destArray;
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4599891#4599891
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4599891#4599891. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Bridge Scripting by email or at Adobe Forums
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Looping through collection of symbols and populating a drop down on a form EXTENDSCRIPT

    Hello everyone-
    I got a question.  Would it be possible to run a script that would loop through a collection of symbols in a defined library and populate a drop down with the available symbols. My goal is to be able to open Illustrator, and when I run the script the dropdown is populated with all available symbols(text is fine) in a defined library that I can then select and place on the artboard. Any help would be appreciated.
    thanks in advance!

    So...
    Dim appref As New Illustrator.Application
    Dim docRef As Illustrator.Document                                                                         'The work document
    Dim docToAdd As Illustrator.Document                                                                   'The document which contain the symbol's library 
    Dim pathArt As Object
    Dim ItemSymbol As Object
    Dim itemSymbolref As Illustrator.Symbol
    Dim artObject As Variant
    appref.Open ("C:\..... workDoc.ai")
    Set docRef = appref.ActiveDocument                                                                         'Assign docRef to your work document
    appref.Open ("C:\......symbolDoc.ai")
    Set docToAdd = appref.ActiveDocument                                                                    'Assign docToAdd to your symbol document
    Set symbolref = appref.ActiveDocument.Symbols(Symbol_Name)                               'Assign symbol ref the symbol you're looking for
    Set itemref = appref.ActiveDocument.SymbolItems.Add(symbolref)                              'Copy it on the current active page
    itemref.Selected = True                                                                                              'select it
    docToAdd.Copy                                                                                                         'add it to your clibboard
    docToAdd.close (aiDoNotSaveChanges)                                                                     'Close the library, without changing anything
    appref.ActiveDocument.Paste                                                                                     'Paste the clipboard on your work document
                             'As soon as you paste the symbol, it will be added in the document symbol library
    Clipboard_Clear                                                                                                         'See below why...
    SelectedObjects =appref.ActiveDocuments.selection                                                   ' Select the symbol you past
                             ' The loop is not necessary if you have only one thing selected
    For Each artObject In selectedObjects
        artObject.Delete
    Next
                             ' Cleanup your pointers
    Set artObject = Nothing
    Set pathArt = Nothing
    Set docToAdd = Nothing
    [....] Continue your script on your working document
    Set docRef = Nothing               'after closing your working doc...
    Remark on clipboard_clear : If you don't do it, the risk is to accumulate plenty other things you don't want...
    Public Function ClipBoard_Clear()
      Call OpenClipboard(0&)
      Call EmptyClipboard
      Call CloseClipboard
    End Function
    With
    Public Declare PtrSafe Function OpenClipboard Lib "user32" (ByVal hWnd As Long) As Long
    Public Declare PtrSafe Function CloseClipboard Lib "user32" () As Long
    Public Declare PtrSafe Function EmptyClipboard Lib "user32" () As Long
    be careful I use the PtrSafe pointer due to the fact I'm working in x64 architecture
    in x86 it will be
    Public Declare Function OpenClipboard Lib "user32" (ByVal hWnd As Long) As Long
    Public Declare Function CloseClipboard Lib "user32" () As Long
    Public Declare Function EmptyClipboard Lib "user32" () As Long
    Regards to all
    Michel

  • Is it possible to query a collection and get the last logged on user?

    Hi
    Is it possible in SCCM to query a collection to get the computer names and the last logon user for each computer? I cant seem to find how to do this?
    Thank you

    try this out
    Select distinct   
    v_R_System.Netbios_Name0 AS [Computer Name],  
    v_GS_COMPUTER_SYSTEM.UserName0 AS [User Name]
     from v_R_System
    left join v_GS_COMPUTER_SYSTEM on (v_GS_COMPUTER_SYSTEM.ResourceID = v_R_System.ResourceID) 
    inner join v_fullcollectionmembership as b on (b.ResourceID = v_R_System.ResourceID) 
    left join v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP ON v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP.ResourceID = v_R_System.ResourceID
            inner join v_GS_SYSTEM e on e.resourceid = b.resourceid
     Where
    b.CollectionID = @collectionid
    Blog: http://theinfraguys.com
    Follow me at Facebook
    The Infra Guys Facebook Page
    Please remember to click Mark as Answer on the answer if it helps you in anyway

  • How to Loop through App and finding popup Windows

    Does anyone know how to loop through the app and find any
    popup windows..

    I guess application by default creates a SystemManager
    object... So i used
    this.systemManager.popUpChildren.numChildren and it gives me
    0 all the time.. even though I have instances of windows to the
    app.. According to the documentation this should give you the
    number of popup children but it doesn't.. Any more ideas?

  • Looping through Collection

    Hello I need to loop through the collection to process 500 records at a time from the resultset.
    how do i do this?
    I have created another variable of same type as resultset output variable type. but not sure how to assign nodes 1 to 1000 to the new variable.

    Hi,
    You can loop over your collection with a while loop. The following is from the bpel samples directory (112.Arrays) adapted to your needs. Define the variables:
    <variable name="iterator" type="xsd:integer"/>
    <variable name="count" type="xsd:integer"/>
    <variable name="xpath" type="xsd:string"/>
    Set the initial values:
    <assign name="SetInitialValues">
    <copy>
    <from expression="1"/>
    <to variable="iterator"/>
    </copy>
    <copy>
    <from expression="ora:countNodes('input', 'payload','/tns:collection/tns:item')"/>
    <to variable="count"/>
    </copy>
    </assign>
    Make a while loop:
    <while condition=" bpws:getVariableData('count') >= bpws:getVariableData('iterator')">
    <sequence>
    <assign name="setAttribute">
    <copy>
    <from expression="concat('/tns:collection/tns:item[',bpws:getVariableData('iterator'),']/tns:value')"/>
    <to variable="xpath"/>
    </copy>
    <copy>
    <from expression="bpws:getVariableData('input','payload',bpws:getVariableData('xpath'))/>
    <to variable="output" part="payload" query="/tns:recordVariable/tns:value"/>
    </copy>
    <!--
    Place here your own actions to be executed for every row
    -->
    <copy>
    <from expression="bpws:getVariableData('iterator') + 1"/>
    <to variable="iterator"/>
    </copy>
    </assign>
    </sequence>
    </while>
    So the trick is to dynamically build an xpath expression based on the while loop counter.
    Kind Regards,
    Andre

  • Loop through select and create cursor

    Is it possible to create a cursor after looping through a select?
          FOR TEST IN
            SELECT *
              FROM SOMETABLE
             WHERE SOMEID > 100
           ) LOOP
              IF TEST.NAME = 'AB' THEN
                   --CREATE CURSOR AND LOAD DATA
                   --LOAD TEST.ID, TEST.NAME, TEST.ADATE INTO NEW CURSOR
              END IF;
           END LOOP;     This is just a sample not the actual scenario.

    SeshuGiri wrote:
    Is it possible to create a cursor after looping through a select?Yes. But is also usually the wrong thing to do.
    A cursor loop within another cursor loop is known as a nested loop join in SQL. The SQL language is perfectly able to do joins like that. And far better and faster. It has a very clever optimiser and has more sophisticated algorithms than just a nested loop, for joining data sets.
    The sample code you've posted shows a very old 80's style Cobol approach to processing ISAM files or magnetic tape. In a row-by-row fashion.
    This approach does not scale in the modern database, where the SQL language is a data set processing language - and not an I/O interface for merely reading a record/row and writing a record/row as we did in the 80's with file-based data records.
    The basic approach to Oracle is: Maximise SQL. Minimise PL/SQL (Java/etc).
    This means using the very flexible, incredibly powerful, SQL language first and foremost to crunch database data. And only when the processing is beyond the capability of the SQL language alone, employ PL/SQL. Else restrict PL/SQL to managing only the process flow and error handling of SQL language statements.

  • Looping through elements and assigning the proper attributes

    So I'm trying to loop through all my xml elements. I then
    want to loop through an element and an elements child and all
    attributes assigned inside. Does this make sense, I hope so? This
    is for an on going Cascading menu I have been building. So
    basically every element inside an element would be a submenu of a
    menu. Here is what I have....

    Okay. Much better subject line this time. :)
    You apparently know what a factorial is. You need to multiply the input by all numbers less than it (except for special case of 0! [but, then, you tell them to enter a number between 1 and 12]).
    You don't want your loop to be "while (true)". You can either start at 1 and work your way up to the input number, or start at the input number and work your way down. You may want a 'for' loop instead of a 'while' loop.
    In this (and most cases), think about how you would calculate factorials manually. Write it down in English. Then, translate it to code.
    You've been working on factorials for a while now. You haven't found the algorithm yet?

  • How to loop through dates and return a list of dates?

    hi,
    thank you all for your help my all my oracle endaevors so far:)
    I was going through PL/SQL Programming book by Oracle Press, but overall wasnt able to find the answer for the following.
    I have a list of shops, simple: shop_name (table), date_holiday (table) that lets me keep dates that certain shop is closed.
    example: shopID = 10
    shopID 10
    date_holiday 12/31/2009
    shopID 10
    date_holiday 1/1/2009
    now, what I am trying to achieve is I am trying to get the list of days (formatted as MM/DD/YYYY, but thats not biggy) starting today and ending up in 3 months from now that will EXCLUDE all the holidays, example
    select date_open ...... where shopID = 10;
    [starting today]
    12/29/2009
    12/30/2009
    1/2/2010
    1/3/2010
    [ending 3 months from today]
    any simple ways or ideas that may help?
    thank you!

    somehow like this
    select :the_shop shopid,the_day date_open
      from (select the_day,date_holiday
              from (select trunc(sysdate) + level the_day
                      from dual
                    connect by level <= add_months(trunc(sysdate),3) - trunc(sysdate)
                   ) d,
                   (select date_holiday
                      from holday_table
                     where shopid = :the_shop
                   ) h
             where the_date = date_holiday(+)
           (select nvl2(location_open1,'open,','mon,')||
                   nvl2(location_open2,'open,','tue,')||
                   nvl2(location_open3,'open,','wed,')||
                   nvl2(location_open4,'open,','thu,')||
                   nvl2(location_open5,'open,','fri,')||
                   nvl2(location_open6,'open,','sat,')||
                   nvl2(location_open7,'open,','sun') location_not_open
              from locations
             where locationid = (select shopid
                                   from shops
                                  where shopid = :the_shop
    where instr(location_not_open,to_char(the_day,'dy')) = 0
        or date_holiday is nullRegards
    Etbin

  • Loop through xml and update the value

    I have the following xml table. I need to update the Field which name="data"
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <Root name="xyz">
    <Row id="1">
    <Field name="data">456</Field>
    <Field name="time">2005-02-08 10:43:51</Field>
    </Row>
    <Row id="2">
    <Field name="data">123</Field>
    <Field name="time">2005-02-08 10:43:16</Field>
    </Row>
    </Root>
    After update, the table should look like this
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <Root name="xyz">
    <Row id="1">
    <Field name="data">abc</Field>
    <Field name="time">2005-02-08 10:43:51</Field>
    </Row>
    <Row id="2">
    <Field name="data">edf</Field>
    <Field name="time">2005-02-08 10:43:16</Field>
    </Row>
    </Root>
    How do I update the value through java program? I do not want to load the data to database to update the value. The constrain is that i must have the value updated in java application before I loaded it to the database.
    Please any advise?
    Thank you!

    Use a DOM parser to parse the xml document...you will get a Document object, which you can use XPath or traverse the DOM tree and perform the updating.

  • Issue in looping through drives and servers

    I'm trying to write a script which scan through all the drives and find old files with specific extension on the list of servers which I pass in servers.txt. Please find below the errors and the script which I executed. Can anyone suggest 1) why it is checking
    in my local desktop drive rather than server listed in servers.txt.2) How to pass a value to a variable :$diskname="\\$strComputer$\$disk$"
    Error Message 
    starting
    Cannot find an overload for "op_Subtraction" and the argument count: "2".
    At C:\Documents\oldfiles_new.ps1:29 char:25
    +    $time = ((Get-Date) - <<<<  $file.CreationTime).Days 
        + CategoryInfo          : NotSpecified: (:) [], MethodException
        + FullyQualifiedErrorId : MethodCountCouldNotFindBest
    \\.$\\\local_host\root\cimv2:Win32_LogicalDisk.DeviceID="D:"$
    Compiling list, this could take a while.
    Get-ChildItem : Illegal characters in path.
    At C:\Documents\oldfiles_new.ps1:25 char:23
    + $files = get-childitem <<<<  $diskname -Include *.trn,*.bak -recurse  
        + CategoryInfo          : InvalidArgument: (\\.$\\\ACWIN-MG....DeviceID="D:"$:String) [Get-ChildItem], ArgumentException
        + FullyQualifiedErrorId : ItemExistsArgumentError,Microsoft.PowerShell.Commands.GetChildItemCommand
    Script which I executed:
    function oldfiles {
    Param( 
        [alias("f")] 
        $outfile, 
        [alias("a")] 
        $maxage, 
        [alias("d")] 
        [string] $strComputer) 
    #If a parameter was not specified, set a defualt 
    if (!($strComputer)) {$strComputer = "."} 
    if (!($outfile)) {$outfile = "C:\Documents\oldfiles.csv"} 
    if (!($maxage)) {$maxage = 10} 
    #param( [string] $strComputer) 
        # Get the Disks for this computer
        $colDisks = get-wmiobject Win32_LogicalDisk -computername $strComputer -Filter "DriveType = 3"
    foreach ($disk in $colDisks) {
    $diskname="\\$strComputer$\$disk$"
    $diskname
    Write-host "Compiling list, this could take a while." 
    $files = get-childitem $diskname -Include *.trn,*.bak -recurse  
    "File Name `t Age in Days " | out-file $outfile 
    write-host "starting" 
    foreach ($file in $files) { 
       $time = ((Get-Date) - $file.CreationTime).Days 
    #$totalSize = {($file).Length -gt 5kb }
       if ($time -gt $maxage -and $file.PSiSContainer -ne $True) {"$($file.FullName) `t $time `t" | out-file -Append $outfile}  
    foreach ($computer in cat C:\Documents\servers.txt) {oldfiles $strcomputer}
    Any help would be appreciated
    Thanks

    This will get you close but it will take forever to run.
    function oldfiles{
    Param(
    $outfile='C:\Documents\oldfiles.csv',
    $maxage=10,
    [string]$computer=$env:COMPUTERNAME
    $date=[DateTime]::Today
    $colDisks=get-wmiobject Win32_LogicalDisk -computername $computer -Filter 'DriveType = 3'
    foreach ($disk in $colDisks){
    $driveletter=$disk.DeviceID.Split(':')[0]
    $diskname="\\$computer\$driveletter$"
    Write-host 'Compiling list, this could take a while.'
    $files = get-childitem $diskname -Include *.trn,*.bak -recurse
    "File Name `t Age in Days " | out-file $outfile
    write-host "starting"
    foreach ($file in $files) {
    $time = ($date- $file.CreationTime).Days
    if ($time -gt $maxage){
    "$($file.FullName) `t $time `t" | out-file -Append $outfile
    foreach ($computer in (cat C:\Documents\servers.txt)){
    oldfiles $computer
    ¯\_(ツ)_/¯

  • Loop through month and year till date while using a merge statement

    Hello Guys,
    I have 2 tables with the following datas in them:-
    Company
    CompanyId CompanyName
    1                 Company1
    2                 Company2
    3                 Company3
    Employees
    EmployeeId EmployeeName CompanyId StartDate
    1                  Employee1        1                 12/21/2011
    2                  Employee2        1                 01/20/2012
    3                  Employee3        2                 03/23/2012
    4                  Employee4        2                 07/15/2012
    5                  Employee5        2                 01/20/2013
    6                  Employee6        3                 12/17/2013
    Now i want to check, How many people were recruited in the team in the specified month and year? I have the storage table as follows:-
    RecruiterIndicator
    CompanyId Year Month EmployeeRecruited
    1                 2011 12      1
    1                 2012 1        1
    2                 2012 3        1
    2                 2012 7        1
    2                 2013 1        1
    3                 2013 12      1
    This should be a merge stored procedure that should update the data if it is present for the same month year and company and insert if that is not present?
    Please help me with this
    Thanks
    Abhishek

    It's not really clear where the merge to come into play. To get the RecruiterIndicator table from Employess, this query should do:
    SELECT CompanyId, Year(StartDate), Month(StartDate), COUNT(*)
    FROM   Employees
    GROUP  BY CompanyId, Year(StartDate), Month(StartDate)
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Added Link at messageLovInput through personalizaton and getting error

    Hi Friends,
    While creating work order in eAM, Material Requirements secon is there, there we can find Item messagelovinput field. My clients wants to check Item details while selecting the item (long desc, on hand quantity etc..). For getting this functionality developed one custom page with item details and calling that page using link at item lov.
    1) added link at results table of Item lov and given at destination URI as follows
    OA.jsp?page=/xxnwc/oracle/apps/eam/workorder/webui/XXNWCItemDetailsPG&addBreadCrumb=Y&org_id={@OrganizationId}&inv_id={@InventoryItemId}.
    Issue
    1) open Item lov click on go --> we will get item in results table --> click on item details link --> open new custom page
    2) click on quick select at item then getting error like as follos
    Error: Cannot Display Page
    You cannot complete this task because you accessed this page using the browser's navigation buttons (the browser Back button, for example).
    To proceed, please select the Home link at the top of the application page to return to the main menu. Then, access this page again using the application's
    navigation controls (menu, links, and so on) instead of using the browser's navigation controls like Back and Forward.
    Please let me know how to resolve this issue.
    For replicating issue you can go
    Responsibility: Maintenance Super User > Work Orders tab> then go to “Material Requirements” section. > add link to Item lov
    Thanks in Advance,
    Hanimi.

    I'm a great fan of problems magically fixing themselves ... always breathe a sigh of relief if that happens during a troubleshoot.
    I was wondering about trouble with a piece of album art initially. But if that was afoot we'd expect the synch to be always dying on the same song (or songs from the same album).
    Perhaps it's just that the USB connection is getting grumpy during a *really long* sync. If that's what is going on, we could be able to make some progress by moving the music across in smaller batches.
    Switch the iPod over to manually managing content. Select a chunk of songs ... say, about 1.5 GB-worth, and copy them over.
    Does that complete successfully? If so, select another batch of about 1.5 GB, and copy them over, and so on until you've got the songs on. Once you've done that, you can switch her back to your preferred auto-sync settings.
    Any better luck getting stuff on in stages like that?

  • Loop through layers and determine if its a text containing layer

    Hi,
    I am trying to loop/iterate through all layers, determine if it's a "text-layer", if it is, set it's opacity to 0.
    This is what I have so far:
    var iapp = new Illustrator.Application();
    var openoptions = new Illustrator.OpenOptions();
    var idoc = iapp.Open("c:\\myFile.pdf", Illustrator.AiDocumentColorSpace.aiDocumentRGBColor, openoptions);
    Illustrator.Layer mainlayer = idoc.Layers["Layer 1"];
    foreach (Illustrator.GroupItem groupitem in idoc.GroupItems)
    foreach (Illustrator.GroupItem item in groupitem.GroupItems)
    /* determine here if its a textlayer */
    if( ... ) // (item.TextFrames.Count > 0) perhaps?
    item.Opacity = 0;
    //item.Opacity = 15; //this indeed sets the layer opacity 15

    Is that VB? Does your soloution need to be too?
    #target illustrator
    textLayersOff();
    function textLayersOff() {
              var doc = app.activeDocument;
              for ( var i = 0; i < doc.layers.length; i++ ) {
                        if ( doc.layers[i].textFrames.length > 0 ) { doc.layers[i].opacity = 0; };
    This would check for text frames NOT their content… if any

  • Loop through header and item internal table

    Hi,
        My scenario will be like this, i have two internal tables which is populated based on certain conditions, now i have to call one bapi to update values that am going to store values in a tree structure say for eg mat01 is header and mat02 and mat03 are item values.
          What is the efficient method to call that bapi one time for header creation and consequte times for item creation respectively.
      shall i have to loop thro two internal tables i.e header and item?
    suggestions are welcomed from the experts...
    Thanks in advance...
    Regards,
    Babu

    Hi Babu
    you can do something like that.
    loop it_header.
    *Call bapi to create header
      loop it_item where field_key = it_header-field_key.
    *  Call bapi to create item  
      endloop.
    endloop.
    The important part is the where sentence in the second loop.
    Regards
          David N.

Maybe you are looking for