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

Similar Messages

  • Internal table Logic need

    Hi ,
    I have one Internal table it_marc contains the MATNR
    and one more final internal table it_final. I want to read the all MATNR from IT_FINAL by using IT_MARC which contains the same MATNR. I mean all the MATNRs even dupliacates also.
    regards,
    Ajay

    Hi,
    Use For all entries.
    Select matnr from it_marc
                        into corresponding fields of  table it_final
                        for all entries in it_marc[]
                        where matnr = it_marc[]-matnr.
    Please give me ur need exactly, so that we can better understand ur que.
    Reward if Helpful.
    Jagadish.

  • 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

  • Search in Internal Table Utility -- Need Pointers

    Hi Experts,
    As per my requirement i need to search for words in internal table and arrange internal table based on ranking i.e record which has maximum no. of hits should come first.
    Example: search for a string 'media rent'.
    Incoming internal table records.
    row1------>   col1: rent                    col::xyz 
    row2 -
    >   col1:media rent          col2:media
    row3 -
    >  col1: rent                     col2:media  media
    I need to compare each word in col1 and col2 and arrange the rows based on ranking like this:
    final internal table
    row2 because it has maximum no. of search term
    row3
    row1
    I found out 2 ways to do the above but facing some issues and need your suggestions:
    Solution 1:
    By using regualr expression i am searching as OR expression on itab.
    and using FIND ALL OCCURRENCES OF REGEX command on each column of internal table
    Issue: when row3 is scanned for 'media rent' it will give 3 counts i which will lead to move row3  on top in final table due to maximum no of counts.
    Is there a way to neglect 2nd occurence in the word ? I cn't use find first occurence here.
    Solution 2:
    Split search sting 'media rent' into internal table
    itab1
    media
    rent
    and search for each word in each row of internal table and make use of counter something like this.i am unable to proceed further here
    I am stucked with what kind of logic should be here ?
    Looking for your suggestions here.

    Hi fried,
    Try the code below it works fine.
    TYPES : BEGIN OF ty_text,
            text1 type char11,
            text2 TYPE char11,
            count TYPE i,
            END OF ty_text.
    data : t_text TYPE TABLE OF ty_text,
           x_text TYPE ty_text.
    DATA : v_count TYPE i.
    x_text-text1 = 'rent'.
    x_text-text2 = 'xyz'.
    append x_text to t_text.
    x_text-text1 = 'media'.
    x_text-text2 = 'media'.
    append x_text to t_text.
    x_text-text1 = 'rent'.
    x_text-text2 = 'media media'.
    append x_text to t_text.
    loop at t_text INTO x_text.
    if x_text-text1 eq 'media' or x_text-text1 eq 'rent'.
      v_count = v_count + 1.
    endif.
    if x_text-text2 eq 'media' or x_text-text2 eq 'rent'.
      v_count = v_count + 1.
    endif.
    x_text-count = v_count.
    MODIFY t_text INDEX sy-tabix FROM x_text.
    clear v_count.
    ENDLOOP.
    SORT t_text DESCENDING by count.
    If you face any issues please revert back to me i will help you.
    Thanks,
    Sri Hari

  • 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

  • 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 .

  • 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.

  • 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

  • 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

  • Internal Table - logic for Chunk

    Hi,
    I have an internal table with n records.
    I want to use at a time say max of 20 records .
    This is calling a BDC.
    i.e.
    loop at n record.
    take 20 records.
    call BDC.
    then next set of recrds.
    repeat process till all records processed.
    Thanks in Advance.
    Amit

    Hi,
    try this way.
    data: count type i.
    loop at table
      if count LE 20.
        add 1 to count.
      else.
        clear count.
        call bdc.
        "refresh all the concerned tables and variables for the next 20 records.
      endif.
    endloop.
    Or.
    loop ...
    WHILE count le 20.  
       ADD 1 TO count.
    ENDWHILE.                   
        clear count.
        call bdc.
        "refresh all the concerned tables and variables for the next 20 records.
    endloop
    Regards.
    Marcelo Ramos

  • Internal table logic - help required

    Hi,
    I am working on BSEG table to determine offsetting line count and amount total for a posting line item and need
    a small logic .
    I have a table of currency fields like below and the table is such ( like BSEG ) that each line item will balance
    itself with other line item . For example
    Item
    10      100
    20      100-
    30      200
    40      250
    50      450-
    60      200-
    70      200
    80      600
    90      100
    100     200
    110     300
    If you see 10 & 20 balance out similarly ( 30,40 will balance with line item 50 ) , ( 60 & 70 balance each other ) ,
    ( 90,100, 110 balance with 80 ).
    My requirement - If I loop on item 50 with amount 450- I need to get the posnr of the two items which balance
    this amount ( which is 30 and 40 ).  If I loop on item 80 with amount 600 then I need to get item 90. 100 and 110.
    Please provide me a logic which will provide me the index of ther required item lines.
    Regards
    Praneeth

    Hi, execute this code.. might be helpful to you
    TYPES: BEGIN OF test,
             a TYPE i,
             b TYPE i,
           END OF test.
    DATA: itab TYPE TABLE OF test,
           wa  TYPE test,
           wa1 TYPE test,
           c   TYPE i,
           d   TYPE i,
           n1  TYPE i,
           n2  TYPE i.
    PARAMETERS :  p TYPE i.
    wa-a = 1.
    wa-b = 20.
    APPEND wa TO itab.
    wa-a = 2.
    wa-b = 30.
    APPEND wa TO itab.
    wa-a = 3.
    wa-b = 10.
    APPEND wa TO itab.
    wa-a = 4.
    wa-b = 10.
    APPEND wa TO itab.
    wa-a = 5.
    wa-b = 20.
    APPEND wa TO itab.
    READ TABLE itab INTO wa WITH KEY a = p.
    c = wa-b.
    LOOP AT itab INTO wa WHERE a GT p.
       n1 = wa-a.
       IF c EQ wa-b.
         EXIT.
       ENDIF.
       LOOP AT itab INTO wa1 WHERE a GT wa-a.
         IF wa-a = wa1-a.
           EXIT.
         ENDIF.
         n2 = wa1-a.
         d  = wa-b + wa1-b.
         IF c EQ d.
           EXIT.
         ENDIF.
       ENDLOOP.
       IF wa-a = wa1-a.
         EXIT.
       ELSEIF c EQ d.
         EXIT.
       ELSE.
         CLEAR: n1, n2.
       ENDIF.
    ENDLOOP.
    WRITE: n1 , n2.

  • Need to update Ztable from final internal table

    Hi,
    ITAB   = Final internal table has 9 fields : 1 2 3 4 5 6 7 8 9
    Ztable = Ztable has 6 fields ex : 1 3 4 6 7 8
    Structure of both Itab and Ztable are different.
    I have data in the Final Internal table and needs to update data into a ztable.
    If condition is true...
      Modify ztable from itab
    endif.
    Any suggestions how I can update Ztable from the INternal table
    Regards,
    Kittu

    Hello,
    First keep the loop to the final internal table then move all the records to the work area after moving to workarea then create another workarea for the Ztable then move only the field values which are there in Ztable then use modify keyword.
    example
    move:
    y_wa_final_itab-kdauf to y_wa_zhr_item-vbeln,
    y_wa_final_itab-kdpos to y_wa_zhr_item-posnr,
    y_wa_final_itab-receiptno to y_wa_zhr_item-receiptno
    modify zhr_item from y_wa_zhr_item

Maybe you are looking for

  • Getting error orapls10.dll

    Getting below error while starting report server in oracle apps. the procedure entry point psoasyn could not be located in dynamic link library orapls10.dll How to resolve the issue?

  • Can't open web browser in solaris 10

    I'm on the java desktop for solaris. I click on the browser it acts like it is going to open and then nothing happens. Is there something else I need to set up. Thanks In Advance aslaton

  • Safari upgrade for Windows 8?

    Is there an upgrade for Safari using Windows 8?

  • Lightroom Versus Photoshop CS

    I use Photoshop CS to enhance/correct my Nikon camera files shot in RAW format. During the process of printing through Photoshop, my workflow consists of making sure I have calibrated the monitor (using X-rite Eye-one Display 2), have updated printer

  • 9700 - 6.0.0.448 -Trackpad issue

    Hello, last week I have upgraded my company BB 9700 with latest Vodafone 6.0 image (6.0.0.448). Before updateing to 6.0.0.448 I have done a jl_cmder resettofactory and wipe. Everything is working fine, except of one issue: When opening my calendar  (