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.

Similar Messages

  • 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

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

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

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

  • Xml to Internal table : Issue

    Dear All,
    I have written a program to bring the data from xml to internal table  Below is the strucutre of my xml file .
    - <Data>
    - <MT Type="CR">
      <MatType>FERT</MatType>
      </MT>
    - <OP Type="CR">
      <MatNumber>9901040103-000115</MatNumber>
    - <Activities Element="AT">
    - <AT Type="CR">
      <MaterialNumber>115</MaterialNumber>
      <ActivityType>DEPR.</ActivityType>
      </AT>
    - <AT Type="CR">
      <MaterialNumber>117</MaterialNumber>
      <ActivityType>L.C.R</ActivityType>
      </AT>
      </Activities>
      </OP>
      </Data>
    .However I am not able to handle the multiple entries which comes together . ie
    - <AT Type="CR">
      <MaterialNumber>115</MaterialNumber>
      <ActivityType>DEPR.</ActivityType>
      </AT>
    - <AT Type="CR">
      <MaterialNumber>117</MaterialNumber>
      <ActivityType>L.C.R</ActivityType>
      </AT>
    Please let me know how to handle this . Thanks!
    Regards,
    Syed

    Hi ,
    To convert XML data into internal table u have to use FM "SMUM_XML_PARSE", this FM takes XString as input ,so first u have to
    convert  ur xml string into XString using FM "SCMS_STRING_TO_XSTRING".
    Thanks
    jitendra

  • Working with internal table issue

    Hi all
    i have internal table with the follwing data
    and i want to move the entries (FNAM ,FVAL ) that relate to one screen 0101
    into new table and the entries for the new screen 7101 to diffrent table
    program        dynpro   dynbegin  fnam            fval
    SAPMF02D     0101     X
         0000                    BDC_CURSOR       RF02D-D0110
         0000                    BDC_OKCODE       /00
         0000                    RF02D-KUNNR       1000
         0000                    RF02D-D0110       X
    SAPMF02D     7101     X
         0000                    BDC_OKCODE       /EF12
         0000                    BDC_CURSOR       RF02D-KUNNR
    I want in table 1 for screen 0101
    fnam            fval
    BDC_CURSOR       RF02D-D0110
    BDC_OKCODE       /00
    RF02D-KUNNR       1000
    RF02D-D0110       X
    and in table 2 screen 7101
    BDC_OKCODE       /EF12
    BDC_CURSOR       RF02D-KUNNR
    what is the best way to do that assume the tables content can
    be change i.e. have more screens.
    Best regards
    Alex

    HI Raymond
    Thanks for replay
    I try your code with little adjustment
       TYPES: BEGIN OF dynpros,
             program TYPE  bdcdata-program,
             dynpro TYPE bdcdata-dynpro,
             bdcdata TYPE hrtb_bdcdata , <-- change it to table for the append statment  APPEND <f1> TO <f2>-bdcdata.
           END OF dynpros.
    and what i get in e_data is :
    E_DATA
    SAPMF02D     0101     Standard Table[1x5(618)]
    SAPMF02D     7101     Standard Table[1x5(618)]
    this is not really what i need
    i want to get all the FNAM and FVAL from the table like this
    I want in table 1 for screen 0101
    fnam            fval
    BDC_CURSOR       RF02D-D0110
    BDC_OKCODE       /00
    RF02D-KUNNR       1000
    RF02D-D0110       X
    and in table 2 screen 7101
    BDC_OKCODE       /EF12
    BDC_CURSOR       RF02D-KUNNR
    Best Regards
    Alex

  • Abap string and internal table issue

    Hi All,
    Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
    All points will be awarded
    And please do not offer rewards.
    Regards,
    srinivas
    Edited by: srinu.anisetti on Mar 24, 2010 12:26 PM
    Edited by: srinu.anisetti on Mar 24, 2010 12:33 PM
    Edited by: Rob Burbank on Mar 24, 2010 10:02 AM

    we are waiting for your issue

  • 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

  • Short dump-internal table size issue

    Hi,
    I get the following message in the short dump analysis for a report.
    No storage space available for extending table "IT_920".
    You attempted to extend an internal table, but the required space was not available.
    Error Analysis:
    The internal table "IT_920" could not be enlarged further.             
    To extend the internal table, 9696 bytes of storage space was          
    needed, but none was available. At this point, the table "IT_920" has  
    1008240 entries.
    Its an old report and I saw the internal table declaration using the "OCCURS" clause in the internal table declaration.
    begin of itab occurs 100.
    end of itab.
    I tried the option of changing to "OCCURS 0", still issue persists.
    Any help would be highly appretiated
    CM

    Hello CMV,
    This is basic problem with SAP internal tables. For every internal table memory is alocated ( Max..256K)...once you cross the memory size/limit of the internal table it resuls in short dump.
    Only way to overcome this problem is handle limited number of records at a time.. 
    Please refer following sample code which will help you to avoid short dump while processing large number of records....
      SORT TAB_RESULT.
      DESCRIBE TABLE TAB_RESULT LINES W_RECORDS.
      W_LOW      = 1.
      W_UP       = 1000.
    *Spliting the records from tab_result1 by pakage of 1000 at a time
    *to avoid short dump in case of more records
      WHILE W_LOW <= W_RECORDS.
        R_PKUNWE-SIGN = 'I'.
        R_PKUNWE-OPTION = 'EQ'.
        R_WERKS-SIGN = 'I'.
        R_WERKS-OPTION = 'EQ'.
        LOOP AT TAB_RESULT FROM W_LOW TO W_UP.
          MOVE TAB_RESULT-PKUNWE TO R_PKUNWE-LOW.
          MOVE TAB_RESULT-WERKS  TO  R_WERKS-LOW.
          APPEND R_PKUNWE.
          APPEND R_WERKS.
        ENDLOOP.
    *fetch sold to party
         SELECT KUNNR NAME1
           FROM KNA1
           APPENDING CORRESPONDING FIELDS OF TABLE TAB_KNA1
           WHERE KUNNR IN R_PKUNWE.
    *fetch plant
      SELECT WERKS NAME1
             FROM T001W
             APPENDING CORRESPONDING FIELDS OF TABLE TAB_T001W
             WHERE WERKS IN R_WERKS.
       REFRESH: R_PKUNWE,
                R_WERKS.
        W_LOW = W_LOW + 1000.
        W_UP  = W_UP  + 1000.
      ENDWHILE.
    Hope this will help you to solve problem.
    Cheers,
    Nilesh

Maybe you are looking for

  • How can I place my initials when in a document shared review?

    When in a document shared review envitronemnt, the Sign Document menu is grayed out, I want to be able to place my initials in a document, what are my options?

  • Printing in B&W with HP CM2320 MFP - follow up

    Hi everyone, In the thread below Matthaus fixed his problem with the printer on his mac as quoted: https://discussions.apple.com/thread/1979704 "Okay. I figured it out. Knowing that the Grayscale was the ticket was very helpful. I just went into the

  • How to run 64-bit native code with Java Web Start

    This question has probably been asked many times, but I couldn't find anything in my searches. How can I get Java Web Start on a Solaris client (Solaris 10 in this case, with JRE 1.5) to run a java application that includes a 64-bit native code libra

  • Anyone Here want a Data Guard Certification?

    There is a Oracle RAC Certfied Expert Certification . . . Why not one for Data Guard? It would be nice for those of us who have spent time with Data Guard Post a comment and let's see if they will make one.

  • Parametric view

    Are there any way how to create parametric view? Or will be it in the future versions? Anything as create view v_test (col1,:col_par) as select col1 from test where col2=:col_par and use it as select * from v_test(par) This is very simple view, but f