Performance on Select Single&Write  AND Select*(For All Entries)&Read&Write

Hi Experts,
I got a code review problem & we are in a argument.
I need the best performance code out of this two codes. I have tested this both on 5 & 1000 & 3000 & 100,000 & 180,000 records.
But still, I just need a second opinion of experts.
TYPES : BEGIN OF ty_account,
        saknr   TYPE   skat-saknr,
        END OF ty_account.
DATA : g_txt50      TYPE skat-txt50.
DATA : g_it_skat    TYPE TABLE OF skat,       g_wa_skat    LIKE LINE OF g_it_skat.
DATA : g_it_account TYPE TABLE OF ty_account, g_wa_account LIKE LINE OF g_it_account.
Code 1.
SELECT saknr INTO TABLE g_it_account FROM skat.
LOOP AT g_it_account INTO g_wa_account.
  SELECT SINGLE txt50 INTO g_txt50 FROM skat
    WHERE spras = 'E'
      AND ktopl = 'XXXX'
      AND saknr = g_wa_account-saknr.
  WRITE :/ g_wa_account-saknr, g_txt50.
  CLEAR : g_wa_account, g_txt50.
ENDLOOP.
Code 2.
SELECT saknr INTO TABLE g_it_account FROM skat.
SELECT * INTO TABLE g_it_skat FROM skat
  FOR ALL ENTRIES IN g_it_account
      WHERE spras = 'E'
        AND ktopl = 'XXXX'
        AND saknr = g_it_account-saknr.
LOOP AT g_it_account INTO g_wa_account.
  READ TABLE g_it_skat INTO g_wa_skat WITH KEY saknr = g_wa_account-saknr.
  WRITE :/ g_wa_account-saknr, g_wa_skat-txt50.
  CLEAR : g_wa_account, g_wa_skat.
ENDLOOP.
Thanks & Regards,
Dileep .C

Hi Dilip.
from you both the code I have found that you are selecting 2 diffrent fields.
In Code 1.
you are selecting SAKNR and then for these SAKNR you are selecting TXT50 from the same table.
and in Code 2 you are selecting all the fields from SAKT table for all the values of SAKNR.
I don't know whats your requirement.
Better you declare a select option on screen and then fetch required fields from SAKT table for the values entered on screen for SAKNR.
you only need TXT50 and SAKNR fields.
so declare two types one for SAKNR and another for TXT50.
Points to be remember.
1. while using for all entries always check the for all entries table should not be blank.
2. you will have to fetch all the key fields in table while applying for all entries,
    you can compare key fields with a constant which is greater than initial value.
3. while reading the table sort the table by the field on which you are going to read it.
try this:
TYPES : BEGIN OF ty_account,
saknr TYPE skat-saknr,
END OF ty_account.
TYPES : begin of T_txt50,
      saknr type saknr,
      txt50 type txt50,
end of t_txt50.
DATA: i_account type table of t_account,
      w_account type t_account,
      i_txt50 type table t_txt50,
      w_txt50 type t_txt50.
select SAKNR from SKAT into table i_account.
if sy-subrc = 0.
sort i_account by saknr.
select saknr txt50 from SKAT into table i_txt50
for all entries in i_account
where SAKNR = i_account-SAKNR
here mention al the primary keys and compare them with their constants.
endif.     
Note; here you need to take care that, you will have to fetch all the key fields in table i_txt50.
and compare those fields with there constants which should be greater than initial values.
they should be in proper sequence.
now for writing.
loop at i_account into w_account.
clear w_txt50.
sort i_txt50 by saknr.
read table i_txt50 into w_txt50 with key SAKNR = w_account-saknr
if sy-subrc = 0.
write: w_txt50-saknr, w-txt50-txt50.
clear w_txt50, w_account.
endif.
endloop.
Hope it wil clear your doubts.
Thanks
Lalit

Similar Messages

  • What is the defference between select single * from and select * from Where

    What is the defference between select single * from and select * from Where
    which is prefferable and best one.

    Hai,
    *Difference Between Select Single and Select * from table UpTo One Rows:*
    According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields.
    select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index.
    The best way to find out is through sql trace or runtime analysis.
    Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for.
    The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS.
    The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.
    Mainly:  to read data from
    The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.

  • SELECT with and without for all entries giving different results

    Hi All,
    For some reason unknown to me ,
    There is a difference in result between the below mentioned query however the logic is same.
    1 .  lw_ebeln-EBELN = '0000366416'.
         APPEND lw_ebeln to lt_ebeln. 
          SELECT    ebeln
         FROM     ekbe
         INTO TABLE lt_ekbe
         FOR ALL ENTRIES IN lt_ebeln
         WHERE ebeln = lt_ebeln-ebeln
    2. SELECT ebeln from ekbe into table lt_ekbe where
    ebeln = '0000366416'..
    I have tried a lot to find the reason but unable to.
    Thanks,
    Faiz

    Hi faizur,
    Hope it help ful.
    If you add the EBELP in Internal table,  you will be getting same number of entries in both query.
    For all entries Removes the Duplicate key.
    Regards,
    Venkat.

  • I NEED select ..... for all entries for this logic

    From table RBDRSEG, we need to pick up the field RBDRSEG-MATNR where RBDRSEG- RBLNR= RBKP-BELNR. If the program does not find any data then it can pick up the material id field from EKPO-MATNR for all the invoices picked up during the processing.

    Hi,
    Lets say that Invoices are in Int table ITAB.
    IF NOT ITAB[] IS INITIAL.
    SELECT MATNR FROM RBDRSEG INTO V_MATNR
    for all entries in itab
    where RBLNR= ITAB-BELNR.
    IF SY-SUBRC <> 0.
    SELECT MATNR FROM RSEG INTO V_MATNR
    for all entries in ITAB
    where BELNR= ITAB-BELNR.
    ENDIF.
    ENDIF.
    Use RSEG instead of EKPO because EKPO don't have BELNR(Invoice) field.
    Regards,
    Anji
    Message was edited by:
            Anji Reddy Vangala
    Message was edited by:
            Anji Reddy Vangala

  • Joins and use FOR ALL ENTRIES

    Two questions :
    <b>(1) I use join with for all entries: the performance will go down?:</b>
    SELECT t1~MBLNR t1~MJAHR ZEILE BUDAT
    INTO TABLE gt_mseg
    FROM MSEG as T1 INNER JOIN MKPF AS T2
    ON T1~MBLNR = T2~MBLNR and
       T2~MJAHR = T2~MJAHR
    FOR ALL ENTRIES IN gt_coss
    WHERE  T1~MJAHR = gt_coss-GJAHR AND
           T1~AUFNR = gt_coss-aufnr AND
           ( BWART = '261' OR
             BWART = '262' ) AND
           T2~BUDAT IN r_budat.
    <b>(2)  With "For all entries", if itab is too long, performance will go down?. In affirmative case. What  can I do?</b>

    Hi Jose,
    You'll have to make sure your global table gt_coss isn't empty.
    A nasty little habit of the IN statement (for all entries is a kind of IN statement)
    is that when it is empty, the system selekts all records.
    You might know this when u use Select-Options in your statement (like r_budat).
    Also there is an OSS note on he for all entries (531337) problems on i-series database.
    Greetings Fred.

  • How to use single buffered table with FOR ALL ENTRIES KEYWORD

    Hai,
    I'm Using TJ02T Database table, It is single buffered table but at the same time I want to use FOR ALL ENTRIES KEYWORD , Please Help me.
    Regards,
    S.Janani

    Hi,
    FOR ALL ENTRIES will not depend on the buffering nature of the table. The single buffered table will only only buffer one record into memory. You can still use the statement to query the values, but it may have performance problems if the data volume is high since the records are not completely buffered into memory, the time will spent in getting data from DB.
    Thanks..
    Preetham S

  • 2 for all entries in a single select

    Hi all,
            I need to do 2 for all entries in a single select statement.Is there a way out?

    Hi,
    No you cant use two FOR ALL ENTRIES at a same time.
    Use either of following:-
    1. Only JOINS
    2. One JOIN and one FOR ALL ENTRIES.
    3. Use multiple queries to fill multiple internal table and then read these internal table to form a final internal table.
    Hope this solves your problem.
    Regards,
    Tarun

  • Loop -- Select, for all entries, HOW TO ?

    Hi,
    I have followoing code.
    LOOP AT table ASSIGNING  TO lt_all_roles_all_objects.
      ENDSELECT.
      ENDLOOP.
    How to tune this? I don´t understand how and where to use the for all entries command.
    And what will happen with my append?
    Can somebody explain me?
    Thanks

    Hi,
    First you need to know some of tips in abap so that you can give good shape to ur program according to performance wise.
    --Try to avoid the joins and use FOR ALL ENTRIES IN in place of joins.
    --Try to avoid the MOVE CORRESPONDING
    --Dont use the loop statements with in loop.
    -- Dont write the select statement with in loop.
    -- Better use the read statement in side loop intead of loop in side loop.
    -- Use alway BINARY SEARCH in READ statement- in this mandatory thing is u need to sorty the internal table a/c to with key conditions.
    etc.................  like this u need take care some of abap tips so that u can achieve good coding standards..
    coming to your coding.............
    declare an internal table "itab_agr_1250" which contain fields mandt, agr_name, object, and deleted .
    SELECT mandt agr_name object deleted
          from agr_1250
           into itab_agr_1250
        where agr_name = <cust_tab>-rolename
           and mandt in sp_mandt
           and deleted = ''.
    IF sy-subrc = 0.
    sort itab_agr_1250 by agr_name.
    ENDIF.
    loop at table assigning <cust_tab>.
    read table itab_agr_1250 with key agr_name = <cust_tab>-rolename
                                                                          BINARY SEARCH.
    final_Itab-field1 = itab_agr_1250-.....
    final_Itab-field2 = itab_agr_1250-.....
    final_Itab-field3 = itab_agr_1250-.....  { USE single filed assign or move statement  for each field instead of MOVE CORRESPONDING }
    append final_Itab.
    endloop.
    <b>Reward with points if useful</b>
    Regards,
    Vijay

  • Select using for all entries

    hi gurus,
    plz check my report using for all entries where i am give data in selection screen from date to date as 3.01.2007 to 4.02.2007
    my code does not provide me data between  above date to date.
    it fetch data from other date like 26.06.2006 to some other
    plz check code and give me solution for it.
    TABLES: bseg, bkpf.
    *ALV grid_data
    TYPE-POOLS: slis.
                           INTERNAL TABLES
    TYPES: BEGIN OF it_output,
           bukrs  TYPE bseg-bukrs, "Company Code
           belnr  TYPE bseg-belnr, "Accounting Document Number
           gjahr  TYPE bseg-gjahr, "Fiscal Year
           buzei  TYPE bseg-buzei, "Number of Line Item
           augdt  TYPE bseg-augdt, "Clearing Date
           shkzg  TYPE bseg-shkzg, "Debit/Credit Indicator
           dmbtr  TYPE bseg-dmbtr, "Amount in local currency
           kostl  TYPE bseg-kostl, "Cost Center
           hkont  TYPE bseg-hkont, "G/L Account
           matnr  TYPE bseg-matnr, "Material Number
           werks  TYPE bseg-werks, "Plant
           erfmg  TYPE bseg-erfmg, "Quantity in unit of entry
           blart  TYPE bkpf-blart, "Document type
           bldat  TYPE bkpf-bldat, "Document Date
           budat  TYPE bkpf-budat, "Posting Date
           monat  TYPE bkpf-monat, "Fiscal period
           cpudt  TYPE bkpf-cpudt, "Document Entry Date
           usnam  TYPE bkpf-usnam, "User name
           tcode  TYPE bkpf-tcode, "Transaction Code20
           bktxt  TYPE bkpf-bktxt, "Document Header Text
           waers  TYPE bkpf-waers, "Currency Key
           awtyp  TYPE bkpf-awtyp, "Reference procedure
           awkey  TYPE bkpf-awkey, "Object key
          END OF it_output.
    TYPES: BEGIN OF it_bkpf,
           bukrs  TYPE bkpf-bukrs,
           belnr  TYPE bkpf-belnr,
           gjahr  TYPE bkpf-gjahr,
           blart  TYPE bkpf-blart,
           bldat  TYPE bkpf-bldat,
           budat  TYPE bkpf-budat,
           monat  TYPE bkpf-monat,
           cpudt  TYPE bkpf-cpudt,
           usnam  TYPE bkpf-usnam,
           tcode  TYPE bkpf-tcode,
           bktxt  TYPE bkpf-bktxt,
           waers  TYPE bkpf-waers,
           awtyp  TYPE bkpf-awtyp,
           awkey  TYPE bkpf-awkey,
          END OF it_bkpf.
    DATA: lt_output TYPE it_output OCCURS 0 WITH HEADER LINE.
    DATA: lt_bkpf   TYPE it_bkpf OCCURS 0 WITH HEADER LINE.
                       ALV DECLARATION DATA                              *
    DATA: it_fieldcat   TYPE    slis_t_fieldcat_alv,
          it_heading    TYPE    slis_t_listheader,
          it_sort       TYPE    slis_t_sortinfo_alv,
          it_events     TYPE    slis_t_event,
          it_alv_event  TYPE    slis_alv_event,
          gv_repname    TYPE    syrepid,
          gv_save       TYPE    char1,
          is_layout     TYPE    slis_layout_alv.
                     SELECTION SCREEN                                    *
    SELECTION-SCREEN BEGIN OF BLOCK bl WITH FRAME TITLE text-011.
    SELECT-OPTIONS: s_bukrs FOR bseg-bukrs NO INTERVALS,
                    s_blart FOR bkpf-blart,
                    s_budat FOR bkpf-budat.
    SELECTION-SCREEN END OF BLOCK bl.
                     START OF SELECTION                                  *
    START-OF-SELECTION.
      PERFORM get_data.
                       End of Selection                                  *
    END-OF-SELECTION.
      PERFORM build_field_catalog.
      PERFORM eventstab.
      PERFORM display_data.
                             FORMS                                       *
    *&      Form  get_data
          Get Data
    FORM get_data .
      SELECT bukrs
             belnr
             gjahr
             buzei
             augdt
             shkzg
             dmbtr
             kostl
             hkont
             matnr
             werks
             erfmg
             INTO TABLE lt_output
             FROM bseg
           WHERE bukrs IN s_bukrs.
      IF sy-subrc = 0.
        SORT lt_output BY belnr.
        DELETE ADJACENT DUPLICATES FROM lt_output COMPARING ALL FIELDS.
      ENDIF.
      IF NOT lt_output[] IS INITIAL.
        SELECT bukrs
               belnr
               gjahr
               blart
               bldat
               budat
               monat
               cpudt
               usnam
               tcode
               bktxt
               waers
               awtyp
               awkey
           INTO TABLE lt_bkpf FROM bkpf
           FOR ALL ENTRIES IN lt_output
           WHERE bukrs = lt_output-bukrs AND
                 belnr = lt_output-belnr AND
                gjahr = lt_output-gjahr."AND
                 blart IN s_blart        AND
                 budat IN s_budat ."     AND
                blart = 'SA'     OR
                blart = 'SB'     OR
                blart = 'AB'     OR
                blart = 'ZC'.
    *sort lt_bkpf  by blart budat.
       DELETE lt_bkpf WHERE blart NOT IN s_blart AND
                            budat NOT IN s_budat.
      ENDIF.
      SORT lt_bkpf BY bukrs belnr.
    SORT lt_output[].
    DELETE ADJACENT DUPLICATES FROM lt_output COMPARING ALL FIELDS.
      LOOP AT lt_output.
        READ TABLE lt_bkpf WITH KEY bukrs = lt_output-bukrs
                                    belnr = lt_output-belnr
                                    budat = lt_output-budat
                                    BINARY SEARCH.
        IF sy-subrc = 0.
          MOVE: lt_bkpf-gjahr TO  lt_output-gjahr,
                lt_bkpf-belnr TO  lt_output-belnr,
                lt_bkpf-blart TO  lt_output-blart,
                lt_bkpf-bldat TO  lt_output-bldat,
                lt_bkpf-budat TO  lt_output-budat,
                lt_bkpf-monat TO  lt_output-monat,
                lt_bkpf-cpudt TO  lt_output-cpudt,
                lt_bkpf-usnam TO  lt_output-usnam,
                lt_bkpf-tcode TO  lt_output-tcode,
                lt_bkpf-bktxt TO  lt_output-bktxt,
                lt_bkpf-waers TO  lt_output-waers,
                lt_bkpf-awtyp TO  lt_output-awtyp,
                lt_bkpf-awkey TO  lt_output-awkey.
          MODIFY lt_output.
       ELSE.
         DELETE lt_output.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "get_data
    thanks jayant

    Hi Jayant,
    You cannot retrieve data first from BSEG and then from BKPF.
    It is not correct and you cannot get the correct data.
    You should use BKPF which is header table first and then
    using for all entries retrieve data from BSEG.
    Use date field in the select statement condition for BKPF table retrieval and
    you don't have posting date field in BSEG.
    If you do like this, it will definitely work.
    Retrieve data from BKPF using date condition in SELECT statement.
    Then, using for all entries retrieve from BSEG.
    Reward if helpful.

  • Select -- for all entries.. fetching Duplicates

    Hi,
    Im using a Select- for all entries structure. Actually Select will supress the Duplicates .But i have a table which has 20000 entries , but my select --for all entries fetching around 56000 records..!
    Any idea/ anybody have Experience this kind of Problem..?
    If i sort the internal table would it resolve the proble..? Because its not happening in all cases.. but for few cases only its extracting duplicates.. other times..its supressing the duplicates.
    Appreciate any advise.

    Hi,
    Just check the table is not initial and then write select statement.
    if not internaltable1[] is initial.
    select field into table internaltable2 for all entries in internaltable1 where field1 = internaltable1-field1.
    endif.
    *Then sort the internaltable2
    sort internaltable2 by field.
    delete adjacent dulpcates from internaltable2 comparing field.
    Hope this helps.
    Regards,
    J.Jayanthi

  • Select fom table for all entries where field starts with value

    Hello
    I want to write a select like this
    select * from bsis
    into lt_bsis
    for all entries in lt_itab
    where xblnr like lt_itab-belnr%
    I want to select all the entries from bsis where the field xblnr starts with the values found in lt_itab-belnr.
    for example
    ls_itab-belnr = 5100000028
    bsis-xblnr = 510000002810001
                        510000002810002
                        510000002810003
                        520000002810001
    and i want to select only the entries that start with 5100000028 in this case
    Can anybody help?
    Thanks

    Hi,
    I hope below example code will help you to fix your issue,
    REPORT  ytest.
    TYPES : BEGIN OF ty_typ1,
              val TYPE i,
            END OF ty_typ1.
    TYPES : BEGIN OF ty_typ2,
              val1 TYPE hrobjid,
              val2 TYPE hrobjid,
            END OF ty_typ2.
    DATA : int_typ1 TYPE TABLE OF ty_typ1,
           int_typ2 TYPE TABLE OF ty_typ2,
           wa_typ1  TYPE ty_typ1,
           wa_typ2  TYPE ty_typ2,
           int_1001 TYPE TABLE OF hrp1001,
           wa_1001  TYPE hrp1001.
    REFRESH : int_typ1, int_typ2, int_1001.
    CLEAR : wa_typ1, wa_typ2, wa_1001.
    wa_typ1-val = 500001.
    APPEND wa_typ1 TO int_typ1.
    wa_typ1-val = 500002.
    APPEND wa_typ1 TO int_typ1.
    wa_typ1-val = 500003.
    APPEND wa_typ1 TO int_typ1.
    wa_typ1-val = 500001.
    APPEND wa_typ1 TO int_typ1.
    SORT int_typ1 ASCENDING BY val.
    DELETE ADJACENT DUPLICATES FROM int_typ1 COMPARING val.
    LOOP AT int_typ1 INTO wa_typ1.
      wa_typ2-val1 = ( wa_typ1-val * 100 ) + 1.
      wa_typ2-val2 = wa_typ2-val1 + 98.
      APPEND wa_typ2 TO int_typ2.
      CLEAR : wa_typ1, wa_typ2.
    ENDLOOP.
    SELECT * FROM hrp1001 INTO TABLE int_1001
             FOR ALL ENTRIES IN int_typ2 WHERE
                 plvar EQ '01'          AND
                 otype EQ 'S'           AND
                 sclas EQ 'O'           AND
                 begda LE sy-datum      AND
                 endda GE sy-datum      AND
                 objid GE int_typ2-val1 AND
                 objid LE int_typ2-val2.
    LOOP AT int_1001 INTO wa_1001.
      WRITE : / wa_1001-objid.
    ENDLOOP.
    Thanks & Regards,
    Harish Kumar N

  • Advice required on a select statement using "FOR ALL ENTRIES"

    Hi,
    this is really intresting ...
    I have a small requirement where in i have to find out
    the valid entries in my internal table (T_MATNR) by using a select statement to a check table (MARA) which has all the fields present in the internal table T_MATNR.
    Select statement is
    SELECT MATNR
           MTART
           from MARA
           for all entries in T_MATNR
           into table T_MATNR
           where matnr eq T_MATNR-MATNR.
    If you observe the itab in the option 'FOR ALL ENTRIES' and the destination table is the same. I want to know whether this is correct? will it cause any performance issue? right now this statement is working fine for me.

    Hi,
    U have to use
    SELECT MATNR
    MTART
    from MARA
    <b>into table I_MATNR(different table)</b>
    for all entries in T_MATNR
    where matnr eq T_MATNR-MATNR.
    If u r specifying both same table name then for what entries it will retrieve, if u have alreay selected some entries and appending u can use
    SELECT MATNR
    MTART
    from MARA
    <b>into table T_MATNR</b>where matnr eq T_MATNR-MATNR.
    then
    SELECT MATNR
    MTART
    from MARA
    <b>appending table T_MATNR</b>
    for all entries in T_MATNR
    where matnr eq T_MATNR-MATNR.
    In this way u can do.
    Hope u got it.

  • Select query 'for all entries'

    Hello Friends,
           SELECT emp_id emp_name
           INTO corresponding fields of table itab_emp
           FROM employee
           for all entries in itab_dept
           WHERE emp_id = itab_dept_emp_id.
    In the above select query we are using 'for all entries' for the internal table itab_dept.What will happen if the join fails?Will we get any data in the output table?
    What is the prerequisites for using 'for all entries'.
    Please advice me on this.
    Regards
    Ashish.

    Hi
    In this case all the records available in employee table are extracted into internal table itab_emp.
    It is safe to check whether itab_dept is initial or not.
    If it is initial then stop the select query.
    Check the following program u will get an idea.
    Also try this program by removing comment to 'REFRESH IT_LFA1'.
    REPORT  ZBM_PG                                  .
    TABLES: LFA1, EKKO.
    DATA:
         IT_LFA1 TYPE TABLE OF LFA1 WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 10,
          IT_LFA1 TYPE TABLE OF LFA1 WITH HEADER LINE,
          IT_EKKO TYPE TABLE OF EKKO WITH HEADER LINE.
    SELECT * FROM LFA1 INTO TABLE IT_LFA1 WHERE LIFNR EQ '0000001000' OR LIFNR EQ '0000001500'.
    SELECT * FROM LFA1 INTO TABLE IT_LFA1 UP TO 1 ROWS.
    refresh it_lfa1.
    SELECT * FROM EKKO INTO TABLE IT_EKKO FOR ALL ENTRIES IN IT_LFA1 WHERE LIFNR = IT_LFA1-LIFNR.
    LOOP AT IT_EKKO.
      WRITE: / IT_EKKO-LIFNR, IT_EKKO-EBELN.
    ENDLOOP.
    Reward me if it is useful

  • Select query like For all Entries

    Hi,
    I have a requirement like:
    I need to extract data (BKTXT) from table BKPF based on some criteria, into one internal table and I need to query on REGUP table for the above data, the selection criteria on REGUP as follows:
    BKTXT(Document Header Text with 25 Char) is a combination of DATE and character string.
    Ex: bkpf-bktxt = 20060710-PL02 (YYYYMMDD)
    it is like LAUFD + LAUFI (of table REGUP)
    i.e: LAUFD (REGUP) = 07/10/2006 (MM/DD/YYYY) and LAUFI(REGUP) = PL02
    here I am thinking to use a select query on REGUP using FOR ALL ENTRIES of table i_bkpf..
    How can I change the date format YYYYMMDD to MM/DD/YYYY for my requirement?
    ((    Run-on Date (REGUP-LAUFD) = the first 8 characters in the Document Header Text (BKPF- BKTXT) in MM/DD/YYYY date format (e.g. 07/10/2006)
       Run ID (REGUP-LAUFI) = the 10th character through the 15th character in the Document Header Text (BKPF- BKTXT)

    It is not possible to do in the way you are thinking of doing. "For all entries" requires you to have the itab table field and the database table field to have the same type and length. So something like below <u>will not work</u>.
    TABLES: regup.
    DATA: BEGIN OF itab OCCURS 0,
            text LIKE bkpf-bktxt.
    DATA: END OF itab.
    DATA: BEGIN OF itab_regup OCCURS 0.
            INCLUDE STRUCTURE regup.
    DATA: END OF itab_regup.
    SELECT * INTO TABLE itab_regup
             FROM regup FOR ALL ENTRIES IN itab
            WHERE laufd = itab-text+0(8).
    If you run this code, you will get an error as follows:
    <i>"When using the addition "FOR ALL ENTRIES IN itab", the fields "LAUFD" and "ITAB-TEXT+0(8)" must have the same type and length."</i>

  • Why should we select all key fields when using for all entries

    Hi,
    Why should we select all key fields in our select query when using for all entries statement?
    I read about for all entries but this point was not clear in any post.
    Please explain me
    Regards,
    Subhashini

    Dear Subhasini,
    It is because FOR ALL ENTRIES deletes the duplicate entries before populating the target internal table.
    Please do an F1 on FOR ALL ENTRIES & read the SAP documentation.
    I mean how duplicate entries will not get deleted when we use this?
    Quite simple, if you select  all key fields then each entry will be unique & there will not be any duplicate entries to delete !!
    BR,
    Suhas
    Edited by: Suhas Saha on Oct 16, 2009 9:41 AM

Maybe you are looking for

  • Image looks grainy in Photoshop CC but not in CS5

    All of my images look grainy int he dark areas in CC, but not in CS5.  Is there a display setting that I'm missing?  Side note, the saved images look fine.  They only look bad in the CC UI. Screen shot of CC Screen shot of CS5 Photshop CC and CS5 64-

  • Servlets/JDBC - Connect to database ONCE and not in every servlet - How?

    Hello, I'm using servlets and JDBC. In every servlet , i connect to the database and then i close the connection, but this is not ptactical. I would like to connect to the database once (at the beginning) when container starts and then close the conn

  • How to set not editable property in elements of pdf document

    Hi, I have developed a web dynpro with pdf intercative form, but when I drag and drop the elements of data source into pdf  they are in inpu-field mode (editable). I want to that fields are in text mode and therefore they are not editable. How to sol

  • Set id for dynamicly programmed link_to_action elements

    Hello. I create dynamicly a lot of link_to_action elements in an table. if i click on an element, it call the onaction-action where i get my event. now i can get the id of the link_to_url, but can i set the id for each link_to_action? thanks marcus E

  • Macbook pro 2 t.v

    hi i buy macbook pro. how i can to connected with t.v hdmi? which  cable television? tnx