Loop through a table

Is it feasible to write code that loops through a table in a form? I'm currently writing separate sections of code for each row of a five-row table to validate data entries.

Hi,
It would be easier if your table contained one row that repeated with an initial count of five (this is set in the binding tab of the Object palette).  This will change the XML generated but assuming that is not a problem your could loop though your table with the code;
    var rows = this.resolveNodes("Table1.Row1[*]");
    for (var i=0; i<rows.length; i++)
        var currentRow = rows.item(i);
If you do need the rows uniquely named then you could pass i and the result of "this.resolveNodes("Table1.Row"+i)" into a function.
This is you form back ... with only the first validation converted to the new approach.
https://acrobat.com/#d=akb0*Ptvdr3KSYN0VP*7zA
Hope this gets you started.
Regards
Bruce

Similar Messages

  • BRF : Looping through a table (e.g. Do Until or While, etc..)

    Hello Colleagues,
    In BRFPLus I understand we can create Loop Expressions that allow you to loop through a table and perform different Actions based  on the retrieved contents of the table.
    We are not using BRFPLus (but the old BRF instead). Does anyone know how to build Loop Expressions in BRF without the use of ABAP Function Modules?
    Your feedback would be really appreciated.
    Thanks in advance.
    Regards,
    Ivor M.

    Hello Colleagues,
    In BRFPLus I understand we can create Loop Expressions that allow you to loop through a table and perform different Actions based  on the retrieved contents of the table.
    We are not using BRFPLus (but the old BRF instead). Does anyone know how to build Loop Expressions in BRF without the use of ABAP Function Modules?
    Your feedback would be really appreciated.
    Thanks in advance.
    Regards,
    Ivor M.

  • Looping through a table

    how do I loop through the following table and get it to insert records into another depending on the number that it finds in the value column. eg if there is 8 in the value column, 8 records should be inserted into another table with the same ID
    i forgot to paste an example table
    ID
    Name
    Value
    1
    john
    12
    2
    sarah
    20
    3
    Tom
    5
    I want it to look at the value column and if it is 12 it should add 12 rows with the same ID into another table. eg in the new table there will be 12 rows for John with an ID of 1. For Sarah there will be 20 rows with an ID of 2.
    sukai

    Sure!
    DECLARE @sourceTable TABLE (ID INT, Name VARCHAR(20), Value INT)
    INSERT INTO @sourceTable (ID, Name, Value) VALUES (1, 'john', 12),(2, 'sarah', 20),(3, 'Tom', 5)
    This mocks up your source table (where your data is coming from). We're simply creating a table variable, and populating it with your example data.
    DECLARE @numbers TABLE (value INT)
    WHILE (SELECT COUNT(*) FROM @numbers) < (SELECT MAX(Value) FROM @sourceTable)
    BEGIN
    INSERT INTO @numbers (value) VALUES ((SELECT COUNT(*) FROM @numbers)+1)
    END
    This creates an example numbers table. The while causes the code to loop until there are as many rows as the maximum value for the Value column in your example data. Each time the loop iterates it inserts a row, causing the COUNT(*) to be one more each time,
    we add one to that, and insert it into the numbers table.
    INSERT INTO destinationTable
    SELECT s.ID, s.Name, s.Value
    FROM @sourceTable s
    INNER JOIN @numbers n
    ON s.Value >= n.value
    ORDER BY s.ID
    This performs an insert select to a made up table. We join the rows from @sourceTable (your example data) to the @numbers table where the Value column from @sourceTable is less than or equal to the value column in the numbers table. If s.Value is 1
    we'll perform this join once. If it's 2, twice and so on. This works because of the way we set up the numbers table. If we had insert multiple 1's it would cause additional joins.
    A numbers table is a handy tool to have for things like this were you need iterations. Create a database (or schema) on your database and call it something like 'Toolbox'. In that database/schema you can put things like this that have little to do with your
    actual data, but come in handy. You can make your numbers table as long as you need. It totally wouldn't hurt at all to have a numbers table with hundreds of thousands of rows. They're just int's, they don't eat much :).
    Let me know if you'd like anything clarified more.

  • Error "Screen output are too small" when looping through internal table!

    Hello All:
         I have a huge internal table with some 79000 records and while looping through them and doing some other processing inside the loop, I am getting an error "Screen output are too small"! Could someone please help mw how to fix this issue? I can send the all the code if anyone wants to look at the code. Thanks in advance and rewards are assured.
    Mithun

    Hi,
    Check this
    new-page print off.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
    destination = v_dest
    IMPORTING
    out_parameters = params
    valid = valid.
    * params-linct = '58'.
    * params-linsz = '170'.
    * params-paart = 'X_58_170'.
    * params-prtxt = v_spool_text.
    * params-primm = 'X'.
    * params-prrel = 'X'.
    NEW-PAGE PRINT ON PARAMETERS params NO DIALOG.
    After the call fm GET_PRINT_PARAMETERS params internal table contains all the values for generating spool.
    aRs

  • I need to loop through 1 table and read another until a value changes

    i need to read a table and sum the quantity field until a reason code changes.  how do I go about doing this?

    sort itab by reasoncode.
    Loop at itab.
    quantiy = quanity  + itab-quantity.
    at end of reasoncode.
    jtab-reasoncode = itab-reasoncodee.
    jtab-sum = quantity.
    append jtab.
    clear quantity.
    endat
    endloop.
    or
    sort itab  by reasoncode.
    loop at itab.
    at end of reasoncode.
    sum.
    jtab = itab.
    append jtab.
    endat.
    endloop.
    or
    let us say itab and jtab are two tables and you want to loop through itab and read jtab for reasoncodes.
    if jtab has only one entry for each entry in itab then use read else use loop.
    loop at itab.
    loop at jtab where reasoncode = itab-reasoncode.
    quantiy = quantiy + jtab-quanity.
    endloop.
    endloop.
    or
    loop at itab.
    read table jtab with key reasoncode = itab-reasoncode.
    if sy-subrc eq 0.
    endif
    endloop.

  • Looping through hash table

    Hi All,
    I'm new to Powershell and recently wrote a script that used the system.directoryServices class to bind to Active directory and pull out a bunch of info I need. Problem is that once I have this stuff, I have it in a hash table and I can't seem to pull
    out just the pertinent info. As you can see from the pic below, I have a bunch of blank fields....and when I wrote a for to cycle through these and ignore the $null values...i just got back a bunch of system.collectionhashtable system.collectionhashtable system.collectionhashtable...over
    and over again. I was hoping someone could help me get out the values I need...do I need to convert this hash table into some other sort of object to work with it? I'm not to sure were I've gone wrong.
    This is what I started with to produce the below:
    $objDomain = new-object system.directoryServices.directoryEntry
    $strTopDomain = $objDomain.distinguishedName
    $strTopLDAP = "LDAP://OU=Something,OU=else,OU=other,$strTopDomain"
    $objTopOU = new-object system.directoryServices.directoryEntry("$strTopLDAP")
    $strTopOU = $objTopOU.distinguishedName
    $topFilter = "(&(computerlink=*)(iwstemplatelink=*))"
    $topObjSearcher = New-Object System.DirectoryServices.DirectorySearcher($topFilter)
    $topObjSearcher.searchRoot = $objTopOU
    $topObjSearcher.searchScope = "subtree"
    $topObjSearcher.propertiesToLoad.add("computerlink")
    $topObjSearcher.propertiesToLoad.add("iwstemplatelink")
    $topObjSearcher.propertiesToLoad.add("vpslocation")
    $objTopList = $topObjSearcher.findAll()| foreach-object { @{n='Name';e={$_.vpslocation}}, @{n='Value';e={$_.iwstemplatelink}}}
    Then I tried a while loop...something along these lines:
    $x = 0
    $y= $objTopList.count()
    while ($x -lt $y){
    if($objTopList -ne $null){
    write-host $objTopList[$x]
    x++
    But as I said above....I just got the Sytems.collections repeated over and over. Any help would be appreciated. Really not much of a scripting guy. Thanks

    Why are some people bent on being so annoying.
    Here is how to unwind the property wrappers on the searchresults collection of searchresult objects.
    $objDomain = new-object system.directoryServices.directoryEntry
    $strTopDomain = $objDomain.distinguishedName
    $strTopLDAP = "LDAP://OU=Something,OU=else,OU=other,$strTopDomain"
    $objTopOU = new-object system.directoryServices.directoryEntry("$strTopLDAP")
    $strTopOU = $objTopOU.distinguishedName
    $topFilter = "(&(computerlink=*)(iwstemplatelink=*))"
    $topObjSearcher = New-Object System.DirectoryServices.DirectorySearcher($topFilter)
    $topObjSearcher.searchRoot = $objTopOU
    $topObjSearcher.searchScope = "subtree"
    $topObjSearcher.propertiesToLoad.add("name")
    $topObjSearcher.propertiesToLoad.add("samaccountname")
    $topObjSearcher.propertiesToLoad.add("computerlink")
    $topObjSearcher.propertiesToLoad.add("iwstemplatelink")
    $topObjSearcher.propertiesToLoad.add("vpslocation")
    $objTopList = $topObjSearcher.findAll()|
    foreach-object {
    $p=@{
    Name=$_.Properties['name'][0]
    SamAccountName=$_.Properties['samaccountname'][0]
    VPSLocation=$_.Properties['vpslocation'][0]
    LWSTemplateLink=$_.Properties['iwstemplatelink'][0]
    New-Object PsObject -Property $p
    We must use the "Properties" collection as the properties loaded are NOT exposed on the object. THey are also all included as elements of a collection so we need to use the [0] to remove them.
    We can use select-object -expand properties to see the properties but the will all be wrapped and delivered as a collection of hashes.  See:
    PS C:\scripts> $s.FindAll()|select -expand properties
    Name Value
    ridsetreferences {CN=RID Set,CN=SBS01,OU=Domain Controllers,DC=TESTLNET,DC=local}
    logoncount {65535}
    codepage {0}
    objectcategory {CN=Computer,CN=Schema,CN=Configuration,DC=TESTLNET,DC=local}
    iscriticalsystemobject {True}
    operatingsystem {Windowsr Small Business Server 2011 Standard}
    localpolicyflags {0}
    Notice Name/Value pairs and the little squigglies: {}.  Not very useful until we unwrap them.
    This is one thing that always confuses the unwashed and unlevened of the computer trade.  It goes totally against everything they have come to believe.  Even I am surprised at how MS executed these bits. It is a big inconvenience until you
    program active directory in C or C#...then it all starts to make sense...sort of.
    ¯\_(ツ)_/¯

  • Sy-subrc = 8 when looping through a table...

    i am looping one table and reading other.
      now sy-subr = 8,it is showing what can be the reason.
    Thanks in advance.
    Edited by: Julius Bussche on Feb 24, 2009 10:50 AM
    Subject title improved

    Hi,
    If
    sy-subrc = 4 No lines were read.
    sy-subrc = 8 The search key was not fully qualified.
    So u can add the logic for sy-subrc = 8 or u can change the logic as
    if sy-subrc is initial.
    else.
    endif.
    Keerthi.

  • Looping through a table Help needed ....Forms 10g..... When Button Pressed

    Hye craig, hamid, christian and all ...........
    i have a user access interface which i create where there are two fields username and password and a button,
    i have also created a table USERS for users which have username and password fields ..... On useraccess interface i coded on WHEN BUTTON PRESSED like this
    declare
    go_block('users');
    execute_query;
    declare
    begin
         if :useraccess.username=:users.username and
              :useraccess.password=:users.password then
              go_block('MAINPAGE');
              else
              go_block('USERACCESS');
              MESSAGE('SORRY WRONG PASSWORD OR NOT A REGISTERED USER');
              MESSAGE('SORRY WRONG PASSWORD OR NOT A REGISTERED USER');
              end if;
    end;
    This code works for a single user in USERS table but for multiple users there has to be some looping system
    which matches the USERACCESS and USERS tables fields thoroughly ....

    Hi Majid,
    I can suggest you a workaround for this. raise a ON-LOGON trigger and you can use the LOGON_SCREEN builtin to flash the logon screen at runtime. And then try capturing the username and password.
    DECLARE
      connected BOOLEAN := FALSE;
      tries     NUMBER  := 3;
      un        VARCHAR2(30);
      pw        VARCHAR2(30);
      cs        VARCHAR2(30);
    BEGIN
      SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'DEFAULT');
      WHILE connected = FALSE and tries > 0
      LOOP
        LOGON_SCREEN;
        un := GET_APPLICATION_PROPERTY( USERNAME );
        pw := GET_APPLICATION_PROPERTY( PASSWORD );
        cs := GET_APPLICATION_PROPERTY( CONNECT_STRING );
        LOGON( un, pw || '@' || cs, FALSE );
        IF FORM_SUCCESS
        THEN
          connected := TRUE ;
        END IF;
        tries := tries - 1;
      END LOOP;
      IF NOT CONNECTED THEN
        MESSAGE('Too many tries!');
        RAISE FORM_TRIGGER_FAILURE ;
      END IF;
    END ;   a sample piece of coding to help you out.
    Regards,
    Manoj Chakravarthy

  • Loop through tables based on data dict values

    Hi,
    I working on an old v7.3.4 database that I'm not familiar with and I want to loop through the tables and count the occurrence of a field value based on table names i've retrieved from the data dictionary. None of the tables have relational keys defined.
    In a cursor I can loop thru all_tab_columns and load variables with the table, column names, and the datatype, but then I want to use these values in a second nested cursor to loop through each table found by the first cursor.
    When I do :
    Select var_colname from var_tabname
    i get
    The following error has occurred:
    ORA-06550: line 23, column 10:
    PLS-00356: 'V_TABNAME' must name a table to which the user has access
    ORA-06550: line 22, column 5:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 22, column 12:
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    ORA-06550: line 27, column 7:
    PL/SQL: SQL Statement ignored
    so it would seem I can't use a variable to substitute the table name in the 'from' clause. Does anyone know of a way round this ?
    Thanks in advance

    Hi,
    You will have to use dynamic sql to create your second cursor.
    DECLARE
         v_sql_query VARCHAR2(400);
         TYPE cur_typ IS REF CURSOR;
         c1 cur_typ;
         mYRec MyTable%rowtype;
    BEGIN
         v_sql_query := 'select * from MyTable';
         OPEN c1 FOR v_sql_query;
              LOOP
              FETCH c1 INTO mYRec;
                   EXIT WHEN c1%NOTFOUND;
                   EXIT WHEN c1%NOTFOUND IS NULL;
    /*processing here*/
              END LOOP;
         CLOSE c1;
    END;
    Regards

  • Loop through table's rows

    Hi folks,
    I have a table with multiple rows which each one of them contains one dropdown list.
    In my code I want to loop through this table rows and check each dropdown list's selected-item.
    How can I do this in code(JavaScript).
    Thank you,
    Yair

    Check this thread,
    it has solutions for JavaScript ind FormCalc.
    http://forums.adobe.com/message/3345384#3345384

  • Loop through table(table is created dynamically)

    Hi all,
    I have a table that is created dynamically.It has got 3 columns and 8 rows.In first row - first column,I have a value that is set dynamically.Now, How can I loop through this table and get this value?
    The table context node and value attributes are also created dynamically.
    Table node is "TimesheetData" and value attribute is col1.Value,col1.Value and col3.Value
    TimesheetData
    col1.Value
    col2.Value
    col3.Value
    Again.... this node and attributes are not there in my view context by default, its getting created and binded dynamically here.
    Thanks Kukku

    Hi,
    Following is the code to iterate through the elements
    //Table node is "TimesheetData" and value attribute is col1.Value,col1.Value and col3.Value
    for(int x=0;x<wdContext.getChildNode("TimesheetData",0).size(); x++)
                IWDNodeElement nodeElement = wdContext.nodeTimesheetData().getElementAt(x);
                String value1 = (String) nodeElement.getAttributeValue("col1");
                String value2 = (String) nodeElement.getAttributeValue("col2");
                String value3 = (String) nodeElement.getAttributeValue("col3");
    Regards
    Ayyapparaj

  • Loop through table in XI

    Hi Guys,
    I have scenario where i call a BAPI and get return parameter as a table. I want to loop through this table in XI/BPM. Can i get some help on how to loop thorugh table in XI?

    Hi yashpal,
    Bloack Step in a BPM is used to process a sequence of steps repeatedly  for different information.
    The block step can be processed using FOR EACH and PAR FOR EACH. For each will process the info one after the other and PAR FOR EACH will do it in parallel.
    For more info on the Block Step Type in particular and the BPM in XI , check these links,
    http://help.sap.com/saphelp_nw04/helpdata/en/f6/e1283f2bbad036e10000000a114084/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/62/dcef46dae42142911c8f14ca7a7c39/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/3c/831620a4f1044dba38b370f77835cc/content.htm
    Hope this helps,
    Regards,
    Bhavesh

  • Question about Looping through tables in Adobe Form

    Hello,
    We have an adobe form which is to be filled offline. It consists of a table. Table can have repeating rows and user can add\remove rows as they wish.  The cardinality of the context node where we need to bind this table data is set to 1…n
    We want to know the process to get all the values in the table back into our context node once the form is uploaded. I assume we need to loop through the table, and add elements to the context node.  Can someone please let us know if we’re on the right track, and provide some sample code if possible?
    <b>We can’t figure out a way to loop through a table inside an Adobe form.</b>
    We are using Web Dynpro Java with Adobe Livecycle Designer 7.1
    Your help is much appreciated.
    Thanks,
    Rob.

    Try using...
    for (z = 0; z < 16; z++) {
         this["cb"+z].setStyle("styleName", "cssCBstyle");
    That is the way to target them.  I haven't dealt with setting styles, so I can't answer for that aspect working or not.

  • Nested Loops...looping through one month of data at a time year by year

    Hi all,
    I'm trying to create an insert statement that loops through a table that has 10 years of data (2001 to 2010) month by month to minimize impact on server and commits more frequently to avoid filling up the redo logs and rollback tablespaces. The table is large, has about 40 millions records per year. Lets say the structure of the table is the following:
    Customer_ID number(9),
    Order_Item_1 number(6),
    Order_Item_2 number(6),
    Order_Item_3 number(6),
    Order_date date
    The table is in flat format but I want to normalize it so that it looks like the following:
    Customer_ID Order_Seq Order_Item Order_date
    999999999 1 555555 01-jan-2001
    999999999 2 666666 01-jan-2001
    999999999 3 444444 01-jan-2001
    888888888 1 555555 03-jan-2001
    888888888 2 666666 03-jan-2001
    But because I want to loop through month by month....I need to set it up so that it loops through month by month, year by year (Using the Order Date Field) and Order_item by Order_item. Something like:
    so my insert statements would be something like if I hardcoded instead of put the insert statement into a loop:
    insert into orders_normalized
    (Customer_id,Order_seq,Order_item,Order_date) select customer_id,1,Order_item,Order_date where Order_item_1 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='01';
    insert into orders_normalized
    (Customer_id,Order_seq,Order_item,Order_date) select customer_id,2,Order_item,Order_date where Order_item_2 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='01';
    insert into orders_normalized
    (Customer_id,Order_seq,Order_item,Order_date) select customer_id,3,Order_item,Order_date where Order_item_3 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='01';
    insert into orders_normalized
    (Customer_id,Order_seq,Order_item,Order_date) select customer_id,1,Order_item,Order_date where Order_item_1 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='02';
    insert into orders_normalized
    (Customer_id,Order_seq,Order_item,Order_date) select customer_id,2,Order_item,Order_date where Order_item_2 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='02';
    insert into orders_normalized
    (Customer_id,Order_seq,Order_item,Order_date) select customer_id,3,Order_item,Order_date where Order_item_3 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='03';
    Hope this makes sense.
    Thanks

    Does the sequence of items in an order really matter? In other words, do we really need to preserve that an item was in position 2 versus position 1? I bet that the sequence or position of each item in an order is not meaningful. They were probably numbered 1, 2, and 3 just to make them uniquely named columns so there would be three slots to hold up to 3 items in the denormalized table.
    You only have about 400 million rows to insert, so it could feasibly be done in a single transaction (depending on your database environment).
    You can always do a create table as select (CTAS) to help with undo / redo issues and get better performance. You could run it in parallel, and spit it out to a new table partitioned by month. Single DDL statement running in parallel making your new table--sounds good to me.
    How about something like this:
    CREATE TABLE ORDERS_NORMALIZED
    (CUSTOMER_ID, ORDER_ITEM, ORDER_DATE)
    PARTITION BY RANGE(ORDER_DATE)
    PARTITION p200901 VALUES LESS THAN (TO_DATE('200902','YYYYMM')),
    PARTITION p200902 VALUES LESS THAN (TO_DATE('200903','YYYYMM')),
    PARTITION p201012 VALUES LESS THAN (TO_DATE('201101','YYYYMM'))
    as SELECT CUSTOMER_ID, ORDER_ITEM_1, ORDER_DATE
       FROM OTHER_TABLE
       WHERE ORDER_ITEM_1 IS NOT NULL
       UNION ALL
       SELECT CUSTOMER_ID, ORDER_ITEM_2, ORDER_DATE
       FROM OTHER_TABLE
       WHERE ORDER_ITEM_2 IS NOT NULL
       UNION ALL
       SELECT CUSTOMER_ID, ORDER_ITEM_3, ORDER_DATE
       FROM OTHER_TABLE
       WHERE ORDER_ITEM_3 IS NOT NULL.....................
    Out of curiosity, why not normalize it further? You could have used two tables instead of one.
    One (ORDER) with:
    ORDER_ID
    CUSTOMER_ID
    DATE
    Order_id would be a new surrogate key / primary key.
    Another table (ORDER_ITEM) with:
    ORDER_ID
    ORDER_ITEM
    It would be a table that links ORDERS to ITEMS. You get the idea.

  • Declaring a message in abap and looping at a table

    Greetings all
    I would like to display an error message once some sort of validation is done. The code for my method is as follows:
    method if_ex_hrbas00infty~before_output.
    *Data declaration
    data: lt_hrp1001 type table of hrp1001,
    lv_sobid type sobid,
    lv_sclas type sclas,
    lv_rsign type rsign,
    lv_relat type relat,
    lv_otjid type otjid.
    Clear the local table and local variables
    refresh lt_hrp1001.
    clear: lv_sobid, lv_sclas, lv_rsign, lv_relat, lv_otjid.
    *Store the separated strings
    lv_sclas = old_innnn-vdata+0(2).
    lv_sobid = old_innnn-vdata+2(10).
    lv_rsign = old_innnn-subty+0(1).
    lv_relat = old_innnn-subty+1(3).
    lv_otjid = old_innnn-otype.
    *Check for existing relationships with other external objects
    select * from hrp1001 into table lt_hrp1001
    where plvar = old_innnn-plvar
    and sobid = lv_sobid
    and sclas = lv_sclas
    and rsign = lv_rsign
    and relat = lv_relat
    and otjid = lv_otjid.
    *Loop through the table and compare the existing relationship with the new one
    loop at lt_hrp1001 where.
    old_innnn-sobid = hrp1001-sobid.
    old_innnn-sclas = hrp1001-sclas.
    old_innnn-rsign = hrp1001-rsign.
    old_innnn-relat = hrp1001-relat.
    old_innnn-otjid = hrp1001-otjid.
    If statement to compare the start and end dates
    if lt_hrp1001-begda > old_innnn-endda
    or old_innnn-endda < lt_hrp1001-begda
    *Issue a warning informing the user about the overlap
    message 'ZEXERCISE' type 'E' number '000'.
    endif
    endloop.
    break lmandimika.
    endmethod.
    Ive created my message class which is ZEXERCISE but i have to declare the message somewhere using MESSAGE-ID ZEXERCISE. The only problem is that i cant declare it within this method. Any help as to where i can declare it.
    In addition to that, my loop at doesnt work because it tells me LOOP AT itab one of the additions INTO, ASSIGNING or TRANSPORTING NO FIELDS is required. I want to loop through the local table lt_hrp1001 and compare old_innn with all the entries in the table.
    Any help would be greatly appreciated.

    1. create a workarea like
    *Data declaration
    data: lt_hrp1001 type table of hrp1001,
            wa_hrp1001 type hrp1001 .
    in ur code                *Loop through the table and compare the existing relationship with the new one
    loop at lt_hrp1001 where.
    old_innnn-sobid = hrp1001-sobid.
    old_innnn-sclas = hrp1001-sclas.
    old_innnn-rsign = hrp1001-rsign.
    old_innnn-relat = hrp1001-relat.
    old_innnn-otjid = hrp1001-otjid.
    here u r checking this only for one time ,
    better u write like
    loop at lt_hrp1001 into wa_hrp1001 .
    *now check the condition .
    if                 old_innnn-sobid = wa_hrp1001-sobid     AND
                      old_innnn-sclas = wa_hrp1001-sclas        AND
                      old_innnn-rsign = wa_hrp1001-rsign         AND
                      old_innnn-relat = wa_hrp1001-relat          AND
                     old_innnn-otjid = wa_hrp1001-otjid       .
    *another  If statement to compare the start and end dates
    if lt_hrp1001-begda > old_innnn-endda
    or old_innnn-endda < lt_hrp1001-begda
         here give a message like
    message i001(ZEXERCISE).          " No need of defining message class in report
    endif.
    ENDIF.
    clear wa_hrp1001.
    endloop.
    2 . here we have to compulosry use a workarea , while making use of loop - Endloop .
    3 . You had not specified wether  "  old_innnn  "  is a table or just fields defined separately .
    Thanks ,
    reward poins if helpful.

Maybe you are looking for