Doubts in internal table logic

Hi All,
I have two internal table, according to the posnr value i need to add the kbetr value from the 2nd internal table and update the value in the 1st line internal table. below the example of my internal table. Here for the line item 0010 i need to calculate 10.0030.1011.00 and i need to add the value inthe 1st internal table kbeter_value. can anyone help this?
POSNR        MATNR kbetr_value
0010             abc
0020             xyz
0030             123
POSNR     KBETR
0010       10.00
0010        30.10
0010       11.00
0010       60.30
0020       12.64
0020       11.32
0030       79.46
0030       00.00
0030       45.3     
by
Mohana

Hi Mohana,
Its very simple ..you can do it in many ways....
first one is in the second internal table use collect ....
for example : 1st internal table is itab and the second is jtab .
1. In jtab u use collect stmt to calculate the posnr values .
loop at jtab.
  collect jtab .           " by using this u will have  0010    111.40 in jtab
endloop.
structure of jtab will be :
0010    111.40
0020    .........
0030    ..........
2. afterwards while printing you can use read to get those :
loop at itab.
read table jtab with key posnr = itab-posnr.
if sy-subrc = 0.
itab-ksbtr-value = itab-value .
modify itab .
endif.
endloop.
Hope you got it by now...if you any problem do reply back ....
cheers,
Vishnu .

Similar Messages

  • Internal table logic issue

    Hi All,
    I have one logical issue related to internal table manipulation.
    I have one internal table :
    I_DAT - This is related to Loading/Unloading of Goods.
    for example with 3 fields
    VSTEL, KUNNA, KMMANG.
    Now suppose my data looks like this after sorting:
    VSTEL   KUNNA    KMMANG
    100       -        -
    200       -        -
    300       -        -
    400       -        -
    -         500      X
    -         600      X
    -         700      X
    -         800      X
    Here 100,200,300,400 are Loading points.
    ANd 500,600,700,800 are unloading points.
    Now what i want is For loading & Unloading points i need to pick up Address and print one after other.
    But how they need to print is:
    FOR INITIAL LOADING OF
    ADDRESS- For 100
    FIRST STOP: FOR LOADING OF
    ADDRESS- For 200
    SECOND STOP: FOR LOADING OF
    ADDRESS- For 300
    Etc .....
    Then
    FOR UNLOADING OF:
    ADDRESS- For 400
    FIRST STOP: FOR UNLOADING OF
    etc.
    FINAL STOP: FOR FINAL UNLOADING OF
    We might get as many records :
    Can any body give me the logic:
    Printing Address is not a problem:
    But Above every address we need to print FIRST STOP, SECOND etc like that.
    For this i need logic.
    Can anybody give the solution!
    Thanks in advance.
    Thanks & Regards,
    Prasad.

    Try this.I think you want output like this......
    DATA: BEGIN OF LINE,
            CARRID   TYPE SBOOK-CARRID,
            CONNID   TYPE SBOOK-CONNID,
            FLDATE   TYPE SBOOK-FLDATE,
            CUSTTYPE TYPE SBOOK-CUSTTYPE,
            CLASS    TYPE SBOOK-CLASS,
            BOOKID   TYPE SBOOK-BOOKID,
          END OF LINE.
    DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY TABLE LINE.
    SELECT CARRID CONNID FLDATE CUSTTYPE CLASS BOOKID
           FROM SBOOK INTO CORRESPONDING FIELDS OF TABLE ITAB.
    LOOP AT ITAB INTO LINE.
      AT FIRST.
        WRITE / 'List of Bookings'.
        ULINE.
      ENDAT.
        AT NEW CARRID.
          WRITE: / 'Carrid:', LINE-CARRID.
        ENDAT.
          AT NEW CONNID.
            WRITE: / 'Connid:', LINE-CONNID.
          ENDAT.
            AT NEW FLDATE.
              WRITE: / 'Fldate:', LINE-FLDATE.
            ENDAT.
              AT NEW CUSTTYPE.
                WRITE: / 'Custtype:', LINE-CUSTTYPE.
              ENDAT.
                   WRITE: / LINE-BOOKID, LINE-CLASS.
                AT END OF CLASS.
                  ULINE.
                ENDAT.
    ENDLOOP.
    This is also helpful......
    LOOP AT <itab>.
      AT FIRST. ... ENDAT.
        AT NEW <f1>. ...... ENDAT.
          AT NEW <f2 >. ...... ENDAT.
              <single line processing>
          AT END OF <f2>. ... ENDAT.
        AT END OF <f1>. ... ENDAT.
      AT LAST. .... ENDAT.
    ENDLOOP.
    Regards
    Abhishek

  • Reg. internal table logic

    Hi,
    I have an internal table with 5 fields (Vbeln, A, B, C, D ) and records like this:
    Record1:
    Field vbeln (value is  6000000001), Field A (value is 2006), Field B (value is 1130), Field C (value is initial), Field D (value is initial)
    Record1:
    Field vbeln (value is  6000000001), Field A (value is initial), Field B (value is initial), Field C (value is 2005), Field D (value is 1134)
    Now whenever, Field A and Field B has values, field C and field D are initial and vice versa.
    I Want to get all of the field values in just one record like below when the key vbeln is same.:
    Field vbeln (value is  6000000001), Field A (value is 2006), Field B (value is 1130), Field C (value is 2005), Field D (value is 1134)
    I know I can create another internal table, copy the contents, use the looping logic and achieve the same but wondering if there is any better way of doing the same?
    Appreciate your input.
    Thanks!

    Hi,
    You need another internal tables. Please try this.
    SORT ITAB1.
    ITAB2[] = ITAB1[].
    LOOP AT ITAB1.
      LOOP AT ITAB2 WHERE ITAB2-VBELN EQ ITAB1-VBELN
                      AND ITAB2-DATE1 NE ITAB1-DATE1
                      AND ITAB2-TIME1 NE ITAB1-TIME1.
        ITAB3-VBELN = ITAB1-VBELN.
        ITAB3-DATE1 = ITAB1-DATE1.
        ITAB3-TIME1 = ITAB1-TIME1.
        ITAB3-DATE2 = ITAB2-DATE2.
        ITAB3-TIME2 = ITAB2-TIME2.
        APPEND ITAB3.
      ENDLOOP.
    ENDLOOP.
    Regards,
    Ferry Lianto

  • Regarding Internal table logic

    Hi,
    I have my internal table as follows:
    DATA: BEGIN OF I_DATA OCCURS 0,
            prgname TYPE SYST-REPID,
            matnr   TYPE mara-matnr,
            berid   TYPE mdma-berid,
          END OF I_DATA.
    Data that fills into can be as follows:
    Ex:
    PROGRAM1,1000,MRP1
    PROGRAM1,1000,MRP1
    PROGRAM1,2000,MRP1
    PROGRAM2,1000,MRP1
    PROGRAM2,1000,MRP1
    PROGRAM2,2000,MRP1
    PROGRAM3,1000,MRP1
    PROGRAM3,1000,MRP1
    PROGRAM3,2000,MRP1
    It can any order in above way.
    Then i will sort the above data as follows:
    SORT I_DATA BY prgname matnr berid.
    Now here my issue is:
    DATA: t_objtxt     LIKE solisti1   OCCURS 0  WITH HEADER LINE.
    I need to push the above internal table data into T_OBJTXT internal table as follows:
    It should first Display program Name as Program Name: Program3, Then column heading MATNR, BERID below it and data of that program[1st] below them till all the 1st program's data finished. Whenever MATNR value changes in this program list i need to print an ***** like line. TO indicate all the materials printed.
    When 2nd program comes again i have to write Program Name: Program2, Then column heading MATNR, BERID below it and data of that program[1st] below them till all the 1st program's data finished. Whenever MATNR value changes in this program list i need to print an ***** like line. TO indicate all the materials printed.
    When 3nd program comes again i have to write Program Name: Program3, Then column heading MATNR, BERID below it and data of that program[1st] below them till all the 1st program's data finished. Whenever MATNR value changes in this program list i need to print an ***** like line. TO indicate all the materials printed.
    Etc. Same process we need to follow.
    The final out put should be as below:
    PROGRAM NAME : PROGRAM1
    MATNR, BERID
    1000,MRP!
    1000,MRP1
    2000,MRP1
    PROGRAM NAME : PROGRAM2
    MATNR, BERID
    1000,MRP!
    1000,MRP1
    2000,MRP1
    PROGRAM NAME : PROGRAM3
    MATNR, BERID
    1000,MRP!
    1000,MRP1
    2000,MRP1
    Like wise o/p need to be send to I_OBJTXT and to email.
    <b>The logic i have written is as follows:</b>
      LOOP AT I__DATA.
        AT NEW PRGNAME.
          MOVE '*****************************************' TO t_objtxt-line.
          APPEND t_objtxt.
          CLEAR t_objtxt.
          CONCATENATE t_objtxt-line 'PROGRAM NAME : '
                      I_DATA-PRGNAME
                      INTO t_objtxt-line.
          APPEND t_objtxt.
          CLEAR t_objtxt.
          MOVE '*****************************************' TO t_objtxt-line.
          APPEND t_objtxt.
          CLEAR t_objtxt.
          CONCATENATE TEXT-024 " Material
                      TEXT-025              " MRP
                      INTO t_objtxt-line
                      SEPARATED BY C_COMMA.
          APPEND t_objtxt.
          CLEAR t_objtxt.
          MOVE '-----------------------------------------' TO t_objtxt-line.
          CONCATENATE t_objtxt-line '------------------' INTO t_objtxt-line.
          APPEND t_objtxt.
          CLEAR t_objtxt.
        ENDAT.
    *    MOVE '' TO t_objtxt-line.
    *    APPEND t_objtxt.
    *    CLEAR t_objtxt.
        CONCATENATE I_DATA-MATNR
                    I_DATA-BERID
                    INTO t_objtxt-line
                    SEPARATED BY C_COMMA.
        APPEND t_objtxt.
        CLEAR t_objtxt.
        AT END OF MATNR.
          MOVE '' TO t_objtxt-line.
          APPEND t_objtxt.
          CLEAR t_objtxt.
          MOVE '*****************************************' TO t_objtxt-line.
          CONCATENATE t_objtxt-line '******************' INTO t_objtxt-line.
          CONCATENATE t_objtxt-line '******************' INTO t_objtxt-line.
          APPEND t_objtxt.
          CLEAR t_objtxt.
        ENDAT.
      ENDLOOP.
    The above logic is not working correctly.
    Can anybody give me correct logic for the same.
    Thanks in advance.
    Thanks,
    Deep.

    Can you paste the total code.
    santhosh

  • Internal table logic required

    Hi ,
    I have two internal tables having with different structures . Finally I need to pass data to final internal table.
    In runtime we have data in only one table.  The final internal table should take either internal1, or internal table 2.
    it_final_data[] = it_first_data[].
    or
    it_final_data[] = it_sec_data[].
    i have to one generic include , it will understands the IT_final_data internal table only.
    please help me.
    regards,
    Ajay

    Hi Ajay,
         Build your final internal table with all the fields from first and second internal table. Use the below logic to move the data to the final internal table depending on the internal table data which you want to display.
    IF not it_first_data[] is initial.
      loop at it_first_data.
        move-corresponding it_frist_data to it_final_data.
        append it_final_data.
    endloop.
    else.
       loop at it_second_data.
        move-corresponding it_second_data to it_final_data.
        append it_final_data.
      endloop.
    endif.
    Hope this works for you.
    Regards,
    Jayaram

  • Internal Table Logic Needed

    Hi all,
    I have a requirement regarding data processing in a internal table,
    internal table consists of filelds Vendor,Material and Scheduling Dates and Total Qty.
    Here i need to fill the field Total Quantity, individual addition of quanties of that material for a particular vendor .
    Let us consider intitially my internal table consists of data like this with these fields.
                      Vendor ,           Material  ,            qty(individual),   Total qty   ,  Schedule dates
                       v1        ,           m1       ,                 10          
                       v1        ,           m1        ,                10
                       v1       ,             m1       ,                  20
                       v1       ,              m2      ,                    5
                       v1       ,             m2        ,                 10
                       v2        ,            m2         ,                20
                      v2        ,             m2        ,                  15
                      v2        ,            m3         ,                  20
                      v2        ,            m3           ,                10
        Initiall the total qty field is empty i need to fill tht field for the last item for a particular material Like M1
      for vendor v1 and total qty of m2 for vendor v1, total qty of m1 for v2, total qty of m2 for v2 and so on.
    Requied output should be like this.
                     Vendor     ,          Material       ,    qty(individual)            Total qty   Schedule dates
                      v1         ,                m1         ,         10           ,               0        
                       v1          ,              m1          ,        10           ,                 0
                       v1         ,                m1         ,         20          ,                40(101020)
                       v1        ,                 m2          ,         5           ,               0
                       v1          ,               m2           ,      10            ,              15(5+10)
                       v2          ,               m2          ,        20            ,             0    
                       v2          ,               m2           ,       15             ,              35(20+15)
                      v2           ,              m3          ,        20              ,             0
                      v2            ,              m3           ,       10              ,           30(20+10)
    Here i made one thing , i calculated the total qty of material for particular vendor.
    Like              
             Vendor                           Material                     Total Qty      
                     v1        ,                        m1            ,             40
                     v1        ,                       m2              ,            15
                     v2         ,                     m2                ,           35
                     v2          ,                    m3                 ,           30
    Finally i need the logic by using Control Events(At New   , At End of )  to adjust that total qty of a material for a particular vendor by Modifying the internal table.
    i hope my problem is clear , pls let me know if any clarifications needed. and
    code for the same .
    Thannks in advance,
    Niranjan.

    Hi,
    Solution is here.
    sort itab by vendor material.
    field-symbols: <itab> like line of itab.
    loop at itab assigning <itab>.
    on change of vendor.
    clear flag.
    endon.
    add <itab>-quanity to lw_quantiy.
    *--here pdate internal table end of each similar kind of record
    at end of.
    flag = 'x'.
    <itab>-totalqty =  lw_quantiy.
    clear  lw_quantiy
    endat.
    *--rest of record update zero by checking flag
    if flag is initial.
    <itab>-totalqty = 0.
    endif.
    endloop.
    close this thread if you got solution.
    Regards,
    Peranandam

  • Internal table -Logic-Data manipulation

    Hi,
    I have following requirement.
    Input Internal table
    *A T1   1   3
    *A T2   4   5
    *A T3   1   2
    *B T4   1   2
    *B T5   3   6
    *B T6   1   7
    Output
    *A T1   1     3
    *A T2   4     5
    *B T6   1     7
    basically i should delete overlapping records 
    eg: since A t3 1 2 is overlapping record it should be deleted.
    report x.
    DATA: BEGIN OF ITAB OCCURS 0,
          FLD1  TYPE CHAR20,
          FLD2  type char20,
          NUM1  TYPE I,
          NUM2  TYPE I,
          END   OF ITAB.
    ITAB-FLD1 = 'A'.
    ITAB-FLD2 = 'T1'.
    ITAB-NUM1 = '1'.
    ITAB-NUM2 = '3'.
    APPEND ITAB.
    ITAB-FLD1 = 'A'.
    ITAB-FLD2 = 'T2'.
    ITAB-NUM1 = '4'.
    ITAB-NUM2 = '5'.
    APPEND ITAB.
    ITAB-FLD1 = 'A'.
    ITAB-FLD2 = 'T3'.
    ITAB-NUM1 = '1'.
    ITAB-NUM2 = '2'.
    APPEND ITAB.
    ITAB-FLD1 = 'B'.
    ITAB-FLD2 = 'T4'.
    ITAB-NUM1 = '1'.
    ITAB-NUM2 = '2'.
    APPEND ITAB.
    ITAB-FLD1 = 'B'.
    ITAB-FLD2 = 'T5'.
    ITAB-NUM1 = '3'.
    ITAB-NUM2 = '6'.
    APPEND ITAB.
    ITAB-FLD1 = 'B'.
    ITAB-FLD2 = 'T6'.
    ITAB-NUM1 = '1'.
    ITAB-NUM2 = '7'.
    APPEND ITAB.
    LOOP At ITAB.
    ENDLOOP.

    Hi Praveen,
    You have to SORT the internal table ITAB by a field of your requirement. Then DELETE adjacent entries in the internal table by comparing the field of interest.
    SORT ITAB BY NUM1 NUM2.
    DELETE ADJACENT DUPLICATES FROM ITAB COMPARING NUM1 NUM2.
    After doing this you can perform the required actions on ITAB.
    Hope this has cleared your doubt.
    Thanks & Regards,
    Ramya Shree.M.R

  • Doubt In internal table using in GUI download

    Hi,
    how to get the field lable of all the fields in the internal table... when i download it to xls file... while downloading it i want to pass the field lable first and then its value.
    eg. in mara table .
    MATERIAL NO.
    p-101
    points will be rewarded for correct answer.

    hi,
    Actually i'm downloading the data from mara table to excel file i.e from mara -> internal table-> excel file.
    In this i'm gettng all the values in excel file but i don't kno what those values exactly ment for , so i want the fields lable to be passed first.
    But i don't kno how to get the field lables into the internal atble and then how to pass that value to the excel file.
    Thanks.
    Arunprasad.P

  • Doubt in internal table

    Hi,
    I have internal table with 5 records. I want to separate out the last record in the internal table.
    For ex : itab contains,
                 12,
                 10,
                 15,
                 09,
                 13 .  i need the last record '13' only. how to fetch the last record from the internal table, i no need the other records.
    point will be sure.
    Gowri

    Hi,
    try this simle code:
    DATA: BEGIN OF ITAB OCCURS 0,
            N2(2) TYPE N,
          END   OF ITAB.
    DATA: LINE_ITAB LIKE SY-TABIX.
    START-OF-SELECTION.
      ITAB-N2 = '12'. APPEND ITAB.
      ITAB-N2 = '10'. APPEND ITAB.
      ITAB-N2 = '15'. APPEND ITAB.
      ITAB-N2 = '09'. APPEND ITAB.
      ITAB-N2 = '13'. APPEND ITAB.
      CLEAR: ITAB.
      DESCRIBE TABLE ITAB LINES LINE_ITAB.
      READ TABLE ITAB INDEX LINE_ITAB.
      WRITE: / ITAB-N2.
    Regards, Dieter

  • Doubt in internal table record count

    Hi,
    i have an internal table with 5 fields. Last field is flag. In my internal table lot many records are there. i want to count only the records with flag 'E'. How to count the total records with 'E'.
    Mohana

    Try like this,
    Data: c type i.
    Loop at itab into wa.
    if wa-flag = 'E'.
    c = c + 1.
    endif.
    Endloop.
    Write:/ 'Total records', c.
    OR
    LOOP AT itab WHERE flag = 'E'.
      c = c + 1.
    ENDLOOP.
    Edited by: Sap Fan on Apr 3, 2009 5:21 PM

  • Doubt in internal table records

    Hi all,
       I have a one problem, in my internal table have 5 records. i did some correction in my progm after i execute the loop i need the correction in the records. In debug mode it showing in the header level. but it not changing the body records. give some soln.
    Thanks,
    gowri

    hi,
    chk the code below:
    loop at itab.
    modify itab index sy-tabix.
    endloop.
    regards,
    Navneeth K.

  • Doubt for internal table

    hi abap gurus,
      Consider u have 2 internal tables (one for Header Data, other one
          for Line Item)
       How to transfer the Header & its corresponding Item data
            to third Internal table
    thanks and regards,
    bala

    Hi Bala,
    DATA : BEGIN OF IT_LIKP OCCURS 0,  "1st internal table
           FIELD1,
           FIELD2,
           FIELD3, ETC....
           END OF IT_LIKP.
    DATA : BEGIN OF IT_VBPA OCCURS 0,  "2nd internal table
           FIELD1,
           FIELD2,
           FIELD3, ETC....
        END OF IT_VBPA.
    DATA : BEGIN OF IT_FINAL OCCURS 0, "3rd internal table
           FIELD1,
           FIELD2,
           FIELD3, ETC....
    END OF IT_FINAL.
    SELECT STATEMENTS ON FIRST 2 INTERANL TABLES AND THEN PASS THE DATA IN THE FINAL INTERNAL TABLE IE IT_FINAL.
    THEN WITH IT_FINAL TABLE DISPLAY THE DATA.
      LOOP AT IT_LIKP.
        IT_FINAL-VBELN = IT_LIKP-VBELN.
        IT_FINAL-WADAT_IST = IT_LIKP-WADAT_IST.
        IT_FINAL-KUNNR = IT_LIKP-KUNNR.
        IT_FINAL-NAME1 = IT_LIKP-NAME1.
        IT_FINAL-VBELN_S = IT_LIKP-VBELV.
        IT_FINAL-ERDAT = IT_LIKP-ERDAT.
        READ TABLE IT_VBPA WITH KEY VBELN = IT_LIKP-VBELV BINARY
        SEARCH.
        IF SY-SUBRC = 0.
          IT_FINAL-KUNN2 = IT_VBPA-KUNNR.
          IT_FINAL-NAME2  = IT_VBPA-NAME1.
        ENDIF.
        APPEND IT_FINAL.
        CLEAR IT_FINAL.
      ENDLOOP.
    Thanks
    Vikranth Khimavath

  • Question on internal table logic..

    Gurus,
    I have a internal table as follows:
    it_tab:
    ID---ACTION---CHANGE
    A1-----X--
    B2----
    U
    C1-----X--
    U
    C2-----X--
    Without looping at the table, how can I find get the result that the internal table has 3 ids with ACTION ='X'
    and 1 ID with ACTION  = X and Change = U.
    Regards,
    Rajesh.

    I agree with Rob, why not loop?
    First thing without loop that comes to mind is
    Using the Read statement 4 times with index 1,2,3 & 4.
    Regards,
    DNP

  • Process Internal table -Logic

    Hi,
    My internal table has following data
    A      10     30
    A      20     50
    A      00     100
    B      20     40
    B      10     90
    I need output as
        (Lowest)   (Highest)
    A   10               100
    B   10               90
    How do we do?
    rgds
    Praveen

    Namesh,
    Program does'nt work for  3  or more records. any ideas?
    <
    report x.
    DATA: BEGIN OF ITAB OCCURS 0,
          FLD1  TYPE CHAR20,
          NUM1  TYPE I,
          NUM2  TYPE I,
          END   OF ITAB.
    *A 10 30
    *A 20 50
    *A 00 100
    *B 20 40
    *B 10 90
    *C 0  40
    *C 10 120
    ITAB-FLD1 = 'A'.
    ITAB-NUM1 = '10'.
    ITAB-NUM2 = '30'.
    APPEND ITAB.
    ITAB-FLD1 = 'A'.
    ITAB-NUM1 = '20'.
    ITAB-NUM2 = '50'.
    APPEND ITAB.
    ITAB-FLD1 = 'A'.
    ITAB-NUM1 = '00'.
    ITAB-NUM2 = '100'.
    APPEND ITAB.
    ITAB-FLD1 = 'B'.
    ITAB-NUM1 = '20'.
    ITAB-NUM2 = '40'.
    APPEND ITAB.
    ITAB-FLD1 = 'B'.
    ITAB-NUM1 = '10'.
    ITAB-NUM2 = '90'.
    APPEND ITAB.
    itab-fld1 = 'C'.
    itab-num1 = '0'.
    itab-num2 = '40'.
    append itab.
    itab-fld1 = 'C'.
    itab-num1 = '10'.
    itab-num2 = '120'.
    append itab.
    DATA: ITAB2    LIKE ITAB OCCURS 0 WITH HEADER LINE,
          ITAB_TMP LIKE ITAB OCCURS 0 WITH HEADER LINE.
    DATA: NEW_FLD TYPE C.
    LOOP AT ITAB.
      AT NEW FLD1.
        NEW_FLD = 'X'.
      ENDAT.
      IF NEW_FLD = 'X'.
        ITAB_TMP[] = ITAB[].
        DELETE ITAB_TMP WHERE FLD1 = ITAB-FLD1.
        CLEAR NEW_FLD.
        SORT ITAB_TMP BY FLD1 ASCENDING
                         NUM1 ASCENDING.
        READ TABLE ITAB_TMP INDEX 1.
        ITAB2-FLD1 = ITAB_TMP-FLD1.
        ITAB2-NUM1 = ITAB_TMP-NUM1.
        SORT ITAB_TMP BY FLD1 ASCENDING
                         NUM2 DESCENDING.
        READ TABLE ITAB_TMP INDEX 1.
        ITAB2-NUM2 = ITAB_TMP-NUM2.
        APPEND ITAB2.
      ENDIF.
    ENDLOOP.
    LOOP AT ITAB2.
      WRITE: / ITAB2-FLD1,
               ITAB2-NUM1,
               ITAB2-NUM2.
    ENDLOOP. >

  • Internal table logic

    Hi,
    I have a scenario that I am trying to work on:
    I have three internal tables itab1 itab2 and itab3, all three internal tables have same fields in them but might be different values:
    All the internal tables have three rows of data and in each row there are five fields VAL1 VAL2 VAL3 VAL4 VAL5.The requirement is I need to compare all these three tables as below:
    Compare all the fields of itab1 with itab2, if they are same then skip and if not then compare each field of itab1 to itab3, if they are same then skip and if not replace the value of itab1 field (which is different with the one on itab3)with the itab3 field value.
    can you please help me with this?
    Moderator message : Requirements dumping not allowed, show the work you have already done.  Thread locked.
    Edited by: Vinod Kumar on Mar 9, 2012 7:37 PM

    Hi Vijay,
    I started writing the code as below:
    loop at itab1 into wa_itab1.
      READ TABLE itab2 INDEX sy-index into waA_itab2.
      READ TABLE itab3 INDEX sy-index into wa_itab3.
    if wa_itab1-val1 = wa_itab2-val1.
    skip.
    else.
    if_wa_tab1-val1 = wa_itab3-val1.
    skip.
    else.
    wa_tab1-val1 = wa_itab3-val1.
    endif.
    endif.
    if wa_itab2-val1 = wa_itab2-val2.
    skip.
    else.
    if_wa_tab2-val1 = wa_itab3-val2.
    skip.
    else.
    wa_tab1-val2 = wa_itab3-val2.
    endif.
    endif.
    if wa_itab1-val3 = wa_itab2-val3.
    skip.
    else.
    if_wa_tab1-val3 = wa_itab3-val3.
    skip.
    else.
    wa_tab1-val3 = wa_itab3-val3.
    endif.
    endif.
    if wa_itab1-val4 = wa_itab2-val4.
    skip.
    else.
    if_wa_tab1-va4l = wa_itab3-val4.
    skip.
    else.
    wa_tab1-val4 = wa_itab3-val4.
    endif.
    endif.
    ENDLOOP.
    but I am not sure if whatever I have written is correct.

Maybe you are looking for

  • Query linking Check Register with AP invoice

    Hi, was someone be able to create a query where it shows the Check No, Check Date, Vendor Name and alos the AP invoice being paid with the Expense Account being hit on the AP incoice. Thanks

  • Please help me recover a lost PDF file from Adobe Reader XI

    Hi, I was filling out a VA form 5655 in Adobe, and twice today, I lost my file and I just cannot type all of this stuff again, because I had to do so much math and typing and more math.  All of a sudden "bloop", it was gone.  When I try to go into fi

  • How to print a content of a window

    I'm totatlly new to handling printer in java. can any one give me a hand to do this. what i want to do is i have a generated html report inside a JTextPane. i want to print this to take a rough copy of it. the text pane is inside a JInternalFrame and

  • Master data Issue  ---   materials have unassigned or # values ...!!

    Hello Experts, I am facing an issue that the Customer Data is missing in a BEx Report. Data Flow is   2LIS_13_VDITM  --> DSO1 --> Merging DSO -->  Cube --> Multiprovider --> Bex Report. Exact issue is Customers in the Bex Report  has unassigned to Sa

  • Problem sending .pdf with email in ECC 6.0

    hi there, we are upgrading from r/3 4.6.c to ECC 6.0. i have the following problem: in many z-ababs we convert spool-files to pdf-files and send them with function SO_NEW_DOCUMENT_ATT_SEND_API1 via email. well, this is working okay, BUT: the ending '