Using COLLECT on a internal table

Hello,
I have fetched records from a table into my internal table through, " SELECT * FROM .... INTO TABLE FOR ALL ENTRIES IN ...... "
There are two columns in my internal table against which i need a total of the column. COLLECT sums the amounts . But how can i use COLLECT in this scenario ?
Can anyone kindly guide me ...Thanks
Shehryar Dahar

Hi,
COLLECT add the numeric entries for the corresponding table keys..
Example.
DATA: BEGIN OF ITAB OCCURS 0,
MATNR TYPE MATNR,
COUNT TYPE I,
END OF ITAB.
ITAB-MATNR = 'ABC'.
ITAB-COUNT = 2.
COLLECT ITAB.
ITAB-MATNR = 'ABC'.
ITAB-COUNT = 1.
COLLECT ITAB.
ITAB-MATNR = 'ABCD'.
ITAB-COUNT = 2.
COLLECT ITAB.
ITAB-MATNR = 'ABCD'.
ITAB-COUNT = 3.
COLLECT ITAB.
LOOP AT ITAB.
WRITE: / ITAB-MATNR, ITAB-COUNT.
ENDLOOP.
For more information on Collect, check this site:
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/collect.htm
Hope this would help you out.
Regards,
Varun.

Similar Messages

  • Collect message into internal table

    Hi,
    does any one knows how BAPIs or CALL TRANSACTIONs collect messages into internal table.
    My problem is that some BI with CALL TRANSACTION doesn't collect right message into return table and I would like to collect this last message after CALL TRANSACTION and therefore be sure that everything went OK.....
    thx
    mario

    hi
    good
    check this
    Call Transaction p_trans using ZBDC_Table
                                   Mode p_mode
                                 Update p_update
                          Messages into p_messages.
         Move sy-subrc to w__subrc.
       Scan the messages in YDCRAISES to see if we need to
       change the message class.
         Loop at p_messages.
              Select single msgtyp
                into w__msgtp
                from zdcraise
               where tcode  = p_messages-tcode  and
                     msgid  = p_messages-msgid  and
                     msgnr  = p_messages-msgnr.
              If sy-subrc = 0.
                 Move w__msgtp to p_messages-msgtyp.
                 Modify p_messages.
              EndIf.
         EndLoop.
       Dump the message table ?
         If w__ydcset-dumpmsg = True.
    thanks
    mrutyun^

  • How to use aggregate function on internal table

    hi experts,
    I am beginner in abap.I want to use sum function on internal table.
    I have structure as follow:
    types: begin of ty_ftab,
           docno TYPE bkpf-belnr,
           comcode TYPE bkpf-bukrs,
           year TYPE bkpf-gjahr,
           line_itm type bsad-buzei,
           cust type bsad-kunnr,
           amt type bsad-dmbtr,
    end of ty_ftab.
    data: it_ftab type table of ty_ftab,
               wa_ftab type ty_ftab.
    i fetched data successfully into it_ftab from bkpf and bsad table and displyed into alv.
    now i want sum of amt using group by cust and want to display like
    cust        total_amt      
    in next screen...
    displying part is not important but how can i do sum of amt according to cust value? Is there in way to query on internal table?

    Hi,
    try this code,
    data : i_sort  TYPE TABLE OF slis_sortinfo_alv
      w_sort like LINE OF i_sort.
    sort it_ftab by cust.
    w_sort-subtot = 'X'.
    w_sort-fieldname = 'AMT'.
    w_sort-tabname = 'it_ftab'.
    APPEND w_sort to i_sort.
    In fieldcatalog :
    w_fcat-fieldname = 'AMT'.
    w_fcat-tabname  = 'it_ftab'.
    w_fcat-do_sum = 'X'.
    In REUSE_ALV_GRID_DISPLAY  FUNCTION MODULE  provide the it_sort.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    *  EXPORTING
    *    I_INTERFACE_CHECK                = ' '
    *    I_BYPASSING_BUFFER                = ' '
    *    I_BUFFER_ACTIVE                  = ' '
    *    I_CALLBACK_PROGRAM                = ' '
    *    I_CALLBACK_PF_STATUS_SET          = ' '
    *    I_CALLBACK_USER_COMMAND          = ' '
    *    I_CALLBACK_TOP_OF_PAGE            = ' '
    *    I_CALLBACK_HTML_TOP_OF_PAGE      = ' '
    *    I_CALLBACK_HTML_END_OF_LIST      = ' '
    *    I_STRUCTURE_NAME                  =
    *    I_BACKGROUND_ID                  = ' '
    *    I_GRID_TITLE                      =
    *    I_GRID_SETTINGS                  =
    *    IS_LAYOUT                        =
    *    IT_FIELDCAT                      =
    *    IT_EXCLUDING                      =
    *    IT_SPECIAL_GROUPS                =
        IT_SORT                          =  i_sort
    *    IT_FILTER                        =
    *    IS_SEL_HIDE                      =
    *    I_DEFAULT                        = 'X'
    *    I_SAVE                            = ' '
    *    IS_VARIANT                        =
    *    IT_EVENTS                        =
    *    IT_EVENT_EXIT                    =
    *    IS_PRINT                          =
    *    IS_REPREP_ID                      =
    *    I_SCREEN_START_COLUMN            = 0
    *    I_SCREEN_START_LINE              = 0
    *    I_SCREEN_END_COLUMN              = 0
    *    I_SCREEN_END_LINE                = 0
    *    I_HTML_HEIGHT_TOP                = 0
    *    I_HTML_HEIGHT_END                = 0
    *    IT_ALV_GRAPHICS                  =
    *    IT_HYPERLINK                      =
    *    IT_ADD_FIELDCAT                  =
    *    IT_EXCEPT_QINFO                  =
    *    IR_SALV_FULLSCREEN_ADAPTER        =
    *  IMPORTING
    *    E_EXIT_CAUSED_BY_CALLER          =
    *    ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          =
    *  EXCEPTIONS
    *    PROGRAM_ERROR                    = 1
    *    OTHERS                            = 2
      IF sy-subrc <> 0.
    * Implement suitable error handling here
      ENDIF.

  • Reg: Collect statement in internal table

    Hi,
       Can any one tell me wether we can use the collect statement in an internal table which has no header line
    if it can be used can anyone please send me a sample snippet
    Thanks In ADVANCE
    Guhapriyan Subrahmanyam

    Hi Guhapriyan,
    I have used the collect statement in the way as shown..
    DATA : BEGIN of I_ALLOCATIONS OCCURS 0,
            PSPNR LIKE PRPS-PSPNR,
            PSPID LIKE PROJ-PSPID,
            PSPHI LIKE PRPS-PSPHI,
            POST1 LIKE PROJ-POST1,
            ZZLOB LIKE PROJ-ZZLOB,
            WERKS LIKE PROJ-WERKS,
            SOBID LIKE HRP1001-SOBID,
            OBJID LIKE HRP1001-OBJID,
            BEGDA LIKE HRP1001-BEGDA,
            ENDDA LIKE HRP1001-ENDDA,
            PROZT LIKE HRP1001-PROZT,
            LOB   LIKE HRP1000-STEXT,
            TEMP  TYPE P decimals 2,
            TYPE(3),
            ZROLE LIKE PA0001-ZROLE,
            HOLID TYPE P decimals 2,
            LEAVE TYPE P decimals 2,
            DAYS  TYPE P decimals 2,
           END of I_ALLOCATIONS.
    DATA:  I_ALLOCATION LIKE I_ALLOCATIONS OCCURS 0 WITH HEADER LINE.
    ************Populate I_ALLOCATIONS **************
    LOOP AT I_ALLOCATIONS.
        COLLECT I_ALLOCATIONS INTO I_ALLOCATION.
    ENDLOOP.
    Actually i had requirement like u, but this one is rather simple...
    Get the required data in an I_Table which dont require Header line..
    Later on collect this particular I_Table in other I_Table1 with the Header Line...
    Regards,
    Abhishek

  • Two collect statement from internal table

    Dear Experts,
    I want populate values to two internal tables from a internal table.
    can i use two collect statement for different internal table from a single internal table.
    advise please.
    Thanks in advance.
    R.Rajendran

    hi there....
    well u can very well use this thing.....
    use the two colect statements inside the loop which u will use  to read the records of the input table.
    hope it helps.
    do reward if it does.

  • Collect in an internal table with keys plant and material

    Hi ,
    I have an output internal table with material , plant and var quantitites .
    I would like to use Collect statement and sum the quantities but do it by plant and material .
    How do I specify that i want to do it on plant or material ?
    Thanks !

    hi here is an example like urs..
    DATA: BEGIN OF seats,
            carrid TYPE sflight-carrid,
            connid TYPE sflight-connid,
            seatsocc TYPE sflight-seatsocc,
          END OF seats.
    DATA seats_tab LIKE HASHED TABLE OF seats
                   WITH UNIQUE KEY carrid connid.
    SELECT carrid connid seatsocc
           FROM sflight
           INTO seats.
      COLLECT seats INTO seats_tab.
    ENDSELECT.
    check for help..
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/collect.htm
    regards,
    venkat

  • How to make use of a global internal table in SAP BW during transfer rules

    HI friends,
    I am ABAP consultant working on some APO info cubes. I have an issue during the upload of planning area data into APO info cube.
    Please help.
    I am using a transfer routine to find the TECHWEEK from a data base table ZGC_CALWEEK based on the on the calender month and calender week.
    Code I am writing is like below.
    *       FORM COMPUTE_/BIC/ZCALWEEK
    * Compute value of InfoObject ZCALWEEK
    * in communication structure /BIC/CSZT6DPPA
    * Technical properties:
    *     field name      = /BIC/ZCALWEEK
    *     data element    = /BIC/OIZCALWEEK
    *     data type       = NUMC
    *     length          = 000006
    *     decimals        = 000000
    *     ABAP type       = N
    *     ABAP length     = 000006
    *     reference field =
    * Parameters:
    *  -->  RECORD_NO       Record number
    *  -->  TRAN_STRUCTURE  Transfer structure
    *  <--  RESULT          Return value of InfoObject
    *  <->  G_T_ERRORLOG    Error log
    *  <--  RETURNCODE      Return code (to skip one record)
    *  <--  ABORT           Abort code (to skip whole data package)
    FORM COMPUTE_/BIC/ZCALWEEK
      USING    RECORD_NO LIKE SY-TABIX
               TRAN_STRUCTURE TYPE TRANSFER_STRUCTURE
               G_S_MINFO TYPE RSSM_S_MINFO
      CHANGING RESULT TYPE /BIC/OIZCALWEEK
               G_T_ERRORLOG TYPE rssm_t_errorlog_int
               RETURNCODE LIKE SY-SUBRC
               ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel datapackage
    *$*$ begin of routine - insert your code only below this line        *-*
    * DATA: l_s_errorlog TYPE rssm_s_errorlog_int.
    DATA: LV_WEEK         TYPE ZGC_CALWEEK-APOWEEK,
            LV_MONTH        TYPE ZGC_CALWEEK-APOMONTH,
            LV_TECH_WEEK    TYPE ZGC_CALWEEK-TECHWEEK.
      LV_WEEK   = TRAN_STRUCTURE-CALWEEK.
      LV_MONTH  = TRAN_STRUCTURE-CALMONTH.
      SELECT SINGLE TECHWEEK INTO LV_TECH_WEEK
        FROM ZGC_CALWEEK CLIENT SPECIFIED
        WHERE  MANDT = SY-MANDT
        AND  APOWEEK  = LV_WEEK
        AND   APOMONTH = LV_MONTH.
      IF SY-SUBRC IS INITIAL.
        RESULT = LV_TECH_WEEK.
      ELSE.
        RETURNCODE = 1.
        ENDIF.
    *$*$ end of routine - insert your code only before this line         *-*
    ENDFORM.
    There are more than 50-80 million records that wil be transferred from planning area to info cube. The select statment is giving pathetic performance as this has to run 50-80 million times.
    After adding the select statment to find the TECHWEEK it is taking 4 times the time that used to take before writing the select statment.
    Is there a way that I can first fetch the data from ZGC_CALWEEK to one internal table and that internal table can be used using read statment during the transfer routine instead of writing select statement here.
    Please help in this case?

    Hi Ashutosh,
    Thanks for the reply,
    The structure of the ZGC_CALWEEK is as below. I have already created a secondary index on the table for this table for the fields APO WEEK and APO MONTH. This didn't help much on the performance.
    I am also planning to keep the ZGC_CALWEEK database table to be fully buffered and this may definitely improve the performance but I need to reduce the data base hits as less as possible.
    MANDT                           MANDT                           CLNT     3     0     Client
    TECHWEEK                           ZTECHWEEK                           NUMC     6     0     Technical Week
    FROMDATE_TECH     DATUM                           DATS     8     0     Date
    TODATE_TECH     DATUM                           DATS     8     0     Date
    APOWEEK                           /BI0/OICALWEEK     NUMC     6     0     Calendar year / week
    FROMDATE_APO     DATUM                            DATS     8     0     Date
    TODATE_APO     DATUM                            DATS     8     0     Date
    APOMONTH                           /BI0/OICALMONTH     NUMC     6     0     Calendar year/month
    The table ZGC_CALWEEK is in APO system, where the transfer rules are being executed.
    As you mentioned START ROUTINE, In the start routine Can I create an internal table let's say GT_CALWEEK with structure ZGC_CALWEEK and pull all the records (I have a max of 2000 records in this table) from ZGC_CALWEEK to GT_CALWEEK and Can I used the same internal table GT_CALWEEK in the transfer routine to read the TECHWEEK from internal table.
    Thank you very much again for you reply. Any help regarding this would be greatly appreciated.
    Best regards,
    Siva

  • Using Provide-endprovide copy internal table

    Hi,
    I have problem that is if i want to copy the data from infotype to internal table means
    Provide * from p9012 between  pn-begda  and  pn-endda.
    if p9012-zz_client_c EQ itemp-z_client_c.
    MOVE: p9012-begda TO it9012-begda,
               p9012-zz_dept_c TO it9012-z_dept_c,
               SORT IT9012 BY z_dept_c.
               append it9012.
    endif.
    endprovide.
    this one not copying data from infotype to internaltable.
    what i can do?
    Thanks,
    Regards,
    Nandha

    HI Use this code example..
    plz reward poins if it helps you..
    & Report  ZSAPHR_PNP
    Report ZSAPHR_PNP.
    TABLES : PERNR.
    *Infotype Declaration
    INFOTYPES: 0002, "PERSONAL DATA
               0006, "ADDRESS
               0008, "
               0000, "
               0001. "ACTIONS
    DATA : BEGIN OF ITAB  OCCURS 10,  "INTERNAL TABLE DECLARATION
           NACHN  LIKE  P0002-NACHN,
           VORNA  LIKE  P0002-VORNA,
           GESCH  LIKE  P0002-GESCH,
           GBDAT  LIKE  P0002-GBDAT,
           FAMST  LIKE  P0002-FAMST,
           HSNMR  LIKE  P0006-HSNMR,
           STRAS  LIKE  P0006-STRAS,
           LOCAT  LIKE  P0006-LOCAT,
           PSTLZ  LIKE  P0006-PSTLZ,
           LAND1  LIKE  P0006-LAND1,
           PLANS  LIKE  P0001-PLANS,
           ORGEH  LIKE  P0001-ORGEH,
           BET01  LIKE  P0008-BET01,
           WAERS  LIKE  P0008-WAERS,
           PERNR  LIKE  P0000-PERNR,
           END OF ITAB.
    DATA: G_REPID LIKE SY-REPID."Report name
    INITIALIZATION.
      G_REPID = SY-REPID.
      PNPTIMED = 'D'.
    **********************************************START OF
    SELECTION*****************************************
    START-OF-SELECTION.
    GET PERNR.
      PROVIDE * FROM P0002 BETWEEN PN-BEGDA AND PN-ENDDA.
        ITAB-PERNR = P0000-PERNR.
        ITAB-NACHN = P0002-NACHN.
        ITAB-VORNA = P0002-VORNA.
        IF P0002-FAMST = '0'.
          ITAB-FAMST = 'S'.
        ELSE.
          ITAB-FAMST = 'M'.
        ENDIF.
        ITAB-FAMST = P0002-FAMST.
        IF P0002-GESCH = '1'.
          ITAB-GESCH = 'M'.
        ELSE.
          ITAB-GESCH = 'F'.
        ENDIF.
        ITAB-GBDAT = P0002-GBDAT.
        ITAB-HSNMR = P0006-HSNMR.
        ITAB-STRAS = P0006-STRAS.
        ITAB-LOCAT = P0006-LOCAT.
        ITAB-PSTLZ = P0006-PSTLZ.
        ITAB-LAND1 = P0006-LAND1.
        ITAB-ORGEH = P0001-ORGEH.
        ITAB-PLANS = P0001-PLANS.
        ITAB-BET01 = P0008-BET01.
        ITAB-WAERS = P0008-WAERS.
        APPEND ITAB.
      ENDPROVIDE.
    END-OF-SELECTION.

  • Use secondary index in internal tables.

    what are the uses of secondary index in internal table?

    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eb47446011d189700000e8322d00/content.htm
    Creating Secondary Indexes
    Proceed as follows to create a secondary index on a table:
    In the field maintenance screen for the table, choose Goto --> Indexes.
    1. If you went to the field maintenance screen of the table in display mode, only correct the index (and not the table).
    If indexes already exist on the table, a list of these indexes is displayed. Choose Create. A dialog box appears in which you must enter the three-place index identifier. If there are no indexes, go directly to the dialog box.
    2. Enter the index identifier and choose Continue.
    You will go to the maintenance screen for indexes.
    3. Enter an explanatory short text in the field Short text.
    Choose TabFields.
    4. A list of all the fields of the table is displayed.
    5. Select the fields which you want to copy to the index.
    6. Choose Copy.
    The selected fields are copied to the index.
    7. If the values in the index fields already uniquely identify each record of the table, select Unique index.
    A unique index is automatically created on the database during activation because a unique index also has a functional meaning (prevents double entries of the index fields).
    8. If it is not a unique index, leave Non-unique index selected. In this case you can use the corresponding radio buttons to define whether the index should be created automatically on the database for all database systems, for selected database systems or for no database system.
    9. If you chose For selected database systems, you must specify these systems.
    You have two possibilities here:
    List of inclusions: The index is only created automatically during activation for the database systems specified in the list. The index is not created on the database for the other database systems.
    List of exclusions: The index is not created automatically on the database during activation for the specified database systems. The index is automatically created on the database for the other database systems.
    Click on the arrow symbol behind the radio buttons. A dialog box appears in which you can define up to 4 database systems. Use the corresponding radio buttons to decide whether this list should be treated as a list of inclusions or exclusions.
    10. Activate the index with Index ® Activate. The activation log tells you about the flow of the activation. Call it with Utilities ® Act.log. If an error occurred when activating the secondary index, you will automatically go to this log.
    The secondary index is automatically created on the database during activation if the corresponding table has already been created there and index creation was not excluded for the database system.
    Reward points if useful.

  • Want to get the where-used hitlist to an internal table

    hi everyone,
            while using where-used list we will get a hit list result. I want to take that hit list data to an internal table with out using any local file.
    Is anybody there to help me.
    regards,
    vijaya.

    Hi Lakshmikona,
    I had wrongly interpreted your question, as suggested by Thomas you can use RS_EU_CROSSREF to get the Where used list data in the internal table.
    Refer this SAP standard report RSHDCF00 for you detailed perusal.
    Regards
    Abhii
    Edited by: Abhii on Sep 3, 2010 12:08 PM

  • Invoice: How to use more than one Internal Table's info in one Table

    Hi ,
    I am doing an invoice, and have the info from internal table wa_itgen showing - Matnr, material description and quantity.
    I want to also invlude the info Unit Price and Total price on the table line, but can't seem to do it.
    I know that someone I must fill an internal table as I did on the Table itself : is_bil_invoice-it_gen INTO wa_ITGEN.
                     ( TYPE IBBIL_INVOICE).
    So now I need to insert:
    IS_BIL_INVOICE-IT_PRICE    INTO      WA_ITPRICE.
    Do I insert Program Lines, or do it via a LOOP.  Obviously it needs to go under the same Table's cells to incluce it.
    I tried a LOOP, Program lines under the CELL of the table where I want it displayed, and even a Second table.
    If I have the first table's info, the page displays under VF03, but as soon as I try to insert the 2nd Table's info, under VF03 the screen just not show anymore.
    Please help - I've started looking at local maps for bridges... yes, to jump from...

    Hi try this,
    in the program lines fetch unit price and total price based on ur invoice number(as u are already in main loop which fetches invoice no material no etc).
    now loop that internal table with condition inv no = current invoice no and item no = item number
    and display those values on a new text field accordingly.
    sample code...
    select vbeln
           posnr
           j_3asize
           FKIMG
           KZWI1
           from vbrp
           into table itab
           where vbeln = GS_IT_GEN-BIL_NUMBER.
    loop at itab into wa where vbeln = GS_IT_GEN-BIL_NUMBER and
                               posnr = GS_IT_GEN-ITM_NUMBER .
    move : wa-j_3asize to v_grid,
           WA-FKIMG TO V_QTY,
           wa-KZWI1 to v_val.
           v_up = v_val / v_qty.
    endloop.---->like this

  • SELECT-OPTIONS can u use it to read internal table ?????

    Hello All,
       I am trying to read an internal table with the select-options statement. I am getting a syntax error so i am hoping i am just coding it incorrectly. Can someone tell me what is wrong here is the if statement :
    if p_begdte in t_rpt-datab and
           p_enddte in t_rpt-datbi.
        else.
           exit.
        endif.
    thanks scott

    This is not working?
    tables: a916.
    * Beg valid date *
    data text021(29).
    selection-screen begin of line.
    selection-screen comment 1(30) text-021 for field p_begdte.
    selection-screen position 32.
    select-options: p_begdte for a916-datab default '20041101' to
    '99991231'.
    selection-screen end of line.
    * End valid date *
    data text022(29).
    selection-screen begin of line.
    selection-screen comment 1(30) text-022 for field p_enddte.
    selection-screen position 32.
    select-options: p_enddte for a916-datbi default '20041101' to
    '99991231'.
    selection-screen end of line.
    start-of-selection.
    <b>Loop at t_rpt.
    if t_rpt-datab in p_begdte
      and t_rpt-datbi in p_endte.
    * do something
    else.
    exit.
    endif
    Endloop.</b>
    Regards,
    Rich Heilman

  • Performing a Select Using 'IN' with an Internal Table

    Hello
    I defined an internal table called tempbeh. I am able to fill the table with values.
    However, I do get an error with the second select. There is a problem with the code snippet
    AND   beh_unique_id NOT IN tempbeh..
    I am being told that the row structure of the table tempbeh is not correct.
    I do NOT get any errors when I remove the code
    AND   beh_unique_id NOT IN tempbeh.
    Any ideas........    I'd do a prayer if somebody could help, and make me understand why I get an error in the first place.
    Thank you very much....Robert
    Here is the code:
    DATA: BEGIN OF tempbeh OCCURS 1,
            beh like zwopti_bv_out-BEH_UNIQUE_ID,
          END OF tempbeh.
    SELECT beh_unique_id FROM zwopti_bv_out
          INTO tempbeh
          WHERE udate IN s_dat.
          APPEND tempbeh.
        ENDSELECT.
    SELECT
        zw~beh_unique_id zw~udate
        zw~utime zw~longitude zw~latitude
        zw~process zw~state zw~hint_nr
        zw~hint_txt zw~anl_unique_id
        zw~stp_unique_id zw~ordernr
        zw~order_laufnr zw~aedat
        zw~zztransp_nr
        zw~adrkey z5~tournr
        z10~abfallart
        z5~rmnr
        zwopti_eapos_in~sequence
        equi~zzgroesse
        zws09~behkennung
        zws09~beschreib
        FROM zwopti_bv_out AS zw
        Inner JOIN zwt05 AS z5 ON zw~ordernr = z5~tourid
        LEFT OUTER JOIN zwt10 AS z10
        ON zw~ordernr = z10~tourid AND zw~order_laufnr = z10~tourelemnr
        LEFT OUTER JOIN zwopti_eapos_in
        ON zw~quell_key = zwopti_eapos_in~quell_key
        INNER JOIN equi ON zw~beh_unique_id = equi~equnr
        INNER JOIN zws09 ON equi~zzfatyp = zws09~behkennung
          INTO  TABLE lt_bv_out
          WHERE beh_unique_id     IN s_sernr
          AND   equi~zzgroesse    IN s_behgr
          AND   zw~zztransp_nr    IN s_tid
          AND   stp_unique_id     IN s_stpl
          AND   zw~adrkey         IN x_adrkey
          AND   z5~tournr         IN s_tour
          AND   zw~hint_nr        IN s_hint
          AND   zws09~behkennung  IN s_behart
          AND   beh_unique_id NOT IN tempbeh.

    Hi,
    Try like this....
    ranges : r_tempbeh for <tablename>-beh_unique_id.
    r_tempbeh-sign = 'I'.
    r_tempbeh-option = 'EQ'.
    SELECT beh_unique_id FROM zwopti_bv_out
          INTO tempbeh
          WHERE udate IN s_dat.
          APPEND tempbeh.
              r_tempbeh-LOW = beh_unique_id .
      APPEND R_TEMPBEH.
        ENDSELECT.
    SELECT
        zwbeh_unique_id zwudate
        zwutime zwlongitude zw~latitude
        zwprocess zwstate zw~hint_nr
        zwhint_txt zwanl_unique_id
        zwstp_unique_id zwordernr
        zworder_laufnr zwaedat
        zw~zztransp_nr
        zwadrkey z5tournr
        z10~abfallart
        z5~rmnr
        zwopti_eapos_in~sequence
        equi~zzgroesse
        zws09~behkennung
        zws09~beschreib
        FROM zwopti_bv_out AS zw
        Inner JOIN zwt05 AS z5 ON zwordernr = z5tourid
        LEFT OUTER JOIN zwt10 AS z10
        ON zwordernr = z10tourid AND zworder_laufnr = z10tourelemnr
        LEFT OUTER JOIN zwopti_eapos_in
        ON zwquell_key = zwopti_eapos_inquell_key
        INNER JOIN equi ON zwbeh_unique_id = equiequnr
        INNER JOIN zws09 ON equizzfatyp = zws09behkennung
          INTO  TABLE lt_bv_out
          WHERE beh_unique_id     IN s_sernr
          AND   equi~zzgroesse    IN s_behgr
          AND   zw~zztransp_nr    IN s_tid
          AND   stp_unique_id     IN s_stpl
          AND   zw~adrkey         IN x_adrkey
          AND   z5~tournr         IN s_tour
          AND   zw~hint_nr        IN s_hint
          AND   zws09~behkennung  IN s_behart.
    DELETE LV_BV_OUT WHERE beh_unique_id    NOT IN R_TEMPBEH.
    Regards,
    Nagaraj

  • Why using workarea for internal table is better in performance

    Please tell me
    why using workarea for internal table is better in performance

    Hi Vineet ,
      Why would we choose to use an internal table without a header line when it is easier to code one  with a header line?
    it has following reason.
    1)Separate Internal Table Work Area:
         The work area (staging area) defined for the internal table   is not limited to use with just one internal table.
    take ex-
    Suppose you want two internal tables for EMPLOYEE – one to contain all records and one to contain only those records where country = ‘USA’.  You could create both of these internal tables without header lines and use only one work area to load data into both of them. You would append all records from the work area into the first internal table.  You would conditionally append the ‘USA’ records from the same work area into the second internal table.
    2)  Performance Issues:  Using an internal table without a header line is more efficient than one  with a header line
    3) Nested Internal Tables:  If you want to include an internal table within a structure or another   internal table, you must use one without a header line.
    If this one is helpful ,then rewards me
    Regards
    Shambhu

  • How to use the internal table of the submitted program

    Hi,
    In the main program i have submitted a program and that program is running  successfully and data is populated in to it_final, now i want to use this data populated internal table it_final in my main program.
    Thanks,
    Sudhakar.

    Hi,Mathew,
    *& Report  ZMB51                                                       *
    REPORT  ZMB51                                   .
    DATA LIST_TAB TYPE TABLE OF ABAPLIST.
    DATA: BEGIN OF olist OCCURS 0,
            filler1(1500)   TYPE c,
          END OF olist.
    submit <b>RM07DOCS</b> EXPORTING LIST TO MEMORY
                     AND RETURN.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        LISTOBJECT = LIST_TAB
      EXCEPTIONS
        NOT_FOUND  = 1
        OTHERS     = 2.
    IF SY-SUBRC = 0.
      CALL FUNCTION 'LIST_TO_ASCI'
        EXPORTING
          LIST_INDEX         = -1
        TABLES
          LISTASCI           = oLIST
          LISTOBJECT         = LIST_TAB
        EXCEPTIONS
          EMPTY_LIST         = 1
          LIST_INDEX_INVALID = 2
          OTHERS             = 3.
    BREAK-POINT.
    write:/ sy-subrc.
    ENDIF.
    OLIST will contain the report output that you have executed but you need to tweak this internal table so that it can be used for further processing.The current example will get you MB51 output into OLIST,so change the program name to your program name at the SUBMIT statement and then try.
    K.Kiran.

Maybe you are looking for

  • Getting the page size in PDF file

    i want know how do get the page size in PDF file befor placing every page in document for example height=297 mm And width=210mm

  • Paper source section for MAC when printing

    Does Adobr Reader or any other Adobe product support "Choose paper source by PDF page size" for printing with MAC OSX 10.8.3 system?

  • Re: Another complaint ignored by BT!!

    I too have logged 2 complaints with nothing done BT is very ignorant and rude and tell so many lies i am also fed up with them and would never recommend them to anyone x

  • O'Caml and ledit

    I installed ocaml on my Arch system and quickly discovered that when I tried to run the interactive toplevel, the executable complained about missing ledit. Now, I know that ledit is a line editing program written in O'Caml and used by the toplevel.

  • My iphone 4s keypad is not working properly.

    Half of my iphone keypad has stopped working. Down the right hand side. I have done a complete restore and set it up as a new iphone in case it was something that i had done. Also the lock/power off button stopped working at the same time the keypad