Report in which collect statement .

report in which collect statement  is used and also its purpose.

COLLECT
Basic form
COLLECT [wa INTO] itab.
Addition
... SORTED BY f
Effect
COLLECT is used to create unique or compressed datsets. The key fields are the default key fields of the internal table itab .
If you use only COLLECT to fill an internal table, COLLECT makes sure that the internal table does not contain two entries with the same default key fields.
If, besides its default key fields, the internal table contains number fields (see also ABAP/4 number types ), the contents of these number fields are added together if the internal table already contains an entry with the same key fields.
If the default key of an internal table processed with COLLECT is blank, all the values are added up in the first table line.
If you specify wa INTO , the entry to be processed is taken from the explicitly specified work area wa . If not, it comes from the header line of the internal table itab .
After COLLECT , the system field SY-TABIX contains the index of the - existing or new - table entry with default key fields which match those of the entry to be processed.
Notes
COLLECT can create unique or compressed datasets and should be used precisely for this purpose. If uniqueness or compression are unimportant, or two values with identical default key field values could not possibly occur in your particular task, you should use APPEND instead. However, for a unique or compressed dataset which is also efficient, COLLECT is the statement to use.
If you process a table with COLLECT , you should also use COLLECT to fill it. Only by doing this can you guarantee that
the internal table will actually be unique or compressed, as described above and
COLLECT will run very efficiently.
If you use COLLECT with an explicitly specified work area, it must be compatible with the line type of the internal table.
Example
Compressed sales figures for each company
DATA: BEGIN OF COMPANIES OCCURS 10,
NAME(20),
SALES TYPE I,
END OF COMPANIES.
COMPANIES-NAME = 'Duck'. COMPANIES-SALES = 10.
COLLECT COMPANIES.
COMPANIES-NAME = 'Tiger'. COMPANIES-SALES = 20.
COLLECT COMPANIES.
COMPANIES-NAME = 'Duck'. COMPANIES-SALES = 30.
COLLECT COMPANIES.
The table COMPANIES now has the following appearance:
NAME SALES
Duck 40
Tiger 20
Addition
... SORTED BY f
Effect
COLLECT ... SORTED BY f is obsolete and should no longer be used. Use APPEND ... SORTED BY f which has the same meaning.
Note
Performance
The cost of a COLLECT in terms of performance increases with the width of the default key needed in the search for table entries and the number of numeric fields with values which have to be added up, if an entry is found in the internal table to match the default key fields.
If no such entry is found, the cost is reduced to that required to append a new entry to the end of the table.
A COLLECT statement used on a table which is 100 bytes wide and has a key which is 60 bytes wide and seven numeric fields is about approx. 50 msn (standardized microseconds).
Note
Runtime errors
COLLECT_OVERFLOW : Overflow in integer field when calculating totals.
COLLECT_OVERFLOW_TYPE_P : Overflow in type P field when calculating totals.

Similar Messages

  • Regarding collect statement - Production report

    Dear Experts,
    I've the following requirement
    A ) I'm creating a ALV report from Z table where i want the summary of the qty across different processing type like CT , ST , WS  & FG .
    B ) For each processing types i want the total qty to be displayed in different columns.
    C ) When i'm trying to execute , no data is displaying..
    Piece of coding is as below..  Request help to clear the below issue..
    REPORT  ZPP_PRD_REPORT.
    TABLES : ZPP_ACTUAL_PRD.
    TYPES : BEGIN OF TY_ACTUAL_PRD,
             KDAUF TYPE KDAUF,
             KDPOS TYPE KDPOS,
             WERKS TYPE WERKS_D,
             PROCTYP TYPE ZDE_PP_PROCTYP,
             AUFNR TYPE AUFNR,
             MEINS TYPE MEINS,
       END OF TY_ACTUAL_PRD.
       TYPES : BEGIN OF TY_FINAL,
             KDAUF TYPE KDAUF,
             KDPOS TYPE KDPOS,
             WERKS TYPE WERKS_D,
             PROCTYP TYPE ZDE_PP_PROCTYP,
             AUFNR TYPE AUFNR,
             MEINS TYPE MEINS,
         END OF TY_FINAL.
       DATA : GT_ACTUAL_PRD TYPE TABLE OF TY_ACTUAL_PRD,
              GS_ACTUAL_PRD TYPE TY_ACTUAL_PRD,
              GT_ACTUAL_PRD_COLLECT TYPE TABLE OF TY_ACTUAL_PRD.
       DATA : GT_FINAL TYPE TABLE OF TY_FINAL,
              GS_FINAL TYPE TY_FINAL.
        DATA : GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
               GS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
          DATA : GT_EVENTS TYPE SLIS_T_EVENT.
           DATA : GD_LAYOUT TYPE SLIS_LAYOUT_ALV.
           DATA : GS_REPID LIKE SY-REPID.
      SELECT-OPTIONS : S_KDAUF FOR ZPP_ACTUAL_PRD-KDAUF,
                        S_KDPOS FOR ZPP_ACTUAL_PRD-KDPOS.
      START-OF-SELECTION.
                     PERFORM GET_DATA.
                     PERFORM POPULATE_DATA1.
    *&      Form  GET_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM GET_DATA .
       SELECT
              KDAUF
              KDPOS
              WERKS
              PROCTYP
              AUFNR
              MEINS
    FROM ZPP_ACTUAL_PRD INTO TABLE GT_ACTUAL_PRD WHERE KDAUF IN S_KDAUF AND
                                                  KDPOS IN S_KDPOS.
    ENDFORM.                    " GET_DATA
    *&      Form  POPULATE_DATA1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM POPULATE_DATA1 .
       LOOP AT GT_ACTUAL_PRD INTO GS_ACTUAL_PRD.
         GS_FINAL-KDAUF = GS_ACTUAL_PRD-KDAUF.
         GS_FINAL-KDPOS = GS_ACTUAL_PRD-KDPOS.
         GS_FINAL-WERKS = GS_ACTUAL_PRD-WERKS.
         GS_FINAL-PROCTYP = GS_ACTUAL_PRD-PROCTYP.
         GS_FINAL-AUFNR = GS_ACTUAL_PRD-AUFNR.
         GS_FINAL-MEINS = GS_ACTUAL_PRD-MEINS.
       COLLECT GS_ACTUAL_PRD INTO GT_ACTUAL_PRD_COLLECT.
    ENDLOOP.
    ENDFORM.                    " POPULATE_DATA1
    *&      Form  BUILD_FIELDCATALOG
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM BUILD_FIELDCATALOG .
       GS_FIELDCAT-FIELDNAME = 'KDAUF'.
       GS_FIELDCAT-SELTEXT_M = 'SALESORDER'.
       GS_FIELDCAT-OUTPUTLEN = 10.
       GS_FIELDCAT-DO_SUM = 'X'.
       GS_FIELDCAT-NO_ZERO = 'X'.
       APPEND GS_FIELDCAT TO GT_FIELDCAT.
       CLEAR GS_FIELDCAT.
       GS_FIELDCAT-FIELDNAME = 'KDPOS'.
       GS_FIELDCAT-SELTEXT_M = 'SALESITEM'.
       GS_FIELDCAT-OUTPUTLEN = 10.
       GS_FIELDCAT-DO_SUM = 'X'.
       GS_FIELDCAT-NO_ZERO = 'X'.
       APPEND GS_FIELDCAT TO GT_FIELDCAT.
       CLEAR GS_FIELDCAT.
       GS_FIELDCAT-FIELDNAME = 'WERKS'.
       GS_FIELDCAT-SELTEXT_M = 'PLANT'.
       GS_FIELDCAT-OUTPUTLEN = 10.
       GS_FIELDCAT-DO_SUM = 'X'.
       GS_FIELDCAT-NO_ZERO = 'X'.
       APPEND GS_FIELDCAT TO GT_FIELDCAT.
       CLEAR GS_FIELDCAT.
       GS_FIELDCAT-FIELDNAME = 'PROCTYP'.
       GS_FIELDCAT-SELTEXT_M = 'TYPE'.
       GS_FIELDCAT-OUTPUTLEN = 10.
       GS_FIELDCAT-DO_SUM = 'X'.
       GS_FIELDCAT-NO_ZERO = 'X'.
       APPEND GS_FIELDCAT TO GT_FIELDCAT.
       CLEAR GS_FIELDCAT.
    GS_FIELDCAT-FIELDNAME = 'AUFNR'.
       GS_FIELDCAT-SELTEXT_M = 'ORDER'.
       GS_FIELDCAT-OUTPUTLEN = 10.
       GS_FIELDCAT-DO_SUM = 'X'.
       GS_FIELDCAT-NO_ZERO = 'X'.
       APPEND GS_FIELDCAT TO GT_FIELDCAT.
       CLEAR GS_FIELDCAT.
       GS_FIELDCAT-FIELDNAME = 'MENGE'.
       GS_FIELDCAT-SELTEXT_M = 'QTY'.
       GS_FIELDCAT-OUTPUTLEN = 10.
       GS_FIELDCAT-DO_SUM = 'X'.
       GS_FIELDCAT-NO_ZERO = 'X'.
       APPEND GS_FIELDCAT TO GT_FIELDCAT.
       CLEAR GS_FIELDCAT.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  ALV_DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM ALV_DISPLAY .
       GS_REPID = SY-REPID.
       IF GS_REPID IS NOT INITIAL.
         CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
             I_CALLBACK_PROGRAM = GS_REPID
             IT_FIELDCAT        = GT_FIELDCAT[]
             IT_EVENTS          = GT_EVENTS[]
             I_SAVE             = 'A'
             I_DEFAULT          = 'X'
           TABLES
             T_OUTTAB           = GT_ACTUAL_PRD_COLLECT
           EXCEPTIONS
             PROGRAM_ERROR      = 1
             OTHERS             = 2.
         IF SY-SUBRC <> 0.
           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
       ENDIF.
    ENDFORM.                    " ALV_DISPLAY
    Z Data base table looks as below..
    Best rgds/thnks,
    Srikanth.

    Hi  Sankara ,
        Collect statement is used to add all the numeric components to the corresponding values of all the existing rows in an internal table , with the same key . The data type can be I , P , F .
        Please ensure that there is a comman value  in all the rows .
       check this out and let me know if any issues
    Regards,
    Kavitha

  • About Collect Statement.

    hi experts,
         i am genereating a report in FICO module. i have to fetch teh data from the field DMBTR (AMOUNT). it has both credits anddebits. i have to do calculations and should display the final balance in the report. each GL account number has different credits and debits. i have to display each account with the balance. if i am using collect statement it only making sum of eitehr debits or credits. i want both to be sum up. is tehre any other way to do the same..thnx in advance,
                                   santosh.

    Syntax Diagram
    COLLECT
    Syntax
    COLLECT wa INTO itab [result].
    Effect
    This statement inserts the contents of a work area wa either as single row into an internal table itab or adds the values of its numeric components to the corresponding values of existing rows with the same key. As of Release 6.10, you can use result to set a reference to the inserted or changed row in the form of a field symbol or data reference.
    Prerequisite for the use of this statement is that wa is compatible with the row type of itab and all components that are not part of the table key must have a numeric data type (i, p, f).
    In standard tables that are only filled using COLLECT, the entry is determined by a temporarily created hash administration. The workload is independent of the number of entries in the table. The hash administration is temporary and is generally invalidated when the table is accessed for changing. If further COLLECT statements are entered after an invalidation, a linear search of all table rows is performed. The workload for this search increases in a linear fashion in relation to the number of entries.
    In sorted tables, the entry is determined using a binary search. The workload has a logarithmic relationship to the number of entries in the table.
    In hashed tables, the entry is determined using the hash administration of the table and is always independent of the number of table entries.
    If no line is found with an identical key, a row is inserted as described below, and filled with the content of wa:
    In standard tables the line is appended.
    In sorted tables, the new line is inserted in the sort sequence of the internal table according to its key values, and the table index of subsequent rows is increased by 1.
    In hashed tables, the new row is inserted into the internal table by the hash administration, according to its key values.
    If the internal table already contains one or more rows with an identical key, those values of the components of work area wa that are not part of the key, are added to the corresponding components of the uppermost existing row (in the case of index tables, this is the row with the lowest table index).
    The COLLECT statement sets sy-tabix to the table index of the inserted or existing row, in the case of standard tables and sorted tables, and to the value 0 in the case of hashed tables.
    Outside of classes, you can omit wa INTO if the internal table has an identically-named header line itab. The statement then implicitly uses the header line as the work area.
    COLLECT should only be used if you want to create an internal table that is genuinely unique or compressed. In this case, COLLECT can greatly benefit performance. If uniqueness or compression are not required, or the uniqueness is guaranteed for other reasons, the INSERT statement should be used instead.
    The use of COLLECT for standard tables is obsolete. COLLECT should primarily be used for hashed tables, as these have a unique table key and a stable hash administration.
    If a standard table is filled using COLLECT, it should not be edited using any other statement with the exception of MODIFY. If the latter is used with the addition TRANSPORTING, you must ensure that no key fields are changed. This is the only way to guarantee that the table entries are always unique and compressed, and that the COLLECT statement functions correctly and benefits performance. The function module ABL_TABLE_HASH_STATE can be used to check whether a standard table is suitable for editing using COLLECT.
    Example
    Compressed insertion of data from the database table sflight into the internal table seats_tab. The rows in which the key components carrid and connid are identical are compressed by adding the number of occupied seats to the numeric component seatsocc.
    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.
    Exceptions
    Catchable Exceptions
    CX_SY_ARITHMETIC_OVERFLOW
    Cause: Overflow in integer field during totals formation
    Runtime Error: COLLECT_OVERFLOW
    Cause: Overflow in type p field during totals formation
    Runtime Error: COLLECT_OVERFLOW_TYPE_P
    Non-Catchable Exceptions
    Cause: COLLECT used for non-numeric fields
    Runtime Error: TABLE_COLLECT_CHAR_IN_FUNCTION

  • Customer Collection Statement

    Hi All
    I need to some help with Customer Collection statement , I need this field to display the DOC REF NO in column 2 and not BP REF NO.
    Which field must I display in order to display the invoice number or credit note number related to a particular line on the statement lines.
    Thanks
    Bongani Dlamini

    Hi Bongani Dlamini,
    This PLD is one of the hard coded one.  There is no option for you to customize it.  You need to create your own report by a reporting tool instead.
    Thanks,
    Gordon

  • Problem in collect statement

    Hi,
    i have requirement to get all unique entries from table .if i am getting duplicate record then i need to add qunatity field which i have define like rlbes-anfme.
    my internal table is :
    11 name1 23.00
    22 name2 1,324.00
    11 name1 10.00
    I want output in this way
    11 name1  33.00
    22 name2 1,324.00
    i tried to use collect statement but the problem is its not working on character type field.
    if  i use packed field then i am not able to upload my file because i am getting quantity filed 1,2344.00 this way.( instead of 1325.00)
    please give me any solution.
    thanks,
    jack

    Hi,
    Try this..
    Create another internal table which has the same structure of your internal table.
    DATA: LT_COLLECT LIKE ITAB OCCURS 0 WITH HEADER LINE.
    DATA: V_QUANTITY TYPE MENGE_D.
    Sort the internal table.
    SORT ITAB BY field1 field2.    " Give the appropriate field names.
    <b>* process the internal table which has the records.</b>
    LOOP AT ITAB.
    Sum up the quantity.
       V_MENGE = V_MENGE + ITAB-ANFME.  " Quantity field.
    Move the first two fields.
       LT_COLLECT-FIELD1 = ITAB-FIELD1. 
       LT_COLLECT-FIELD2 = ITAB-FIELD2.
    At the end of the record..append the record.
       AT END OF FIELD2.     " Give the corresponding field name.
          LT_COLLECT-ANFME = V_MENGE.
          APPEND LT_COLLECT.
         CLEAR: V_MENGE.
       ENDAT.  
    ENDLOOP.
    Thanks,
    Naren

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

  • Report in which i have to run bdc and do changes

    Hi ABAP Gurus,
                          my requirement is i have to develop report in which i need to have 2 radiobuttons if i select first radiobutton my program should run Report and if i select second radiobutton it should run va02 and make some changes (i.e, it should change delivery quantity is equal to orderquantity.
    i wrote program to display the report but what i want is now i have to do recording in va02 tr.code and write the logic in my developed program.and below is my program .
    TYPE-POOLS : slis.
    TABLES : vbak,vbap.
    TYPES : BEGIN OF t_vbak,
            vbeln TYPE vbak-vbeln,
            audat TYPE vbak-audat,
            vbtyp TYPE vbak-vbtyp,
            END OF t_vbak.
    TYPES : BEGIN OF t_vbap,
            vbeln TYPE vbap-vbeln,
            posnr TYPE vbap-posnr,
            arktx TYPE vbap-arktx,
            kwmeng TYPE vbap-kwmeng,
            lsmeng TYPE vbap-lsmeng,
            END OF t_vbap .
    DATA : BEGIN OF it_final OCCURS 0,
          vbeln LIKE zstru_final1-vbeln,
          posnr LIKE zstru_final1-posnr,
          audat LIKE zstru_final1-audat,
          vbtyp LIKE zstru_final1-vbtyp,
          arktx LIKE zstru_final1-arktx,
          kwmeng LIKE zstru_final1-kwmeng,
          lsmeng LIKE zstru_final1-lsmeng,
          bal LIKE zstru_final1-bal,
          END OF it_final.
    DATA : it_vbak TYPE TABLE OF t_vbak,
           wa_vbak TYPE t_vbak,
           it_vbap TYPE TABLE OF t_vbap,
           wa_vbap TYPE t_vbap.
    DATA : it_fieldcat   TYPE  slis_t_fieldcat_alv,
           ls_fieldcat   TYPE  slis_fieldcat_alv,
           ls_repid TYPE sy-repid,
           gs_layout   TYPE lvc_s_layo,
           l_variant   TYPE  disvariant.
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
                    s_audat FOR vbak-audat,
                    s_vbtyp FOR vbak-vbtyp.
    SELECTION-SCREEN : END OF BLOCK b1.
    SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS:      rb1 TYPE c RADIOBUTTON GROUP g1,
                     rb2 TYPE c RADIOBUTTON GROUP g1.
    SELECTION-SCREEN : END OF BLOCK b2.
    START-OF-SELECTION.
      ls_repid = sy-repid.
      SELECT vbeln audat vbtyp FROM vbak INTO TABLE it_vbak
                                        WHERE vbeln IN s_vbeln
                                        AND   audat IN s_audat
                                        AND   vbtyp IN s_vbtyp.
      IF it_vbak[] IS NOT INITIAL.
        SELECT vbeln posnr arktx kwmeng lsmeng FROM vbap
            INTO TABLE it_vbap  FOR ALL ENTRIES IN it_vbak
                                    WHERE vbeln EQ it_vbak-vbeln.
      ENDIF.
      LOOP AT it_vbap INTO wa_vbap.
        it_final-posnr = wa_vbap-posnr.
        it_final-arktx = wa_vbap-arktx.
        it_final-kwmeng = wa_vbap-kwmeng.
        it_final-lsmeng = wa_vbap-lsmeng.
        it_final-bal = wa_vbap-kwmeng - wa_vbap-lsmeng.
        READ TABLE it_vbak INTO wa_vbak
                       WITH KEY vbeln = wa_vbap-vbeln.
        IF sy-subrc IS INITIAL.
          it_final-vbeln = wa_vbak-vbeln.
          it_final-audat = wa_vbak-audat.
          it_final-vbtyp = wa_vbak-vbtyp.
        ENDIF.
        COLLECT it_final.
      ENDLOOP.
      IF rb1 = 'X'.
        CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
          EXPORTING
            i_program_name         = ls_repid
            i_internal_tabname     = 'IT_FINAL'
            i_inclname             = ls_repid
          CHANGING
            ct_fieldcat            = it_fieldcat
          EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program = ls_repid
            it_fieldcat        = it_fieldcat
          TABLES
            t_outtab           = it_final
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ELSE.
      ENDIF.
      please help me out .
    thanks in advance.

    hi,
    Please find code :
    REPORT zag_va02
           NO STANDARD PAGE HEADING LINE-SIZE 255.
           TABLES : vbak,vbap.
    DATA:BEGIN OF t_vbak OCCURS 0.
            INCLUDE STRUCTURE vbak.
    DATA:END OF t_vbak.
    DATA:BEGIN OF t_vbkd OCCURS 0.
            INCLUDE STRUCTURE vbkd.
    DATA:END OF t_vbkd.
    DATA:   bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.
          messages of call transaction
    DATA:   messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
    tYPES : BEGIN OF t_vbak,
    vbeln TYPE vbak-vbeln,
    audat TYPE vbak-audat,
    vbtyp TYPE vbak-vbtyp,
    END OF t_vbak.
    TYPES : BEGIN OF t_vbap,
    vbeln TYPE vbap-vbeln,
    posnr TYPE vbap-posnr,
    arktx TYPE vbap-arktx,
    kwmeng TYPE vbap-kwmeng,
    lsmeng TYPE vbap-lsmeng,
    END OF t_vbap .
    DATA : BEGIN OF it_final OCCURS 0,
    vbeln LIKE vbap-vbeln,
    posnr LIKE vbap-posnr,
    audat LIKE vbak-audat,
    vbtyp LIKE vbak-vbtyp,
    arktx LIKE vbap-arktx,
    kwmeng LIKE vbap-kwmeng,
    lsmeng LIKE vbap-lsmeng,
    *bal LIKE zstru_final1-bal,
    END OF it_final.
    DATA : it_vbak TYPE TABLE OF t_vbak,
    wa_vbak TYPE t_vbak,
    it_vbap TYPE TABLE OF t_vbap,
    wa_vbap TYPE t_vbap.
    *DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
    *ls_fieldcat TYPE slis_fieldcat_alv,
    *ls_repid TYPE sy-repid,
    *gs_layout TYPE lvc_s_layo,
    *l_variant TYPE disvariant.
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
    s_audat FOR vbak-audat,
    s_vbtyp FOR vbak-vbtyp.
    SELECTION-SCREEN : END OF BLOCK b1.
    SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS: rb1 TYPE c RADIOBUTTON GROUP g1,
    rb2 TYPE c RADIOBUTTON GROUP g1.
    SELECTION-SCREEN : END OF BLOCK b2.
    START-OF-SELECTION.
    *ls_repid = sy-repid.
    SELECT vbeln audat vbtyp FROM vbak INTO TABLE it_vbak
    WHERE vbeln IN s_vbeln
    AND audat IN s_audat
    AND vbtyp IN s_vbtyp.
    IF it_vbak[] IS NOT INITIAL.
    SELECT vbeln posnr arktx kwmeng lsmeng FROM vbap
    INTO TABLE it_vbap FOR ALL ENTRIES IN it_vbak
    WHERE vbeln EQ it_vbak-vbeln.
    ENDIF.
    LOOP AT it_vbap INTO wa_vbap.
    it_final-posnr = wa_vbap-posnr.
    it_final-arktx = wa_vbap-arktx.
    it_final-kwmeng = wa_vbap-kwmeng.
    it_final-lsmeng = wa_vbap-lsmeng.
    *it_final-bal = wa_vbap-kwmeng - wa_vbap-lsmeng.
    READ TABLE it_vbak INTO wa_vbak
    WITH KEY vbeln = wa_vbap-vbeln.
    IF sy-subrc IS INITIAL.
    it_final-vbeln = wa_vbak-vbeln.
    it_final-audat = wa_vbak-audat.
    it_final-vbtyp = wa_vbak-vbtyp.
    ENDIF.
    COLLECT it_final.
    ENDLOOP.
    IF rb1 = 'X'.
    loop at it_final.
    PERFORM bdc_dynpro      USING 'SAPMV45A' '0102'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'VBAK-VBELN'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM bdc_field       USING 'VBAK-VBELN'
                                    it_final-vbeln.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '4001'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=SICH'.
      PERFORM bdc_field       USING 'VBKD-BSTKD'
                                    'test ZDOR'.
      PERFORM bdc_field       USING 'KUAGV-KUNNR'
                                    '8000000303'.
      PERFORM bdc_field       USING 'KUWEV-KUNNR'
                                    '8000000303'.
      PERFORM bdc_field       USING 'RV45A-KETDAT'
                                    it_final-audat.
      PERFORM bdc_field       USING 'RV45A-KPRGBZ'
                                    'D'.
      PERFORM bdc_field       USING 'VBKD-PRSDT'
                                    it_final-audat.
      PERFORM bdc_field       USING 'VBKD-ZTERM'
                                    '0002'.
      PERFORM bdc_field       USING 'VBKD-INCO1'
                                    'FOB'.
      PERFORM bdc_field       USING 'VBKD-INCO2'
                                    'Mumbai'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RV45A-KWMENG(01)'.
      PERFORM bdc_field       USING 'RV45A-KWMENG(01)'
                                    '                  5'.
    PERFORM bdc_transaction USING 'VA02'.
    REFRESH MESSTAB.
        CALL TRANSACTION 'VA02' USING BDCDATA
                         MODE   'A'
                         UPDATE 'A'
                         MESSAGES INTO MESSTAB.
                         endloop.
    ENDIF.
    *&      Form  BDC_DYNPRO
          text
         -->PROGRAM    text
         -->DYNPRO     text
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    ENDFORM.                    "BDC_DYNPRO
           Insert field                                                  *
    FORM bdc_field USING fnam fval.
      IF fval <> ''.
        CLEAR bdcdata.
        bdcdata-fnam = fnam.
        bdcdata-fval = fval.
        APPEND bdcdata.
      ENDIF.
    ENDFORM.                    "BDC_FIELD
    here you cange your Kunnr and all field in recording perform in loop according to your req.
    Reward if ans .is use full
    Amit.
    Edited by: Amit Bansal on Jun 2, 2008 9:18 AM
    Edited by: Amit Bansal on Jun 2, 2008 9:19 AM

  • Hi friends i have doubt on collect statement.

    i have some problem with matnr which is repeating no.of times. so i tried using collect and selected some of the fields to collect. Now i need to collect those collected elements in to internal table and need to display those fields in an ouput. for example.
    loop at sumtab.
    matnr type s886-matnr,
    avg1 type p decimals 3,
    total type p decimals 3,
    endloop.
    and now using loop  i am collecting. these fields using my itab.
    loop at itab.
    move-corresponding itab to sumtab.
    collect sumtab.
    clear sumtab.
    endloop.
    ***here itab contains no.of other fields like qty,stock etc.
    so after here i am using ALV to display the itab.
    my problem is how to make SUMTAB fields tobe moved in itab.

    Hi Kalyan,
       The collect statement works like this . (ex)
    data: begin of itab occurs 0,
          name(10) type c,
          value(4) type n,
          end of itab.
    itab-name = 'JACK'.
    itab-value = 100.
    append itab.
    itab-name = 'PAT'.
    itab-value = 200.
    append itab.
    itab-name = 'JACK'.
    itab-value = 200.
    append itab.
    sort itab.
    loop itab.
    collect itab.
    write: / itab-name, itab-value.
    endloop.
    <b>o/p:</b>
    JACK 300
    PAT  200

  • Collect statement in a class.

    Hello,
    This is related to BW infospoke enhancement,
    in this class i have structure which is filled and i have to aggregate the data in this structure by one of the field level,
    i want to declare a internal table with header and take the data from structure into internal table and then do a collect statement on to this internal table..
    but i am getting a message that no one more header line is supported in OOPS concept..meaning i am not able to declare a internal table with header line..
    any solution to this will be awarded with points.

    Hello Shashi
    You should not use itab with header lines since they mess up any coding and are a nightmare when it comes to maintaining code.
    Fortunately, SAP has abandoned header lines from ABAP-OO. If you are not using table types then you have to define your own types, e.g.:
    TYPES: BEGIN OF ty_s_line.
    TYPES:   field_a  TYPE ... .
    TYPES:   field_b  TYPE ... .
    TYPES: END OF ty_s_line.
    TYPES: ty_t_itab  TYPE STANDARD TABLE OF ty_s_line
                      WITH DEFAULT KEY.
    DATA:
      ls_line   TYPE ty_s_line,
      lt_itab   TYPE ty_t_itab.
    * Now fill your itab, e.g.
      SELECT * FROM ... INTO CORRESPONDING FIELDS
                        OF TABLE lt_itab.
    * Now working with the itab data.
      LOOP AT lt_itab INTO ls_line.
      ENDLOOP.
    Regards
       Uwe

  • Collect Statement to group on character fields

    Hi,
    I am working on some specific requirements on a support project and found a bit scenario where there is a data in an internal table and displayed the group wise total. for which the collect statement is used.
    loop at lt_matdata into lwa_matdata.
    lwa_final-docno = lwa_matdata-docno.
    lwa_final-matnr =  lwa_matdata-matnr.
    lwa_final-puqty =  lwa_matdata-puqty.
    lwa_final-amt    = lwa_matdata-amount.
    collect lwa_final into lt_final.
    endloop.
    now the problem is i need to add RATE also to the final table. if i add the field rate to the final it will display a sum. I tried to find something that helps me adding a field RATE. Please suggest a way where i can skip the sum in collect for the specific field.
    one way is i can create an another internal table and make a read statement to display the data, but wanted to know if there is any other simple and suitable solution to this.
    Thanks,
    Janisar

    Hi,
    Run this code & get the idea for your program...
    DATA: BEGIN OF line,
            col1(3) TYPE c,
            col2(2) TYPE n,
            col3    TYPE i,
            col4    type i,
          END OF line.
    DATA itab LIKE SORTED TABLE OF line
              WITH NON-UNIQUE KEY col1 col2.
    line-col1 = 'abc'. line-col2 = '12'. line-col3 = 3.
    COLLECT line INTO itab.
    line-col4 = 12.
    modify itab from line index sy-tabix transporting col4.
    WRITE / sy-tabix.
    clear line.
    line-col1 = 'def'. line-col2 = '34'. line-col3 = 5.
    COLLECT line INTO itab.
    line-col4 = 12.
    modify itab from line index sy-tabix transporting col4.
    WRITE / sy-tabix.
    clear line.
    line-col1 = 'abc'. line-col2 = '12'. line-col3 = 7.
    COLLECT line INTO itab.
    line-col4 = 12.
    modify itab from line index sy-tabix transporting col4.
    WRITE / sy-tabix.
    clear line.
    LOOP AT itab INTO line.
      WRITE: / line-col1, line-col2, line-col3, line-col4.
    ENDLOOP.
    In your code you try this,
    loop at lt_matdata into lwa_matdata.
    lwa_final-docno = lwa_matdata-docno.
    lwa_final-matnr = lwa_matdata-matnr.
    lwa_final-puqty = lwa_matdata-puqty.
    lwa_final-amt = lwa_matdata-amount.
    collect lwa_final into lt_final.
    *  ADD THESE LINES
    lwa_final-rate = lwa_matdata-rate.
    modify it_final from lwa_final index sy-tabix transporting rate.
    clear lwa_final.
    endloop.

  • "Invalid number" error using Interactive Report search  on collection

    hi -- I have several interactive reports based on collections. In the IR reqion query definition,
    I cast the collection values as needed (number, date, etc). Everything's been working great.
    In both development and production, I can use the search feature of interactive reports
    and it finds rows containing the text I type in (as well as everything else working fine...)
    I just imported a new version of an application into our production database. Now, when I use the
    interactive report search, I always get "invalid number". This even happens on interactive reports
    that still work in the previous version of the production application... and these IRS
    have not been modified at all.
    If I create a filter and search for "elevation" in a string column, the filter works. If I create a filter
    searching for "elevation" in a number column, I get "invalid number". (In the development
    environment, I can do the latter -- it just doesn't find any rows.)
    Clearly it's choking on the types of the columns in the IR... but why now and not before, and why
    in the production database but not the development DB? Both are running 4.0.1.00.03.
    This is a pretty major loss of functionality... and it comes at a really bad time... Help?!
    Thanks,
    Carol

    hi Andy, Tony -- Completely understand about your email address. I've actually wondered at the fact that any
    of you gurus are willing to give them out.
    It's not tons of stuff, so here it is.
    1) The application process that creates the collection. This process that runs whenever an IR
    page is being rendered. The various DB names are application items. This application can affect data
    on multiple databases. You'll see see this in the process that builds the query.
    IF (apex_collection.collection_exists (      
        p_collection_name=>'IR_COLLECTION')) then
        apex_collection.delete_collection(p_collection_name=>'IR_COLLECTION');
    END IF;
    apex_collection.create_collection_from_query_b(p_collection_name=>'IR_COLLECTION', p_query=>meta_data_pkg.build_ir_collection_query(:TABLE_NAME, :MASTER_DB_NAME, :CZAR_DB_NAME, :DB_NAME));2) The database function that constructs the query. Called in the above create_collection statement.
    FUNCTION build_ir_collection_query (table_name varchar2, master_db_name varchar2, czar_db_name varchar2, ref_db_name varchar2)
    return varchar2
    IS
      query VARCHAR2(3000);
    BEGIN
      IF /* check for other table names here */ THEN
        -- build queries for other tables
       -- *** HDB_EXT_DATA_CODE
      ELSIF (upper(table_name) in ('HDB_EXT_DATA_CODE', 'HDB_EXT_DATA_CODE_SYN')) THEN
        query := 'SELECT /*+DRIVING_SITE(dcs)*/ dc.ext_data_code_sys_id, dcs.ext_data_code_sys_name, dcs.agen_id, a.agen_name, dc.primary_data_code,';
        query := query||' dc.secondary_data_code, dc.hdb_datatype_id, d.datatype_name, d.unit_id, u.unit_name, d.physical_quantity_name, to_char(dc.date_time_loaded,''DD-MON-YYYY HH24:MI:SS'')';
        query := query||' FROM hdb_ext_data_code_syn@'||master_db_name || ' dc, hdb_ext_data_code_sys_syn@'||master_db_name ||
                 ' dcs, hdb_agen_syn@'||master_db_name||' a, hdb_datatype_syn@'||master_db_name||' d, hdb_unit@'||czar_db_name||' u';
        query := query||' WHERE dc.ext_data_code_sys_id = dcs.ext_data_code_sys_id AND dcs.agen_id = a.agen_id(+) AND dc.hdb_datatype_id = d.datatype_id AND d.unit_id = u.unit_id';
       /* continue w/ other tables */
    END;3) The query that it builds for the table in question:
    SELECT /*+DRIVING_SITE(dcs)*/ dc.ext_data_code_sys_id, dcs.ext_data_code_sys_name, dcs.agen_id, a.agen_name,
    dc.primary_data_code, dc.secondary_data_code, dc.hdb_datatype_id, d.datatype_name, d.unit_id, u.unit_name,
    d.physical_quantity_name, to_char(dc.date_time_loaded,'DD-MON-YYYY HH24:MI:SS')
    FROM hdb_ext_data_code_syn@UCHDB2 dc,  hdb_ext_data_code_sys_syn@UCHDB2 dcs, hdb_agen_syn@UCHDB2 a,
    hdb_datatype_syn@UCHDB2 d, hdb_unit@UCHDB2 u
    WHERE dc.ext_data_code_sys_id = dcs.ext_data_code_sys_id AND dcs.agen_id = a.agen_id(+)
    AND dc.hdb_datatype_id = d.datatype_id AND d.unit_id = u.unit_id           4) The explain plan results on the development database
    PLAN_TABLE_OUTPUT                                                                                  
    Plan hash value: 583729845                                                                         
    | Id  | Operation                       | Name                  | Rows  | Bytes | Cost (%CPU)| Time
        | Inst   |                                                                                     
    |   0 | SELECT STATEMENT REMOTE         |                       |    97 | 16490 |    19  (16)| 00:00
    :01 |        |                                                                                     
    |*  1 |  HASH JOIN                      |                       |    97 | 16490 |    19  (16)| 00:00
    :01 |        |                                                                                     
    |   2 |   TABLE ACCESS FULL             | HDB_UNIT              |   177 |  3540 |     3   (0)| 00:00
    :01 | UCHDB2 |                                                                                     
    |*  3 |   HASH JOIN RIGHT OUTER         |                       |    95 | 14250 |    15  (14)| 00:00
    :01 |        |                                                                                     
    |   4 |    TABLE ACCESS FULL            | HDB_AGEN              |    54 |  1944 |     3   (0)| 00:00
    :01 | UCHDB2 |                                                                                     
    |*  5 |    HASH JOIN                    |                       |    95 | 10830 |    12  (17)| 00:00
    :01 |        |                                                                                     
    |   6 |     MERGE JOIN                  |                       |   112 |  5936 |     6  (17)| 00:00
    :01 |        |                                                                                     
    |   7 |      TABLE ACCESS BY INDEX ROWID| HDB_EXT_DATA_CODE_SYS |    15 |   405 |     2   (0)| 00:00
    :01 | UCHDB2 |                                                                                     
    |   8 |       INDEX FULL SCAN           | HDB_EXT_DATA_CODE_SYS |    15 |       |     1   (0)| 00:00
    :01 | UCHDB2 |                                                                                     
    |*  9 |      SORT JOIN                  |                       |   112 |  2912 |     4  (25)| 00:00
    :01 |        |                                                                                     
    |  10 |       TABLE ACCESS FULL         | HDB_EXT_DATA_CODE     |   112 |  2912 |     3   (0)| 00:00
    :01 | UCHDB2 |                                                                                     
    |  11 |     TABLE ACCESS FULL           | HDB_DATATYPE          |   711 | 43371 |     5   (0)| 00:00
    :01 | UCHDB2 |                                                                                     
    Predicate Information (identified by operation id):                                                
       1 - access("A2"."UNIT_ID"="A1"."UNIT_ID")                                                       
       3 - access("A4"."AGEN_ID"="A3"."AGEN_ID"(+))                                                    
       5 - access("A5"."HDB_DATATYPE_ID"="A2"."DATATYPE_ID")                                           
       9 - access("A5"."EXT_DATA_CODE_SYS_ID"="A4"."EXT_DATA_CODE_SYS_ID")                             
           filter("A5"."EXT_DATA_CODE_SYS_ID"="A4"."EXT_DATA_CODE_SYS_ID")                             
    Note                                                                                               
       - fully remote statement                                                                         5) The explain plan results on the production database
    PLAN_TABLE_OUTPUT                                                                                                                                                                  
    Plan hash value: 583729845                                                                                                                                                         
    | Id  | Operation                       | Name                  | Rows  | Bytes | Cost (%CPU)| Time     |                                                                          
    |   0 | SELECT STATEMENT                |                       |    97 | 16490 |    19  (16)| 00:00:01 |                                                                          
    |*  1 |  HASH JOIN                      |                       |    97 | 16490 |    19  (16)| 00:00:01 |                                                                          
    |   2 |   TABLE ACCESS FULL             | HDB_UNIT              |   177 |  3540 |     3   (0)| 00:00:01 |                                                                          
    |*  3 |   HASH JOIN RIGHT OUTER         |                       |    95 | 14250 |    15  (14)| 00:00:01 |                                                                          
    |   4 |    TABLE ACCESS FULL            | HDB_AGEN              |    54 |  1944 |     3   (0)| 00:00:01 |                                                                          
    |*  5 |    HASH JOIN                    |                       |    95 | 10830 |    12  (17)| 00:00:01 |                                                                          
    |   6 |     MERGE JOIN                  |                       |   112 |  5936 |     6  (17)| 00:00:01 |                                                                          
    |   7 |      TABLE ACCESS BY INDEX ROWID| HDB_EXT_DATA_CODE_SYS |    15 |   405 |     2   (0)| 00:00:01 |                                                                          
    |   8 |       INDEX FULL SCAN           | HDB_EXT_DATA_CODE_SYS |    15 |       |     1   (0)| 00:00:01 |                                                                          
    |*  9 |      SORT JOIN                  |                       |   112 |  2912 |     4  (25)| 00:00:01 |                                                                          
    |  10 |       TABLE ACCESS FULL         | HDB_EXT_DATA_CODE     |   112 |  2912 |     3   (0)| 00:00:01 |                                                                          
    |  11 |     TABLE ACCESS FULL           | HDB_DATATYPE          |   711 | 43371 |     5   (0)| 00:00:01 |                                                                          
    Predicate Information (identified by operation id):                                                                                                                                
       1 - access("D"."UNIT_ID"="U"."UNIT_ID")                                                                                                                                         
       3 - access("DCS"."AGEN_ID"="A"."AGEN_ID"(+))                                                                                                                                    
       5 - access("DC"."HDB_DATATYPE_ID"="D"."DATATYPE_ID")                                                                                                                            
       9 - access("DC"."EXT_DATA_CODE_SYS_ID"="DCS"."EXT_DATA_CODE_SYS_ID")                                                                                                            
           filter("DC"."EXT_DATA_CODE_SYS_ID"="DCS"."EXT_DATA_CODE_SYS_ID")                                                                                                             6) This is the source query for the interactive report in question. The application process that creates the
    collection runs before this region is rendered.
    Select /*+ NO_QUERY_TRANSFORMATION */
    to_number(C001) Ext_Data_Code_Sys_Id,
    C002 Ext_Data_Code_Sys_Name,
    to_number(C003) Agen_Id,
    C004 Agen_Name,
    C005 Primary_Data_Code,
    C006 Secondary_Data_Code,
    to_number(C007) Hdb_Datatype_Id,
    C008 Datatype_Name,
    to_number(C009) Unit_Id,
    C010 Unit_Name,
    C011 Physical_Quantity_Name,
    C012 Date_Time_Loaded
    from apex_collections
    where collection_name = 'IR_COLLECTION'
    order by 1,5,7Well, maybe it is alot... !
    Happy New Year!
    Carol

  • ABAP-SALV Collect statement

    Hello,
    I have a header and an item table which contains customer records in the header table and line items in the item table . A Customer has many billing document and hence there are a lot line items with the same material.
    I want to use the collect statement to group all the materials and have one line item for one type of material and want to sum all the quantities of those materials and the price of the material.
    suggest the best solution for the particular scenario.
    thank you.

    Hi Rahul,
    You can consider using ABAP Tree Control feature if you are planning to use ABAP Dialog Programing. It will be very elegant and will provide you with a nice UI. Have a look at the demo codes for the functionality.
    Use the Transaction DWDM to get all the control examples. You can get more examples in SLIS Package.
    If you try using ABAP Web Dynpro   , then also you can design it in the way you want.
    Hope this will help.
    Thanks,
    Samantak.

  • Collect statement with index

    Hi
    can anyone give me some idea  how to use collect statement with index
    here in the below syntax i want to use collect instead of insert.
    INSERT WA_ALVDISPLAY   INTO IT_ALVDISPLAY  index  3 .
    thanks.
    vivekk

    hi
    my scenario is like this
    i need an yearly report of a examination held in a school based on month,each month they need report for girls and boys separately
    the output format should be like this
    month:marks( boys)  marks( girls )
    so i have created 3 internal tables suppose itab ,itab1,itab2.
    itab1-month1
    itab1-boy_sub1
    itab1-boy_sub2
    itab2-month2
    itab2-girl_sub1
    itab2-girl_sub2
    itab -month1
    itab -boy_sub1
    itab -boy_sub2
    itab -girl_sub1
    itab -girl_sub2
    first i am looping in itab1 and using COLLECT statement i am inserting data to itab (bez in a month more than one exam can happen)
    i got boys mark in itab,then i need to put girls mark on the same row based on month
    based on particular index i need to insert data, moreover i need to use COLLECT statement for getting the total of particular month
    thanks
    vivek

  • Collect statement issue

    Hi all,
    I have a requirement in which I am using Collect statement to club the numeric values.
    TYPES: BEGIN OF  ST_VBBE ,
                      MATNR TYPE VBBE-MATNR,
                      WERKS TYPE VBBE-WERKS,
                      OMENG TYPE VBBE-OMENG,
                END OF ST_VBBE.
    data : IT_VBBE TYPE TABLE OF ST_VBBE,
              WA_VBBE TYPE ST_VBBE,
              it_vbbe_f TYPE TABLE OF st_vbbe,
              WA_VBBE_F TYPE ST_VBBE.
    START-OF-SELECTION.
           SELECT MATNR WERKS OMENG
                        FROM VBBE INTO TABLE IT_VBBE UP TO 500 rows.
    BREAK-POINT.
    LOOP AT IT_VBBE INTO WA_VBBE.
       COLLECT WA_VBBE_f INTO IT_VBBE_f.
    ENDLOOP.
    This is my code.. But I am not getting a single value in the table in which I am collecting the data.
    I am getting the data in IT_VBBE.

    As per your code you doing worng,
    TYPES: BEGIN OF  ST_VBBE ,
                      MATNR TYPE VBBE-MATNR,
                      WERKS TYPE VBBE-WERKS,
                      OMENG TYPE VBBE-OMENG,
                END OF ST_VBBE.
    data : IT_VBBE TYPE TABLE OF ST_VBBE,
              WA_VBBE TYPE ST_VBBE,
              it_vbbe_f TYPE TABLE OF st_vbbe,
              WA_VBBE_F TYPE ST_VBBE.
    START-OF-SELECTION.
           SELECT MATNR WERKS OMENG
                        FROM VBBE INTO TABLE IT_VBBE UP TO 500 rows.
    BREAK-POINT.
    LOOP AT IT_VBBE INTO WA_VBBE.
       COLLECT WA_VBBE_f INTO IT_VBBE_f.  " wrong here you taking data in WA_VBBE, so need to pass in WA_VBBE_F and then collect.
    ENDLOOP.
    "Refer this code
    TYPES: BEGIN OF  ST_VBBE ,
                      MATNR TYPE VBBE-MATNR,
                      WERKS TYPE VBBE-WERKS,
                      OMENG TYPE VBBE-OMENG,
                END OF ST_VBBE.
    data : IT_VBBE TYPE TABLE OF ST_VBBE,
              WA_VBBE TYPE ST_VBBE,
              it_vbbe_f TYPE TABLE OF st_vbbe,
              WA_VBBE_F TYPE ST_VBBE.
    START-OF-SELECTION.
           SELECT MATNR WERKS OMENG
                        FROM VBBE INTO TABLE IT_VBBE UP TO 500 rows.
    BREAK-POINT.
    LOOP AT IT_VBBE INTO WA_VBBE.
        WA_VBBE_f = WA_VBBE.
       COLLECT WA_VBBE_f INTO IT_VBBE_f. 
    ENDLOOP.
    Regards,
    Sandeep

Maybe you are looking for

  • Regarding  Process Key

    Hi all:      Friends I have struck up with my work due to Process key. I need ur input for the following doubts. 1.What is process key?why we go for this? 2.What is the use of process key values like 1,2,21,22 ?.. Waiting for your reply.... Thanks in

  • Difference among  IDOCS,BAPI,RFC?

    what is the difference among  IDOCS,BAPI,RFC? and what is the real need to use them and again where exactly these are used in real time applications?

  • Garageband 10.0.1 mavericks

    Garageband 10.0.1 is properly broken for guitar lessons. So glad that it leaves the earlier version (6) in place. Sound disappears. Timing on the count in is wrong (slow then fast on lead in to lesson exercises. You set the monitor to speakers and th

  • After update my Ipad3 in IOS7 , i have an issue when changing wallpaper IOS hanging and system very slow

    system hanging and laggy , my IOS6 was very fast on my IPad3 , please i need solution .

  • Samsung Gusto U-360 calendar problem

    I have two events that pop up every hour (at xx:40), but they are not shown in the calendar. I do not use this phone on the web, and have never synced it to a computer; the link provided above is to clear web temporary files?  How is that relevant?