Internal table Issue ( very urgent)

Hi,
   There are two internal tables A and B.
    Product is one of the fields of both  A and B  and is the key.
   A has say say 10 products and B has 4 products.
   I want to delete those products from A which are not there in B.
  ( It is somewhat like using 'FOR ALL ENTERIES IN ' with Select Statement)
Is this possible in internal tables without 'Loop at'. The actual table would have  over 1 million records and and looping is a major concern. 
   I am new to abap and any help from you guys would be appreciated.....

Advait,
I think you will need atleast one loop. This loop can be on the table B.
If product is the <b>left most field</b> of table B try this:
The last  field for table A must be a flag for don't delete
SORT IT_B by product.
LOOP AT IT_B INTO WA_B.
AT NEW product.
WA_A-dont_delete = 'X'.
MODIFY IT_A FROM WA_A TRANSPORTING dont_delete WHERE product = wa_b-product. 
ENDAT.
ENDLOOP.
DELETE IT_A WHERE dont_delete <> 'X'.

Similar Messages

  • CATS Issue VERY Urgent..

    HI ALL,
    BiW  PROD is placing CATS data for 2007 in to week 52 2006.  Can advise why?
    Please advise what would be the error.
    Cheers,
    Sri

    Hi All,
    We have a problem for 0CALWEEK in CATS.
    FOR  0CALQUARTER
    20061 means 1st quarter
    20062 means 2ND quarter
    20063 means 3RD quarter
    20064 means 4TH quarter
    FOR 0calweeK:
    20061 means 1st WEEK
    20062 means 2ND WEEK
    20063 means 3RD WEEK
    20064 means 4TH WEEK
    0CALWEEK is giving problem  IN CUBE.
    It  shows wrongly.
    0CALQUARTER      0CAL WEEk
    2007 1             2006 52 ( 52 week)
    2007 1                          2006 52
    <b>0CAL WEEk          should show 2007 1     instead of 2006 52.</b>
    It should show :
    0CALQUARTER      0CAL WEEk
    2007 1             2007 1 (ist week in 2007)
    2007 1                         2007 1
    we have a routine on 0CAL_week
    =====
    PROGRAM UPDATE_ROUTINE.
    $$ begin of global - insert your declaration only below this line  -
    TABLES: ...
    DATA:   ...
    data:   employee_md like /bi0/memployee,
            employee_wa like /bi0/memployee,
            person_md   like /bi0/mperson,
            PERSON_WA   LIKE /BI0/MPERSON.
    DATA:   G_RECORD_NO LIKE SY-TABIX.
    INCLUDE RS_BCT_HR_UPDATE_RULES_GENERAL.
    INCLUDE RS_BCT_HR_PAPA_UPDATE_RULES.
    $$ end of global - insert your declaration only before this line   -
    FORM compute_characteristics
      TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
      USING    COMM_STRUCTURE LIKE /BIC/CS0CATS_IS_1
               RECORD_NO LIKE SY-TABIX
               RECORD_ALL LIKE SY-TABIX
               SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
      CHANGING RESULT LIKE /BIC/VZCATST-CALWEEK
               RETURNCODE LIKE SY-SUBRC
               ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
    $$ begin of routine - insert your code only below this line        -
    fill the internal table "MONITOR", to make monitor entries
    data: w_date type d.
    data: w_date_check type d.
    data: w_numberofdays type p decimals 2.
    data: w_numberofweeks type i.
    data: w_dayofweek type p.
    data: w_first_day_of_sap_calendar type d value '19790101'.
    data: check type i.
    data: w_year(4) type c.
    data: w_weekno(2) type c.
    w_date_check = COMM_STRUCTURE-CALDAY.
    w_date = w_date_check.
    w_date+04(04) = '0101'. " beginning of the year
    do.
    w_dayofweek = ( ( w_date - w_first_day_of_sap_calendar ) mod 7 ) + 1.
    if w_dayofweek = 7. " First sunday(7) of the Current year
    exit.
    endif.
    add 01 to w_date+07(01).
    enddo.
    w_numberofdays = ( w_date_check - w_date ) + 1.
    w_numberofweeks = ceil( w_numberofdays / 7 ).
    w_year = w_date_check+0(4).
      if w_numberofweeks = 53.
        w_numberofweeks = 1.
        w_year = w_date_check+0(4) + 1.
      endif.
      if w_numberofweeks = 0.
        w_numberofweeks = 52.
        w_year = w_date_check+0(4) - 1.
      endif.
    w_weekno = w_numberofweeks.
    call function 'CONVERSION_EXIT_ALPHA_INPUT'
         exporting
              input   = w_weekno
        importing
             output  = w_weekno.
    concatenate w_year w_weekno into RESULT.
    result value of the routine
    RESULT = .
    if the returncode is not equal zero, the result will not be updated
      RETURNCODE = 0.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    $$ end of routine - insert your code only before this line         -
    ENDFORM.
    ========
    This is giving problem from 2007 year only.
    We need to check with FI or HR teams , Is there any configuration settings in R/3 side for 0Calweek?
    This is production ISSUE. Help me on very Urgent BASIS!!
    Thanks & Regards,
    Sri.

  • Query Issue(Very Urgent)

    Hi,
         I have issue with select statement to pull the records from two tables. Here I have two tables one is with Billing Document Items and Service Order Operations.
    I have service order as unique field in both tables, When I execute select statement with one service order I got 10 records like
    S Ord Oper                           Billing Document Items
    Oper    Repair Code                 Item    Oper    Repair Code
    10        AD01                           1         10        AD01
    20        AD01                           2         20        AD01  
    30        OT01                           3         10        AD01
    40        RE01                           4         20        AD01
    50        RP01                           5         20        AD01
                                                   6        20         AD01
                                                    7        30         OT01
                                                    8        40         RE01  
                                                    9        50         RP01
                                                   10      50         RP01
                 This are the records with same Service order number, and my select statement giving data like
    O/P
    Service Order =  60001212
    OPER    ITEM    REPAIR TYPE
    10         1           AD01
    20         1           AD01
    10         2           AD01
    20         2           AD01
    10         3           AD01
    20         3           AD01
    10         4           AD01
    20         4           AD01
    10         5           AD01
    20         5           AD01
    10         6           AD01
    20         6           AD01
    30         7           OT01
    40         8           RE01
    50         9           RP01
    50         10         RP01
    But I need output like this
    Item  Oper                   Rep Code
    1      10                      AD01
    2      20                      AD01
    3      10                      AD01
    4      20                      AD01
    5      20                      AD01
    6      20                      AD01
    7      30                      AD01
    8      40                      RE01
    9      50                      RP01
    10    50                      RP01
             Please give me the select statement which gives the above output. I need very urgent please....
    Thanks
    Robbie

    hi robert,
    The ouput u want is just a little away from the one u r actually getting. it is the two fields OPER and ITEM interchangeably..
    U just have to use GROUP BY ITEM..........if u want the desired output with ITEM as first field.
    <group-by-clause> &#8594; GROUP BY [<column-ref>,*]<column-ref>
    if it helps please reward points.
    thanks

  • Attachment issue --very urgent help  required

    Hello friends,
    1)i have create page and deatal page . requirement is that we have to load required attachments in table region, if not loading required attachments exception will raise. this validation is working fine in create page.
    2)same in detail page i loaded required attachments also excepiton is raising.
    waht would be cause. i am very new to ADF technology.
    very urgent to fix this issue. any one help me out.
    Thanks,
    vamshi.
    Edited by: Krishna Vamshi on Jul 1, 2010 6:14 PM

    Kirshna,
    Unfortunately your question is very unclear.
    Let me say that if you are asking about OA Framework, you should ask on the OA Framework forum, not here.
    also excepiton is raising.It will help if you say what the exception is.
    John

  • SMART FORMS- data from  internal table issue

    Hi ,
           I have a smart form in which I have to print three types of materials of Material Types say M1, M2 ,M3.
    In the SMART FORM,Main Window, I have created 3 TABLES for 3 types of Materials ie,
               TableM1,
               TableM2,
               TableM3.
    The internal tables to populate these TABLES are
    ( passing from Print program ).
                t_M1,
                t_M2,
                t_M3
    The Number of FIELDS vary in all the tables ,thats why I have created 3 internal tables for Diff Material Types.
    But only first TABLE is getting printed ie data inside TableM2, TableM3 are not getting printed.
    Can any SMARTFORM Gurus please let me know how I can solve this issue.
    Regards
    Avi

    Hi,
       Check whether you are mentioning any condition on the data. There are different possibilites of not getting printed. Like the way your displaying, data is in table.
    Can you please clearly mention how did you populated the internal table and kept the logic to print the values in the table. So that it problem would be  more clearly nown.
    Br,
    Laxmi

  • Excel to Internal Table Issue

    Hi Experts,
      Row
      Column
      Value
      1
      0001
      Prem(First Name )
      1
      0002
      Raj(Middle name )
      1
      0003
      Kaushik(Last name
      2
      0001
      Naresh
    I have the above data in excel file  and my internal table like as follows
    Data : begin of  it_itab occurs 0,
    Row type c,
    Column type string,
    Value type string,
    End of it_itab.
    Now I want to upload the excel file to my internal table
    filed wise  i.e in my intenal table row
    shold have row values from excel same as
    for column and value also
    Can anyone suggest me fix this issue?
    Best Regards,
    Ramjee M

    You may use this function to put data in internal table.
    CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
         EXPORTING
           filename                = p_file *xcel file name
           i_begin_col             = p_scol  *start column
           i_begin_row             = p_srow *start row
           i_end_col               = p_ecol *end col
           i_end_row               = p_erow *end row
         TABLES
           intern                  = it_tab
         EXCEPTIONS
           inconsistent_parameters = 1
           upload_ole              = 2
           OTHERS                  = 3.
      Use this function to put data in internal table.

  • Reading internal table issue?

    SELECT PERNR WERKS ABKRS BUKRS KOSTL ENAME GSBER FROM PA0001
                INTO TABLE GT_0001
                FOR ALL ENTRIES IN GT_0709
               WHERE PERNR = GT_0709-PERNR
                 AND ENDDA >= P_DATE
                 AND BEGDA <= P_DATE.
             READ TABLE GT_0001 INTO LS_0001 WITH TABLE KEY PERNR = LS_0709-PERNE
             IF SY-SUBRC = 0.
            CALL FUNCTION 'PA03_PCR_READ'
          EXPORTING
            F_ABKRS         = LS_0001-ABKRS
          IMPORTING
            F_CURRENT_BEGDA = GV_BEGINDATE
            F_CURRENT_ENDDA = GV_ENDDATE.
            ENDIF.
    IN THIS CODE WHILE READING THE INTERNAL TABLE IT IS SHOWING ERROR?
    PLEASE CORRECT THE CODE.
    REGARDS
    REDDY

    Hi,
    Please remove 'TABLE' keyword from your syntax.
    Check the datatype of field PERNR & PERNE. It shoud be same.
    Check the value which is in PERNE fied shoud be available in PERNR Field or not?
    Hope by this things you will be able to resolve issue.
    Regards,
    Narendra

  • Static internal table issue - Used in BI Extractor

    Hi,
      We are reading data from a table in to a static internal table and using this table for future lookups.
      Once in a while we can't find data while doing a lookup from this static internal table , But most of the time it works.
       Is it possible that data from this static internal table is removed due to memory issues during peak periods.
    Thanks in advance

    Here is the code and it is there in a function module.This function module is called from a different FM in a loop.
    TABLES: OIU_CM_MAT_PRCD.
      STATICS: i_mat_prcd LIKE OIU_CM_MAT_PRCD OCCURS 10 WITH HEADER LINE.
      DATA: ws_lines like sy-toccu.
      DESCRIBE TABLE i_mat_prcd LINES ws_lines.
      IF ws_lines = 0.
        SELECT * INTO TABLE i_mat_prcd
          FROM OIU_CM_MAT_PRCD.
        IF i_matnr > ' '.
          SORT i_mat_prcd BY matnr.
        ELSE.
          SORT i_mat_prcd BY majpd_cd pd_cd.
        ENDIF.
      ENDIF.
      IF i_matnr > ' '.
        READ TABLE i_mat_prcd WITH KEY matnr = i_matnr
           BINARY SEARCH.
        IF SY-SUBRC = 0.
          CHG_MAJOR = i_mat_prcd-MAJPD_CD.
          CHG_MINOR = i_mat_prcd-PD_CD.
          CONCATENATE i_mat_prcd-majpd_cd i_mat_prcd-pd_cd
             INTO chg_prod.
        ENDIF.    " i_matnr > blank

  • How to define internal table in smartform(urgent)

    Hi all,
    How can i define a internal table <b>with header line </b> in global data ???
    i defined like
    In Types,
    TYPES : BEGIN OF T_XVBPLP2 ,
             VENUM(10),
             VEPOS(10),
             POSNR(6),
             VEMNG LIKE LIPS-LFIMG,
             MATNR LIKE LIPS-MATNR,
             CHARG LIKE LIPS-CHARG,
             ARKTX LIKE LIPS-ARKTX,
             END OF T_XVBPLP2.
    TYPES: T_XVBPLP TYPE TABLE OF T_XVBPLP2.
    In Global Data,
    T_XVBPLP TYPE T_XVBPLP.
    Still, i am getting error message that, Internal table is not with header line.
    can u plz give me some examples , to  define internal table with header line in smartform ???
    any correct answers will be rewarded??
    Regards
    pabitra

    Hi
    define WA_ITAB  in Global variables
    variable name          type assin      associated type
    t_text                      like                     zstc_text
    you cannot define a internal table with header line in SMART Forms. Declare a internal table and a work area separately both referring to the same structure.
    Then you can use the work area. So, in this case WA_ITAB is declared as a global variable of TYPE ZSTC_TEXT.
    Regards
    Pavan

  • Internal table issue

    hi All,
    I am having three itabs. itab1 and itab2 have common field prctr. And prctr can be same for many records in both itab1 and itab2. i want to check that if records for a particular prctr are not in itab1 but are in itab2 then those records be moved to itab3. can anyone give me some suggestion?
    thanks and regards,
    Reena

    Hi Reena,
    If you want to append itab3 based on internal table is ITAB2.
    Use this:
    LOOP AT ITAB2.
    READ TABLE ITAB1 WITH KEY PRCTR = ITAB2-PRCTR.
    IF SY-SUBRC <> 0.
    MOVE CORRESPONDING ITAB2 TO ITAB3.
    APPEND ITAB3.
    CLEAR ITAB2.
    ENDIF.
    ENDLOOP.
    else If you want to append itab3 based on internal table is ITAB1
    Use this:
    LOOP AT ITAB1.
    READ TABLE ITAB2 WITH KEY PRCTR = ITAB1-PRCTR.
    IF SY-SUBRC <> 0.
    MOVE CORRESPONDING ITAB1 TO ITAB3.
    APPEND ITAB3.
    CLEAR ITAB1.
    ENDIF.
    ENDLOOP.
    Regards,
    Vinod.

  • Sum in internal table issue

    Dear Experts,
    I have a Qty field which needs to be summed up when material no, po no and size are same in my internal table
    Eg: PO no     Mat no     Size      Qty
          111          001          L          10
          111          001          L          20
    needs to be shown as
          111          001          L          30
    I have tried using the collect statement in several ways but unfortunately ddnt work out. Any suggestions?

    Although Farid's sugegestion of looping and over two tables and summing would work I don't there is any reason to desist with your original approach of using the collect statement. The collect statment is designed exactly for this purpose and would be more efficient than two nested loops. As described before the folloiwng code should work the correct data elements inserted instead of the descriptions
    types: BEGIN OF tys_structure,
             po_num type po_num,
             mat_no type mat_no,
             size type sizw,
             qty type qty,
            END OF tys_structure.
    data: lt_table type standard table of tys_structure
               with non-unique key matnr, po_no, size,
             ls_workarea type type_structure.
    collect ls_workarea into lt_table.
    One additional note, It would probably be better to use a unique key of a sorted or hashed table if you only want the results to be aggreagted by material no, po no and size. I suggested a non-unique key of a standard table here because it is more flexible and i don't know what elese you might want to do with this table in your code. 

  • Internal table record checking (Urgent)

    Hi Experts,
    I have an internal table having records. I want to check each record of the table with every other record to find out if there exist same record for more then one key field.
    Can anybody help me to place the logic for how i can check the records with each record? Like
    lifnr     banks
    1         12
    2         34
    3         12
    4         12
    5          76
    I want to find out 1,3 and 4.
    Thanks a ton in advance

    Hi Moni,
    IF in my First Reply the Second technique was working then this should solve your Problem:
    DATA:
      w_index TYPE i,
      w_lines TYPE i,
      w_duplicate(10) TYPE c.
    DESCRIBE itab LINES w_lines.
    LOOP AT itab INTO wa.
      w_index = sy-tabix + 1.
      DO. 
      READ TABLE itab INTO wa1 INDEX w_index.
        IF w_index <= w_lines.
          IF wa-banks EQ wa1-banks.
            CONCATENATE w_duplicate wa1-lifnr INTO w_duplicate SEPARATED BY SPACE.
            wa-duplicate = w_duplicate.
            MODIFY itab FROM wa.
          ENDIF.
        ELSE.
          EXIT.
        ENDIF.
       ADD 1 TO w_index.
      ENDDO.
    ENDLOOP.
    LOOP AT itab INTO wa.
      write:
        / wa-lifnr,
          wa-banks,
          wa-duplicates.
    ENDLOOP.
    ELSE try the below code it is same as above except one more Internal Table is used:
    DATA:
      w_index        TYPE i,
      w_lines        TYPE i,
      jtab            LIKE itab,
      w_duplicate(10) TYPE c.
    DESCRIBE itab LINES w_lines.
    LOOP AT itab INTO wa.
      w_index = sy-tabix + 1.
      DO. 
      READ TABLE jtab INTO wa1 INDEX w_index.
        IF w_index <= w_lines.
          IF wa-banks EQ wa1-banks.
            CONCATENATE w_duplicate wa1-lifnr INTO w_duplicate SEPARATED BY SPACE.
            wa-duplicate = w_duplicate.
            MODIFY itab FROM wa.
          ENDIF.
        ELSE.
          EXIT.
        ENDIF.
       ADD 1 TO w_index.
      ENDDO.
    ENDLOOP.
    LOOP AT itab INTO wa.
      write:
        / wa-lifnr,
          wa-banks,
          wa-duplicates.
    ENDLOOP.
    Regards,
    Sunil.

  • Space removed from character data type when move to internal table issue...

    Hi Friends,
                        I converted material code and other details into internal table which have corresponding data types.But in internal table,I can see material code as left justified ,but after that space was removed.For example if material code is 'ABC' then rest of the space(material char(18)) are removed.But I need remaining spaces.I tried to concatenate material  code with spaces (caoncatenate matnr `        ` int etc .. )at right side and moved to another internal table.Its working.But the problem is material codes have different values like one material 'ABC' and another like '123893-h' etc.So I need to calculate the space(out of char 18) dynamiclly and need to put space based on material code value.
    << Moderator message - Everyone's problem is important >>
    .Thank you all..
    Regards,
    Kumaran..
    Edited by: Rob Burbank on Oct 26, 2010 11:18 AM

    Hi Ramkumaran,
    You have not told the purpose of having these spaces.
    is it for transfering to a file?
    If that is the case, use a table with fixed lenght lines instead of many fields.
    i.e. try something like this
    DATA : i_tab type standard table of BUSDATA,
    wa_tab type BUSDATA.
    wa_tab+0(10) = material number.
    wa_tab+10(10) = material code.
    wa_tab+20(4) = company code...
    append wa_tab to i_tab.
    Thanks
    Vimal

  • Logic required for a Internal table  issue

    Hi All,
    I have 2 internal table. I need STLNR value to another internal table. Both having same field. But while reading from one internal table to another internal table using IDNRK key, One idnrk having 2 different stlnr value. But its taking only one. How to take both the values?
    The internal table value like below.
    it_stpo--> This is first table, Here one Idnrk having different stlnr value. I need the same in to next table. Here i read with idnrk field but its taking one stlnr value only into next table.
    How to change the logic ?
    Below is it_stpo table and next one is it_mbew_1
    it_stpo
    STLNR     IDNRK             MENGE
    17224     00439RM1     2.3
    17225     00439RM1     4.2
    172333     00849RM2     5.6
    172158     00432TM3     7.2
    152164     00583RM4     8.4
    176123     00583RM4     2.3
    it_mbew_1
    STLNR     IDNRK             STPRS
         00439RM1     111.22
         00439RM1     126.45
         00849RM2     3.3364
         00432TM3     15.5888
         00583RM4     0
         00583RM4     0.235
    My logic like below,
              SORT it_stpo BY idnrk.
              SORT it_mbew_1 BY matnr.
              LOOP AT it_mbew_1 INTO wa_mbew_1.
                READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_mbew_1-matnr BINARY SEARCH.
                IF sy-subrc = 0.
                  wa_mbew_1-stlnr = wa_stpo-stlnr.
                  MODIFY it_mbew_1 FROM wa_mbew_1 TRANSPORTING stlnr WHERE matnr = wa_mbew_1-matnr.
                ENDIF.
              ENDLOOP.
    Kindly help us.
    Mohana

    Try below logic.
    add one more field to it_stpo flag type char01.
    update the field with value 'X'.
    SORT it_stpo BY idnrk.
              SORT it_mbew_1 BY matnr.
              LOOP AT it_mbew_1 INTO wa_mbew_1.
                CLEAR WA_STPO.
                READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_mbew_1-matnr                                                                               
    flag = 'X'.
                if sy-subrc eq 0.
                         move ' ' to wa_stpo-flag.
                         modify it_stpo from wa_stpo index sy-tabix.
                          wa_mbew_1-stlnr = wa_stpo-stlnr.
                         MODIFY it_mbew_1 FROM wa_mbew_1 TRANSPORTING stlnr WHERE matnr = wa_mbew_1-matnr.
                 endif.
              ENDLOOP.
    Regards
    Vinod

  • How to structure the internal table issue I want to download to excel

    Hi ,
    I am trying to download the data from the internal table whose structure was
    i HAVE ONE INTERNAL TABLE WHICH IS
    123 ABC MIKE
    123 ABC DALLAS
    123 ABC BOMBAY
    345 BCD MEENAL
    345 BCD SHINDE
    345 BCD UJWALA
    I want the output the i WANT THE INTERNAL TABLE TO STRUCTURE IN THIS WAY
    123 ABC  MIKE
                   DALLAS
                   BOMBAY
    345 BCD  MEENAL
                   SHINDE
                   UJWALA

    U have to fill internal table as ..
    Loop at ITAB. <-- contains all the values
      at new field2.
        itab1 = itab.
        append itab1.
        clear itab1.
        continue.
      endat.
      clear : itab-field1 , itab-field2.
      itab1 = itab.
      append itab1.
      clear itab1.
    endloop.
    Now download ITAB1.

Maybe you are looking for