Need help reading an internal table

Howdy,
I have an internal table (itab_knvh) that contains all the entries from table KNVH for a specified sales area.
Now I have another internal table (itab_kunnr) that contains all the customers that I need data for.
How can I read all the entries from itab_knvh where the 'date from' value (datab) is greater than today's date?
At the moment I have:
<b>  LOOP AT itab_kunnr.
    <i>READ TABLE itab_knvh WITH KEY kunnr = itab_kunnr-kunnr.</i>
    IF sy-subrc = 0.
      IF itab_knvh-datab GE p_validh.
        WRITE:/ itab_kunnr.
      ENDIF.
    ENDIF.
  ENDLOOP.</b>
but I don't think this will work if more than one customer entry exists in itab_knvh.
So is there a way of writing:
READ TABLE itab_knvh WITH KEY kunnr = itab_kunnr-kunnr
                              datab GE sy-datum.
Any ideas???

Hi Steve,
If you have written <i>exactly</i> the same SELECT statement as you have posted here, then it is in error.
Try this one out, instead.
select single hkunnr
              datab
              hzuor 
         from knvh
         into (itab_hier_output-old_kunnr,
               itab_hier_output-old_datab,
               itab_hier_output-old_hzuor)
        where kunnr = itab_kunnr-kunnr
          and datbi = itab_hier_output-new_datab.
Regards,
Anand Mandalika.

Similar Messages

  • Need help in processing internal table

    Hi all,
    Im facing a  problem in processing an internal table..especially with MODIFY.
    The internal table is having following records.(t_vttp)
    TKNUM       VBELN      KUNNR       NAME1                             LAND1
    0000975179|0071004839|0000022946|HUNTSMAN APC LIMITED               |SA   |
    0000975180|0071004845|0000022946|                                   |     |
    In the above, there are two delviry documents with same customers.
    The customer data is coming from different internal table.
      LOOP AT t_vttp.
        READ TABLE t_kna1_temp INTO wa_kna1_temp WITH KEY kunnr = t_vttp-kunnr.
        IF sy-subrc = 0.
          t_vttp-name1 = wa_kna1_temp-name1.
          t_vttp-land1 = wa_kna1_temp-land1.
          MODIFY t_vttp INDEX sy-tabix TRANSPORTING name1 land1.
        ENDIF.
      ENDLOOP.
    Here for second record,,the customer name and country is nt getting populated to t_vttop.
    Pls correct where it is going wrong.
    Thanks,
    Priya

    Hi Try the follwoing code with a little modification in your code.
    LOOP AT t_vttp.
    READ TABLE t_kna1_temp INTO wa_kna1_temp WITH KEY kunnr = t_vttp-kunnr.
    IF sy-subrc = 0.
    t_vttp-name1 = wa_kna1_temp-name1.
    t_vttp-land1 = wa_kna1_temp-land1.
    MODIFY t_vttp INDEX sy-tabix  TRANSPORTING name1 land1.
    append t_vttp.
    ENDIF.
    clear: wa_kna1_temp, t_vttp.
    ENDLOOP
    Also Please debugg your code and check if you are getting values.
    also check the value of t_vttp-kunnr in debugging for the second run of your loop.
    thanks
    lalit

  • Need help to find internal table.

    hello friends,
    i am working on a smart form i am given a transaction code, vf03 and a custom program and a custom function module,
    i tried to use /h to do the debugging through vf03, but i could not understand where the control was going it was all roaming inthe standard code,
    what all i need to do is to reach the internal table in the smartform, and do some modifications.
    now how do i reach the internal table.
    thank you.

    if you know smartform print program,then use se38 transaction-> use smart form print program and keep break point here.
    Now run VF03 transaction and see it
    Thanks
    Seshu

  • Search Help values to Internal table

    Dear Friends,
    Is it possible to export Search Help values to Internal table?
    On screen, when user click on Search button, the SAP standard search help will call (Customer Search). After entering values, some result get displayed and this result need to export to the internal table.
    Thanks in stack
    Nilesh

    Hi:
    try this:
    DATA : wa_shlp TYPE shlp_descr,
               it_records LIKE ddshretval OCCURS 0 WITH HEADER LINE.
    wa_shlp-SHLPNAME = 'MAT0M'.   "one of elementary search help name from mara-matnr.
    wa_shlp-SHLPTYPE = 'SH'.
    CALL FUNCTION 'F4IF_SELECT_VALUES'
         EXPORTING
           shlp                   = wa_shlp
      MAXROWS                = 0
      SORT                   = ' '
      CALL_SHLP_EXIT         = ' '
    IMPORTING
      MAXROWS_EXCEEDED       =
        TABLES
      RECORD_TAB             =
      RECDESCR_TAB           =
          return_tab            = it_records
    LOOP AT it_records.
      WRITE:/ it_records.
    ENDLOOP.
    Follows is how to get the search help name:
    CALL FUNCTION 'DD_SHLP_GET_HELPMETHOD'
      EXPORTING
        tabname                 = 'MARA'
        fieldname               = 'MATNR'
        langu                   = sy-langu
      NO_CHKTAB_MAPPING       =
      GET_ENTITYTAB           = ' '
       CHANGING
         shlp                    = wa_shlp
      callcontrol             = callcontrol
      EXCEPTIONS
        field_not_found         = 1
        no_help_for_field       = 2
        OTHERS                  = 3
    CALL FUNCTION 'F4IF_EXPAND_SEARCHHELP'
       EXPORTING
         shlp_top = wa_shlp
       IMPORTING
         shlp_tab = shlps.
    好运,
    启明星

  • Help on Delete Internal table records

    Hi,
    I have a internal table with some records in it.
    I need to delete the contents of this based on the condition as below.
    if product_search-Resp_product_company is not initial.
    SORT i_equi BY zzrefeng.
    DELETE i_equi WHERE zzrefeng <> product_search-Resp_product_company.
    endif.
    when i execute this all the records are getting deleted irrespective of the condition mentioned.
    Can anyone help me on this.
    Regards,
    Ram

    Hi,
    Need to delete the records if <b>ZZREFENG</b> does not have the value of <b>product_search-Resp_product_company</b> .
    Here I have product_search-Resp_product_company value as FI14. And also the internal table contains some records with ZZREFENG = FI14.
    I need to delete the internal table records if ZZREFENG <> FI14. But when i execute the statement it is deletng all the records even ZZREFENG = FI14 records also.
    Regards,
    Ram

  • How to read an internal table with more than  one (2 or 3) key field(s).

    how to read an internal table with more than  one (2 or 3) key field(s). in ecc 6.0 version

    hi ,
    check this..
    report.
    tables: marc,mard.
    data: begin of itab occurs 0,
          matnr like marc-matnr,
          werks like marc-werks,
          pstat like marc-pstat,
          end of itab.
    data: begin of itab1 occurs 0,
          matnr like mard-matnr,
          werks like mard-werks,
          lgort like mard-lgort,
          end of itab1.
    parameters:p_matnr like marc-matnr.
    select matnr
           werks
           pstat
           from marc
           into table itab
           where matnr = p_matnr.
    sort itab by matnr werks.
    select matnr
           werks
           lgort
           from mard
           into table itab1
           for all entries in itab
           where matnr = itab-matnr
           and werks = itab-werks.
    sort itab1 by matnr werks.
    loop at itab.
    read table itab1 with key matnr = itab-matnr
                              werks = itab-werks.
    endloop.
    regards,
    venkat.

  • Performance Issue When Read from Internal Table

    In my form, I have 6 windows which contain all the header information, which are kept in my gt_header internal table. Since all windows required data from the same internal table, reading the internal table at Initialization for once or, creating the LOOP at each window, which one will be a better choice in terms of performance?

    Hi,
    you cannot create 6 windows under loop.You can only have loop under a window only.
    So create a big window which covers whole area of 6 windows.Create templete under that and write only one loo with text in all those boxes of that templete.
    Regards,
    Rock.

  • Need help reading burn CDR mp3 and dvdrw from my superdrive

    my Super Drive was fine untill i upgrade to Maverick now it wouldnt  read the music on all of my burn cdr disk and dvdrw . ALso .need help  reading my external 2TB External Ntfs Hard drive.....

    To many conflicting information...
    my Super Drive was fine untill i upgrade to Maverick
    Per your system profile: "Mac mini, Mac OS 9.1.x"
    Mac Minis do not have a superdrive.  You also posted in the Intel iMac forums.
    Please correct and/or update so that you will be provided w/the correct troubleshooting suggestions.

  • Need urgent help on dynamic internal table.

    Hi experts,
    I got an editable dynamic internal table. When the value in 1 of the editable field has been changed, I will fire the the DATA_CHANGED event. In this event, I can get the row ID where the changes occur, but the problem is, how can I select back the data from the dynamic internal table using the row ID since index is not permitted to be used? I need to get the rest of the records form the ROW and then perform a database update accordingly. How can I select from the dynamic internal table given the row ID? THanks in advance.

    Hi
    I suppose it depends on the kind of internal table assigned to fieldsymbol, this sample works fine:
    FIELD-SYMBOLS: <FS> TYPE TABLE,
                   <WA> TYPE ANY.
    DATA: BEGIN OF ITAB OCCURS 0,
            FIELD,
          END   OF ITAB.
    DO 10 TIMES.
      ITAB-FIELD = 'a'.
      APPEND ITAB.
    ENDDO.
    ASSIGN ITAB[] TO <FS>.
    READ TABLE <FS> ASSIGNING <WA> INDEX 1.
    WRITE <WA>.
    It can't use the index with internal table of kind HASHED.
    Max

  • Need Help:Reading Data from RU payroll cluster for table GRREC

    Hi...
    I need help on how to read data from RU cluster table for table GRREC for the employee & run date and get the value from structure PC292 .
    Please let me know about the includes and the import and export statements to be used.
    Thanks in advance,
    RAVI.

    Hi,
    Here goes pseudocode
    Includes:
    include: rpppxd00    ,
                rpppxd10     ,
                rpc2cd09     , 
                rpc2rx02_ce , "if ldb pnp_ce is used else use the same include with out _ce
                rpc2rx29      ,  
                rpc2rx39      ,
                rpppxm00    ,
                rpc2ruu0_ce ,
    Declare:
    DATA : i_rgdir   LIKE pc261        OCCURS 0 WITH HEADER LINE     ,
               i_result  TYPE pay99_result OCCURS 0 WITH HEADER LINE ,
               i_grrec   LIKE  pc292           OCCURS 0 WITH HEADER LINE .
    start-of-selection:
    GET pernr.
    Get the RGDIR VALUE for the current PERNR & selected Molga
    get rgdir data TABLES i_rgdir
                          USING pernr-pernr
                                     p_molga " parameter
    CD-KEY-PERNR = PERNR-PERNR.
    RP-IMP-C2-CU.
    i_rgdir [] = rgdir[].
      LOOP AT i_rgdir WHERE fpbeg  LE  pn-endda
                        AND fpend  GE  pn-begda
                        AND srtza  EQ 'A'
                        AND void   NE   'V'.
      get_result_tabs   TABLES i_result
                                   USING 'RU'    "  US cluster
                                         pernr-pernr
                                         i_rgdir-seqnr
          RX-KEY-PERNR = PERNR-PERNR.
          UNPACK i_RGDIR-SEQNR TO RX-KEY-SEQNO.
          RP-IMP-C2-RU.
      i_grrec[] = i_result-inter-grrec[].
      LOOP AT i_grrec.
      case i_grrec.
      use wage types required here and pass the data to output table.
      endcase.
      endloop.
      endloop
    end-of-selction.

  • Need help- need to read a customer table from the payroll schema

    Hi gurus,
    I need to read an amonunt from a customer table in the payroll schema. Is it possible to input TABLE XXXX in the schema, or is impossible to read from a customer table?Do I need to create a report to upload the amount in an infotype?
    Thanks in advanced for for support!

    You should create your own custom operation (based on operation TABLE) to read your custom table from a Payroll PCR.
    If your custom table's name is longer than 5 characters, you may be required to use operations VAOFF and/or VALEN prior to your custom operation in the PCR.

  • End Routine ABAP to read from Internal table and do calculation.

    Hi All...
    I have completed some coding in a start routine to extract some fields from a DSO containing Master Data (Stock Age) into an internal table (the internal table has been defined in the global declarations area) which will then be read in the end routine.
    (the internal table will be read) at loadtime in the end routine and used in a calculation as described below.
    I.E
    GLOBAL DATA DECLARATION
    Data: ITAB1 TYPE TABLE OF /BIC/DSOTAB
    (DSOTAB has 3 fields PLANT, STYLE, 1STDATE (1STDATE IS A DATE FIELD)
    The start routine has the following code:
    IF ITAB1 IS INITIAL.
    SELECT /BIC/PLANT /BIC/STYLE /BIC/1STDATE
                    FROM /BIC/DSOTAB
                    INTO CORRESPONDING FIELDS OF TABLE ITAB1.
    This is working fine when run under simulation i.e ITAB1 is filled no problem.
    I then need to do a calculation in the end routine.
    1. First I have to find the record in the internal table using the key of PLANT AND STYLE from the RESULT_PACKAGE.
    The code i am using now is as follows....
        READ TABLE ITAB1 TRANSPORTING NO FIELDS WITH KEY
        /BIC/PLANT = <result_fields>-/BIC/PLANT /BIC/STYLE =
        <result_fields>-/BIC/STYLE.
    Once this record has been read I then have to perform the following calculation using the following additional fields
    <result_fields>-/BIC/DYS1ST is a NUMC field in the <result_fields> that will be be filled by the result of the calculation described below.
    <result_fields>-CALDAY is a date field which is already populated in the <result-fields> which is used in the calculation below.
    The Calculation required is a difference in days between two dates
    DYS1ST = CALDAY - 1STRED.
    The code i am using is
    If sy-subrc = 0.
         <result_fields>-/BIC/DYS1ST = <result_fields>-CALDAY -
         i_t_1stred_dso-/BIC/1STRED.
    So the whole section of code inside the LOOP at RESULT PACKAGE looks like this in the end routine
           READ TABLE ITAB1 TRANSPORTING NO FIELDS WITH KEY
        /BIC/PLANT = <result_fields>-/BIC/PLANT /BIC/STYLE =
        <result_fields>-/BIC/STYLE.
    IF sy-subrc = 0.
         <result_fields>-/BIC/DYS1ST = <result_fields>-CALDAY -
         i_t_1stred_dso-/BIC/1STRED.
    Im getting the error
    "ITAB1 " is a table without a header line and therefore has no component called "/BIC/1STRED
    Please can someone advise as to what I need to do to get this fixed please.
    Thanks in advance
    Stevo:)

    Hi,
    You will have to do few changes in your code as below,
    GLOBAL DATA DECLARATION
    Data: ITAB1 TYPE standard TABLE OF /BIC/DSOTAB.
    After that declare a workarea to read the values.
    DATA: i_wa_itab1 type /bic/dsotab.
    (DSOTAB has 3 fields PLANT, STYLE, 1STDATE (1STDATE IS A DATE FIELD)
    The start routine has the following code:
    IF ITAB1 IS INITIAL.
    SELECT /BIC/PLANT /BIC/STYLE /BIC/1STDATE
    FROM /BIC/DSOTAB
    INTO CORRESPONDING FIELDS OF TABLE ITAB1.
    This is working fine when run under simulation i.e ITAB1 is filled no problem.
    I then need to do a calculation in the end routine.
    1. First I have to find the record in the internal table using the key of PLANT AND STYLE from the RESULT_PACKAGE.
    The code i am using now is as follows....
    READ TABLE ITAB1 TRANSPORTING NO FIELDS WITH KEY
    /BIC/PLANT = <result_fields>-/BIC/PLANT /BIC/STYLE =
    <result_fields>-/BIC/STYLE.
    Once this record has been read I then have to perform the following calculation using the following additional fields
    <result_fields>-/BIC/DYS1ST is a NUMC field in the <result_fields> that will be be filled by the result of the calculation described below.
    <result_fields>-CALDAY is a date field which is already populated in the <result-fields> which is used in the calculation below.
    The Calculation required is a difference in days between two dates
    DYS1ST = CALDAY - 1STRED.
    The code i am using is
    If sy-subrc = 0.
    <result_fields>-/BIC/DYS1ST = <result_fields>-CALDAY -
    i_t_1stred_dso-/BIC/1STRED.
    So the whole section of code inside the LOOP at RESULT PACKAGE looks like this in the end routine
    READ TABLE ITAB1 into i_wa_itab1 WITH KEY
    /BIC/PLANT = <result_fields>-/BIC/PLANT /BIC/STYLE =
    <result_fields>-/BIC/STYLE.
    IF sy-subrc = 0.
    <result_fields>-/BIC/DYS1ST = <result_fields>-CALDAY -
    i_wa_itab1-/BIC/1STRED.
    Once you do this changes, your code will work fine.
    Regards,
    Durgesh.

  • Need to make the internal table structure dynamic

    Hi ,
    I need to upload data from an excel file, the columns in the excel keep on varying
    E.g the number of columns in one excel file can be 10, in the second excel file it can be 15.
    So in order to upload the data into an internal table the structre of internal table needs to be dynamic and change according to the number of fields in the input file .
    Is it possible by using field symbols or is there any other method to do the same
    Thanks.
    Nishant
    Edited by: nishant patel on Sep 17, 2009 10:48 AM

    Hi Nishant,
    According to ur requirement, dynamic internal table can be created like below. But database table name has to passed dynacimally.
        DATA: ftab TYPE STANDARD TABLE OF ddfield,
              ftab_wa TYPE ddfield,
              fcat_itab TYPE lvc_t_fcat,
              fcat_wa TYPE lvc_s_fcat,
              poi_itab TYPE REF TO data.
    FIELD-SYMBOLS: <itab> TYPE STANDARD TABLE.
        CALL FUNCTION 'DD_NAMETAB_TO_DDFIELDS'
          EXPORTING
            tabname  = p_table  " Pass database table name dynamically
          TABLES
            ddfields = ftab.
        LOOP AT ftab INTO ftab_wa.
          fcat_wa-fieldname = ftab_wa-fieldname.
          fcat_wa-ref_field = ftab_wa-fieldname.
          fcat_wa-ref_table = p_table.
          APPEND fcat_wa TO fcat_itab.
        ENDLOOP.
        CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog           = fcat_itab
          IMPORTING
            ep_table                  = poi_itab
          EXCEPTIONS
            generate_subpool_dir_full = 1
            OTHERS                    = 2.
        ASSIGN poi_itab->* TO <itab>.  " <itab> is dynamic internal table
    Might help u.
    Thanks.
    Edited by: Sap Fan on Sep 17, 2009 1:19 PM

  • Need help in Creating External Tables

    Hi All,
    I have a flat file containing numberic data, CLOB data, and also date columns data. I have to load this flat file data into staging server table using External tables. I have to write a stored procedure in such way creating exteranl tables dynamically. My question or need help from you people is that how to define the external table to load the CLOB data from flat file.
    Thanks,
    Sankar

    The LOCATION clause of an external table specifies the file or files to be read when the table is queried. You can change it to refer to different files without dropping and recreating the table and invalidating all dependent code.
    Regarding DBMS_SQL, yes you can do it the hard way if you prefer.
    Good point about CLOB columns in external tables. Quite possibly they are not supported, but I would have to check the manuals and try some examples.

  • Need a logic for Internal table processing

    Hi,
    I have a requirement...an internal table contains three fields material no, bin no, and Quantity
    Mat. No    |         Bin No        |              Quantity
    a              |              x1         |                   10
    a              |              x1         |                   10
    a              |              x2         |                   20
    b              |              x3         |                   10 
    c              |              x3         |                   20
    c              |              x4         |                   30
    c              |              x4         |                   40
    In this I need to append the records to new internal table say itab1 where multiple entries exist for some material no like mat no 'a' and 'c'  and
    if the material no. exist only once in the table, it has to be moved to another new internal table say itab2.
    Pls suggest some logic that does not have performance issues.
    Thanks in advance
    Saravana

    Hi there,
    a solution in brief...
    data: wa_itab1_a like itab1,
             wa_itab2_b like itab1,
             lv_tabix       type sytabix.
    sort itab1 by matnr.
    loop at itab1.
      wa_itab1_a = itab1.
      at new matnr.
        lv_tabix = sy-tabix + 1.
        clear wa_itab2_b.
        READ TABLE itab1 into wa_itab2_b
                            INDEX lv_tabix.
        if wa_itab2_b-matnr ne wa_itab1_a-matnr.
          append wa_itab1_a to itab2.
          delete itab1 where matnr = wa_itab1_a-matnr.
        endif.
      endat.
    endloop.
    Regards
    George Zervas
    Edited by: gzervas on Oct 20, 2010 12:08 PM

Maybe you are looking for

  • Macbook Pro 17-inch, Mid 2010

    I had my computer repaired about a year ago (give or take a month). The repair involved having the LCD monitor completely replaced. It reportedly was a loose connection which yeilded colour blocks down half of the screen. Prior to that I had a fan re

  • Query only form problems

    I have a data block linked to a parent table in a parent/child relationship. The parent table's query key is made up of 2 data items. When the form is executed I want the users to enter values in these 2 data items and then press a button that has a

  • Download MAC OS X lion

    I purchased and install MAC from app store. How do I download Mac OS X lion that I purchased?, I purchased and install MAC from app store. How do I download Mac OS X lion that I purchased?

  • Security settings STILL failing

    i've posted about this many times with increasing anger. i've only had one response, altho repeatedly, which told me (also repeatedly) a "fix" that (also repeatedly) never worked. i am getting SICK of skype claiming to have decent security measures,

  • Combining war files

    Hi, is there any ways to combine add stuff from other war files to existing project??? Thanks alot for help!!