Reg: Clubbing internal tables.

Hi
i am havin entries in four internal tables like  int_po, int_rseg,int_vbrp ,INT_BSEG3,
INT_BKPF..
now i want to club it into a master internal table called as int_master.
loop at int_po into wa_po.
    move : wa_po-ebeln to wa_master-ebeln,
           wa_po-ebelp to wa_master-ebelp,
           wa_po-waers to wa_master-waers ,
           wa_po-netwr to wA_master-netwr,
           wa_po-lifnr to wa_master-lifnr,
           wa_po-netpr to wa_master-netpr,
           wa_po-vbeln to wa_master-vbeln,
           wa_po-matnr to wa_master-matnr,
           wa_po-vbelp to wa_master-vbelp,
           wa_po-name1 to wa_master-name1,
           wa_po-bukrs to wa_master-bukrs,
           wa_po-ekorg to wa_master-ekorg,
           wa_po-ekgrp to wa_master-ekgrp,
           wa_po-loekz to wa_master-loekz.
moving the int_rseg entries into master table for ALV Display
    READ TABLE INT_RSEG INTO WA_RSEG WITH KEY Ebeln = wa_po-Ebeln
                                              EBELP = wa_po-Ebelp binary search.
    MOVE : wa_RSEG-BELNR to wa_master-BELNR ,
           wa_RSEG-WRBTR to wa_master-WRBTR ,
           wa_rseg-budat to wa_master-budat,
           wa_rseg-shkzg to wa_master-shkzg.
    if WA_RSEG-blart NE 'RE' AND  WA_RSEG-stblg IS NOT INITIAL.
      W_BELNR = WA_RSEG-stblg.
      W_GJAHR = WA_rseg-stjah.
    ELSE.
      W_BELNR = WA_rseg-belnr.
      W_GJAHR = WA_rseg-GJAHR.
    ENDIF.
*Moving the int_bseg entries into master table for ALV Display
    READ TABLE INT_BSEG3 INTO WA_BSEG3 WITH KEY  BELNR = W_BELNR
                                                 GJAHR = W_GJAHR
                                                 BUKRS = WA_PO-BUKRS binary search.
    move: wa_bseg3-dmbtr to wa_master-dmbtr,
          wa_bseg3-shkzg1 to wa_master-shkzg1.
*Moving the int_bkpf entries into master table for ALV Display
    READ TABLE INT_BKPF INTO WA_BKPF WITH KEY BELNR = WA_BSEG3-BELNR
                                              GJAHR = WA_BSEG3-GJAHR binary search.
    move: wa_bkpf-hwaer to wa_master-hwaer.
*Moving the int_vbep entries into master table for ALV Display.
    loop AT int_vbep into wa_vbep where vbeln  = wa_po-vbeln and
                                        posnr  = wa_po-vbelp .
      move :   wa_vbep-etenr to wa_master-etenr ,
               wa_vbep-VRKME to wa_master-VRKME ,
               wa_vbep-BMENG to wa_master-BMENG .
*Moving the int_vbrp entries into master table for ALV Display
      READ TABLE INT_VBRP INTO WA_VBRP WITH KEY AUBEL = WA_VBEP-VBELN
                                                AUPOS = WA_VBEP-POSNR binary search .
      move : wa_vbRP-VBELN to wa_master-V_vbeln,
              wa_vbRp-posnr to wa_master-POSNR ,
             wa_vbrp-kunag TO wa_master-KUNAG,
             WA_VBRP-VKORG TO WA_MASTER-VKORG,
             wa_vbrp-waers to wa_master-waerk2,
             wa_vbrp-fkdat to wa_master-fkdat,
             wa_vbrp-sfakn to wa_master-sfakn,
             wa_vbrp-netwr to wa_master-v_netwr.
      APPEND WA_MASTER TO INT_MASTER.
      CLEAR : WA_VBEP ,
              WA_VBRP.
endloop.
    clear: wa_po,
           WA_BKPF,
           WA_BSEG3,
           W_BELNR,
           W_GJAHR,
           wa_rseg.
  endloop.
Based on int_po i am retrieving all the entries my probelm is if the subsequent tables like int_vbep is not having any entries means its coming out of the loop and i am not able to c any recods in nt_master but my requirement is if  int_vbep is not having any entries in that case also it should continue and display the based on the records what it retrieved from the previous level.
Thanks and Regards,
Arun Joseph

Hi,
This should work
loop at int_po into wa_po.
move : wa_po-ebeln to wa_master-ebeln,
wa_po-ebelp to wa_master-ebelp,
wa_po-waers to wa_master-waers ,
wa_po-netwr to wA_master-netwr,
wa_po-lifnr to wa_master-lifnr,
wa_po-netpr to wa_master-netpr,
wa_po-vbeln to wa_master-vbeln,
wa_po-matnr to wa_master-matnr,
wa_po-vbelp to wa_master-vbelp,
wa_po-name1 to wa_master-name1,
wa_po-bukrs to wa_master-bukrs,
wa_po-ekorg to wa_master-ekorg,
wa_po-ekgrp to wa_master-ekgrp,
wa_po-loekz to wa_master-loekz.
moving the int_rseg entries into master table for ALV Display
READ TABLE INT_RSEG INTO WA_RSEG WITH KEY Ebeln = wa_po-Ebeln
EBELP = wa_po-Ebelp binary search.
MOVE : wa_RSEG-BELNR to wa_master-BELNR ,
wa_RSEG-WRBTR to wa_master-WRBTR ,
wa_rseg-budat to wa_master-budat,
wa_rseg-shkzg to wa_master-shkzg.
if WA_RSEG-blart NE 'RE' AND WA_RSEG-stblg IS NOT INITIAL.
W_BELNR = WA_RSEG-stblg.
W_GJAHR = WA_rseg-stjah.
ELSE.
W_BELNR = WA_rseg-belnr.
W_GJAHR = WA_rseg-GJAHR.
ENDIF.
*Moving the int_bseg entries into master table for ALV Display
READ TABLE INT_BSEG3 INTO WA_BSEG3 WITH KEY BELNR = W_BELNR
GJAHR = W_GJAHR
BUKRS = WA_PO-BUKRS binary search.
move: wa_bseg3-dmbtr to wa_master-dmbtr,
wa_bseg3-shkzg1 to wa_master-shkzg1.
*Moving the int_bkpf entries into master table for ALV Display
READ TABLE INT_BKPF INTO WA_BKPF WITH KEY BELNR = WA_BSEG3-BELNR
GJAHR = WA_BSEG3-GJAHR binary search.
move: wa_bkpf-hwaer to wa_master-hwaer.
*Moving the int_vbep entries into master table for ALV Display.
loop AT int_vbep into wa_vbep where vbeln = wa_po-vbeln and
posnr = wa_po-vbelp .
move : wa_vbep-etenr to wa_master-etenr ,
wa_vbep-VRKME to wa_master-VRKME ,
wa_vbep-BMENG to wa_master-BMENG .
*Moving the int_vbrp entries into master table for ALV Display
READ TABLE INT_VBRP INTO WA_VBRP WITH KEY AUBEL = WA_VBEP-VBELN
AUPOS = WA_VBEP-POSNR binary search .
move : wa_vbRP-VBELN to wa_master-V_vbeln,
wa_vbRp-posnr to wa_master-POSNR ,
wa_vbrp-kunag TO wa_master-KUNAG,
WA_VBRP-VKORG TO WA_MASTER-VKORG,
wa_vbrp-waers to wa_master-waerk2,
wa_vbrp-fkdat to wa_master-fkdat,
wa_vbrp-sfakn to wa_master-sfakn,
wa_vbrp-netwr to wa_master-v_netwr.
APPEND WA_MASTER TO INT_MASTER.
CLEAR : WA_VBEP ,
WA_VBRP.
endloop.
if sy-subrc ne 0.
append WA_MASTER TO INT_MASTER
endif.
clear: wa_po,
WA_BKPF,
WA_BSEG3,
W_BELNR,
W_GJAHR,
wa_rseg.
endloop.
Regards,
Najmuddin

Similar Messages

  • Reg - Reading internal table with multiple record in a single field

    Dear Guru's,
                        i want to read a internal table with field having mutilple entries like
    read table READ TABLE LT_T2 INTO LT_T2_WA WITH KEY HKONT IN ( '0001152430', '0001152930', '0001152410' ).
    But it says comma without preceding colon (after READ?).
    please guide me.....
    thanks & Regards,
    Balaji.S

    ya this is inside the loop.
    plz check....
    loop at lt_t2 into lt_t2_wa.
    READ TABLE LT_T2 INTO LT_T2_WA WITH KEY HKONT IN ( '0001152430', '0001152930', '0001152410' ).
    endloop.
    thanks & Regards,
    Balaji.S

  • Reg : Joining the all internal table records into a single internal table

    Hi all
    I am having 5 internal tables and i want to put all these entries in a single intrnal table and my requirement is for each and every record it has to go through all the internal tables and if an entry is missing meand.it has to go through the other internal tables and for missing entries i should leave it as blank and rest of the contents i have to display can any please gimme some logic how to do this??
    Thanks in advance

    Don't have time or will to deliver turnkey solutions, but here is a frame:
    LOOP AT itab1...
      READ TABLE itab2 WITH TABLE KEY... (fields linking itab1 and itab2)
      READ TABLE itab3 WITH TABLE KEY... (fields linking itab1 and itab3)
      LOOP AT itab4 WHERE... (fields linking itab1 and itab4)
        READ TABLE itab5 WITH TABLE KEY... (fields linking itab4 and itab5)
        MOVE-CORRESPONDING... (all five work areas to target work area)
        APPEND itabtarget...
      ENDLOOP.
    ENDLOOP.
    so use READ when there is a 1:1 relationship (e.g. check table entry), and LOOP when there is a 1:N relationship (e.g. items for a header)
    Thomas

  • Reg transfer of data from excel to internal table

    hi
    i need to upload datas from Excel sheet to Internal Table.For this i use d FM
    ALSM_EXCEL_TO_INTERNAL_TABLE.but the problem is if a particular field has no value in excel sheet,then its not  uploaded into internal table.then next field value has come to that blank place in d internal table. what i need is if the excel sheet has a blank value for a field then a blank value is added in d inetrnal table also.

    Use below program logic
    Program    : ZLWMI151_UPLOAD(Data load to ZBATCH_CROSS_REF Table)
    Type       : Upload program
    Author     : Seshu Maramreddy
    Date       : 05/16/2005
    Transport  : DV3K919574
    Transaction: None
    Description: This program will get the data from XLS File
                 and it upload to ZBATCH_CROSS_REF Table
    REPORT ZLWMI151_UPLOAD no standard page heading
                           line-size 100 line-count 60.
    *tables : zbatch_cross_ref.
    data : begin of t_text occurs 0,
           werks(4) type c,
           cmatnr(15) type c,
           srlno(12) type n,
           matnr(7) type n,
           charg(10) type n,
           end of t_text.
    data: begin of t_zbatch occurs 0,
          werks like zbatch_cross_ref-werks,
          cmatnr like zbatch_cross_ref-cmatnr,
          srlno like zbatch_cross_ref-srlno,
          matnr like zbatch_cross_ref-matnr,
          charg like zbatch_cross_ref-charg,
          end of t_zbatch.
    data : g_repid like sy-repid,
           g_line like sy-index,
           g_line1 like sy-index,
           $v_start_col         type i value '1',
           $v_start_row         type i value '2',
           $v_end_col           type i value '256',
           $v_end_row           type i value '65536',
           gd_currentrow type i.
    data: itab like alsmex_tabline occurs 0 with header line.
    data : t_final like zbatch_cross_ref occurs 0 with header line.
    selection-screen : begin of block blk with frame title text.
    parameters : p_file like rlgrap-filename obligatory.
    selection-screen : end of block blk.
    initialization.
      g_repid = sy-repid.
    at selection-screen on value-request for p_file.
      CALL FUNCTION 'F4_FILENAME'
           EXPORTING
                PROGRAM_NAME = g_repid
           IMPORTING
                FILE_NAME    = p_file.
    start-of-selection.
    Uploading the data into Internal Table
      perform upload_data.
      perform modify_table.
    top-of-page.
      CALL FUNCTION 'Z_HEADER'
      EXPORTING
        FLEX_TEXT1       =
        FLEX_TEXT2       =
        FLEX_TEXT3       =
    *&      Form  upload_data
          text
    FORM upload_data.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                FILENAME                = p_file
                I_BEGIN_COL             = $v_start_col
                I_BEGIN_ROW             = $v_start_row
                I_END_COL               = $v_end_col
                I_END_ROW               = $v_end_row
           TABLES
                INTERN                  = itab
           EXCEPTIONS
                INCONSISTENT_PARAMETERS = 1
                UPLOAD_OLE              = 2
                OTHERS                  = 3.
      IF SY-SUBRC <> 0.
        write:/10 'File '.
      ENDIF.
      if sy-subrc eq 0.
        read table itab index 1.
        gd_currentrow = itab-row.
        loop at itab.
          if itab-row ne gd_currentrow.
            append t_text.
            clear t_text.
            gd_currentrow = itab-row.
          endif.
          case itab-col.
            when '0001'.
              t_text-werks = itab-value.
            when '0002'.
              t_text-cmatnr = itab-value.
            when '0003'.
              t_text-srlno = itab-value.
            when '0004'.
              t_text-matnr = itab-value.
            when '0005'.
              t_text-charg = itab-value.
          endcase.
        endloop.
      endif.
      append t_text.
    ENDFORM.                    " upload_data
    *&      Form  modify_table
          Modify the table ZBATCH_CROSS_REF
    FORM modify_table.
      loop at t_text.
        t_final-werks = t_text-werks.
        t_final-cmatnr = t_text-cmatnr.
        t_final-srlno = t_text-srlno.
        t_final-matnr = t_text-matnr.
        t_final-charg = t_text-charg.
        t_final-erdat = sy-datum.
        t_final-erzet = sy-uzeit.
        t_final-ernam = sy-uname.
        t_final-rstat = 'U'.
        append t_final.
        clear t_final.
      endloop.
      delete t_final where werks = ''.
      describe table t_final lines g_line.
      sort t_final by werks cmatnr srlno.
    Deleting the Duplicate Records
      perform select_data.
      describe table t_final lines g_line1.
      modify zbatch_cross_ref from table t_final.
      if sy-subrc ne 0.
        write:/ 'Updation failed'.
      else.
        Skip 1.
        Write:/12 'Updation has been Completed Sucessfully'.
        skip 1.
        Write:/12 'Records in file ',42 g_line .
        write:/12 'Updated records in Table',42 g_line1.
      endif.
      delete from zbatch_cross_ref where werks = ''.
    ENDFORM.                    " modify_table
    *&      Form  select_data
          Deleting the duplicate records
    FORM select_data.
      select werks
             cmatnr
             srlno from zbatch_cross_ref
             into table t_zbatch for all entries in t_final
             where werks = t_final-werks
             and  cmatnr = t_final-cmatnr
             and srlno = t_final-srlno.
      sort t_zbatch by werks cmatnr srlno.
      loop at t_zbatch.
        read table t_final with key werks = t_zbatch-werks
                                    cmatnr = t_zbatch-cmatnr
                                    srlno = t_zbatch-srlno.
        if sy-subrc eq 0.
          delete table t_final .
        endif.
        clear: t_zbatch,
               t_final.
      endloop.
    ENDFORM.                    " select_data
    Reward points if it is helpful
    Thanks
    Seshu

  • Reg: Creation of Dynamic Internal table

    Hi All,
    I got a requirement which should be handled by creating dynamic internal table.
    *Scenario: *
    1.First I will fetch data from one table into an internal table.
    Let suppose I am fetching the fieldnames of the table MAKT from DD03l. Then I will having following records in my internal table.
             MANDT
             MATNR
             SPRAS
             MAKTX
             MAKTG
    2.Now I need to download these fields into an excel file with same field names as headings as shown below
         |  MANDT  |  MATNR  |  SPRAS  |  MAKTX  |  MAKTG  |
    3.Later User will enter data for all those fields in the downloaded excel file and again upload the file. Here I need to create dynamic internal table because the table name is dynamic. Based on the table name, field names will be varying..
    Please provide me solution for the above..
    Thanks,
    Ravee

    Hi
    U can try something like this:
    TYPES: TY_LINE TYPE STRING.
    PARAMETERS: P_TABLE TYPE DDOBJNAME.
    DATA: DYN_TAB TYPE REF TO DATA.
    FIELD-SYMBOLS: <FS_TAB>   TYPE TABLE,
                   <FS_WA>    TYPE ANY,
                   <FS_FIELD> TYPE ANY.
    DATA: DFIES_TAB TYPE TABLE OF DFIES WITH HEADER LINE.
    DATA: W_LINE(10000) TYPE C.
    DATA: V_OFFSET TYPE I.
    DATA: LAST_FIELD.
    START-OF-SELECTION.
      CALL FUNCTION 'DDIF_FIELDINFO_GET'
        EXPORTING
          TABNAME        = P_TABLE
        TABLES
          DFIES_TAB      = DFIES_TAB
        EXCEPTIONS
          NOT_FOUND      = 1
          INTERNAL_ERROR = 2
          OTHERS         = 3.
      IF SY-SUBRC <> 0.
        MESSAGE I208(00) WITH 'No table'.
        STOP.
      ENDIF.
    * Create internal table
      CREATE DATA DYN_TAB TYPE TABLE OF (P_TABLE).
      ASSIGN DYN_TAB->* TO <FS_TAB>.
    * Create Header
      LOOP AT DFIES_TAB.
    * Insert field name
        MOVE DFIES_TAB-FIELDNAME TO W_LINE+V_OFFSET.
        V_OFFSET = V_OFFSET + 30.
        AT LAST.
          LAST_FIELD = 'X'.
        ENDAT.
        CHECK LAST_FIELD IS INITIAL.
    * Insert separator
        MOVE ';' TO W_LINE+V_OFFSET.
        V_OFFSET = V_OFFSET + 1.
      ENDLOOP.
      CONDENSE W_LINE NO-GAPS.
      WRITE W_LINE.
    * Get DATA
      SELECT * FROM (P_TABLE) INTO TABLE <FS_TAB>.
      LOOP AT <FS_TAB> ASSIGNING <FS_WA>.
        CLEAR LAST_FIELD.
        CLEAR V_OFFSET.
        CLEAR W_LINE.
        LOOP AT DFIES_TAB.
          AT LAST.
            LAST_FIELD = 'X'.
          ENDAT.
          ASSIGN COMPONENT DFIES_TAB-FIELDNAME
            OF STRUCTURE <FS_WA> TO <FS_FIELD>.
    * Insert value
          MOVE <FS_FIELD> TO W_LINE+V_OFFSET(DFIES_TAB-INTLEN).
          V_OFFSET = V_OFFSET + DFIES_TAB-INTLEN.
    * Insert separator
          MOVE ';' TO W_LINE+V_OFFSET.
          V_OFFSET = V_OFFSET + 1.
        ENDLOOP.
        CONDENSE W_LINE NO-GAPS.
        WRITE: / W_LINE.
      ENDLOOP.
    In your case u can append the workarea W_LINE to an internal table and then download it as CSV file.
    Max

  • Reg:Submit statement Return Internal Table

    Hi Team,
    I have a query to return the internal table from the called program via SUBMIT statement to the calling statement ??
    Example : Thing is that consider reports A and B , Report B is getting called from report A where in B we have one internal table full of data that i need to pull to report A and there i need to process it.
    How can i achieve this?
    Please let me know the possible ways.
    Karthik.S

    Hi karthik,
    SUBMIT .... AND RETURN EXPORTING LIST TO MEMORY.
    Then use FM LIST_FROM_MEMORY.
    Thanks,
    Anil

  • 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

  • Question reg. modifying latest record in internal table

    Can you tell me if it is possible to modify the last appended record to the internal table?
    I just want to modify the record in the internal table which is appended at the latest. Please tell me the logic for this.
    Thanks a lot,
    Krishen

    Hi try with this:
    DATA line TYPE I.
    DATA wa_itab TYPE LINE OF it_itab.
    DESCRIBE TABLE IT_TABLE LINE line.
    READ TABLE IT_TABLE INTO wa_itab INDEX line.
    WA_TABLE-FIELD = 'new value'.
    MODIFY TABLE IT_TABLE FROM wa_itab
           TRANSPORTING field.
    Best regards.

  • Reg: internal table?

    hello friends?
    i have one basic doubts,
    please clear this things,
    what are all the ways we can create the internal table?
    how we create internal table using data statement?
    how we create internal table using types statement?
    what is the difference between these two methods?

    FYI..
    DATA - Defining an Internal Table
    Variants:
    1. DATA itab TYPE itabtype [WITH HEADER LINE].
    2. DATA itab {TYPE tabkind OF linetype|
                  LIKE tabkind OF lineobj}
              WITH [UNIQUE|NON-UNIQUE] keydef
              [INITIAL SIZE n] [WITH HEADER LINE].
    3. DATA itab {TYPE TABLE OF linetype|LIKE TABLE OF lineobj}.
    4. DATA itab TYPE RANGE OF type.
    DATA itab LIKE RANGE OF f.
    5. DATA itab [TYPE linetype|LIKE lineobj] OCCURS n
              [WITH HEADER LINE].
    6. DATA: BEGIN OF itab OCCURS n,
          END   OF itab [VALID BETWEEN f1 AND f2].
    In an ABAP Objects context, a more severe syntax check is performed that in other ABAP areas. See New naming conventions and LIKE references to Dictionary Types not allowed.
    Effect
    Defines an internal table.
    To fill and process internal tables, use the statements INSERT, APPEND, READ TABLE, LOOP, SORT, and so on.
    The OCCURS or INITIAL SIZE parameter (OCCURS value) determines the number of lines that are created when the table itself is created. However, the table is extended dynamically on demand. For details, refer to Performance Notes for Internal Tables. The OCCURS value, has no other semantic meaning (apart from one exception in the APPEND SORTED BY statement). If you do not specify an INIT IAL SIZE , the system uses the default value 0.
    If you specify WITH HEADER LINE, the table is created with a header line, that is, a field with the same name. It has the same type as the line type of the table.
    This addition is not allowed in an ABAP Objects context. See Tables with header line not allowed.
    Variant 1
    DATA itab TYPE itabtype [WITH HEADER LINE].
    Effect
    itabtype must be an internal table type that you have already defined using TYPES. The statement creates an internal table in the program with this type.
    In general, the type specification for the table object must be complete. The exception to this is a standard table, in which the key definition may be missing. In this case, the system automatically uses a default key.
    Example
    Creating a hashed table by referring to an existing table type:
    TYPES: BEGIN OF STRUC, NAME(10), AGE TYPE I, END OF STRUC,
           HTAB TYPE HASHED TABLE OF STRUC WITH UNIQUE KEY NAME.
    DATA : PERSONS TYPE HTAB.
    Variant 2
    DATA itab {TYPE tabkind OF linetype|LIKE tabkind OF lineobj}           WITH [UNIQUE|NON-UNIQUE] keydef
              [INITIAL SIZE n] [WITH HEADER LINE].
    Effect
    Creates an internal table in the program with the type tabkind. Since there are no generic field definitions, you cannot use the table types ANY TABLE or INDEX TABLE.
    The structure of the table lines is defined by the type linetype if you use a TYPE reference) or by the type of the referred object lineobj (when you use a LIKE reference).
    The same rules apply to the UNIQUE and NON-UNIQUE additions in the DATA statement as in a TYPES definition. You may only omit the definition when defining a standard table.
    If you do not specify the INITIAL SIZE the system uses a default initial size of 0.
    Variant 3
    DATA itab {TYPE TABLE OF linetype|LIKE TABLE OF lineobj}.
    Effect
    This is a shortened form of the definition of a standard table. It corresponds to
       DATA itab {TYPE STANDARD TABLE OF linetype|
                  LIKE STANDARD TABLE OF lineobj} WITH DEFAULT KEY.
    or the old definition (compare variant 4)
       DATA itab {TYPE linetype|LIKE lineobj} OCCURS 0.
    Variant 4
    DATA itab TYPE RANGE OF type. DATA itab LIKE RANGE OF f.
    Additions:
    1. ... INITIAL SIZE n
    2. ... WITH HEADER LINE
    Effect
    Creates an internal table itab with table type STANDARD. The line type is a structure with the following components:
      SIGN(1)   TYPE C
      OPTION(2) TYPE C
      LOW       TYPE type bzw. LIKE f
      HIGH      TYPE type bzw. LIKE f
    Addition 1
    ...INITIAL SIZE n
    Effect
    The INITIAL SIZE specification determines how many table lines are created when the table itself is created. The table is also dynamically expanded as required. For further information, refer to Performance Notes for Internal Tables. The INITIAL SIZE value has no semantic meaning (apart from one exception in the ei APPEND SORTED BY statement). If you do not specify the INITIAL SIZE, the system uses the default value 0.
    Addition 2
    ... WITH HEADER LINE
    This addition is not allowed in an ABAP Objects context. See Tables with Header Lines Not Allowed.
    Effect
    Creates an internal table and a header line for it, that is, a field with the same name as the internal table and the same type as the line type of the internal table.
    Variant 5
    DATA itab [TYPE linetype|LIKE lineobj] OCCURS n                                        [WITH HEADER LINE].
    This variant is not allowed in an ABAP Objects context. See Declaration with OCCURS not allowed.
    Effect
    This variant exists to ensure compatibility with Release 3.x. If you do not specify a line type, the system uses type C with length 1. Otherwise, the variant is the same as
       DATA itab {TYPE STANDARD TABLE OF linetype|
                  LIKE STANDARD TABLE OF lineobj}
                 INITIAL SIZE n [WITH HEADER LINE].
    Example
    TYPES: BEGIN OF LINE_TYPE,
             NAME(20) TYPE C,
             AGE      TYPE I,
           END   OF LINE_TYPE.
    DATA:  PERSONS    TYPE LINE_TYPE OCCURS 20,
           PERSONS_WA TYPE LINE_TYPE.
    PERSONS_WA-NAME = 'Michael'.  PERSONS_WA-AGE  = 25.
    APPEND PERSONS_WA TO PERSONS.
    PERSONS_WA-NAME = 'Gabriela'. PERSONS_WA-AGE  = 22.
    APPEND PERSONS_WA TO PERSONS.
    The internal table PERSONS now contains two entries.
    Variant 6
    DATA: BEGIN OF itab OCCURS n,         ...
          END   OF itab [VALID BETWEEN f1 AND f2].
    This variant is not allowed in an ABAP Objects context. See Declaration with OCCURS not allowed.
    Effect
    Creates an internal table itab with type STANDARD and a header line. The line type consists of the fields between "BEGIN OF itab OCCURS n" and " END OF itab".
    Use the VALID BETWEEN f1 AND f2 addition to specify that the components f1 and f2 of the internal table itab contain a line-based validity interval. You can only use this addition in conjunction with the PROVIDE statement.
    Example
    DATA: BEGIN OF PERSONS OCCURS 20,
            NAME(20),
            AGE TYPE I,
          END   OF PERSONS.
    PERSONS-NAME = 'Michael'.
    PERSONS-AGE  = 25.
    APPEND PERSONS.
    PERSONS-NAME = 'Gabriela'.
    PERSONS-AGE  = 22.
    APPEND PERSONS.
    The internal table consists of two entries. PERSONS also has a header line (work area), which is an interface between the program and the actual table contents.
    Additional help
    Internal Table Objects
    Ramesh

  • Reg : internal table & Perform statement

    hi all
         i have 3 internal tables ,
    *     in first internal table i have mark-1 ,*
    *     in 2nd internal table i have mark-2 ,*
    *     using "PERFORM"  i have to add mark 1 & mark 2*
    *     and i need to display the total in  3rd internal table.*
    *     how to do by using "PERFORM" .*
                    Kindly clarify.
    with kind regards
    vel

    Raghupathy is right you just have to write:
    porgram code......
    perform sum_of_tables tables itab1
                                               itab2
                                               itab3.
    program code....
    definition of form:
    form_sum_of_tables tables itab1
                                          itab2
                                          itab3.
    definiton type of witab1, witab2, witab3.
    loop itab1 into witab1.
    loop itab2 into witab2.
    witab3-total = witab1-mark1 plus witab2-mark2.
    append witab3 to itab3.
    endloop.
    endloop.
    endform.
    It will return itab3 which is sum of itab1 and itab2.

  • Reg: Max length of internal table field(GUI_UPLOAD)

    Hi All,
    In my internal table there is a field for long text(free text/string), when i using GUI_UPLOAD the field max char is 255, so i couldnt get the full text, eventhough i declared that particular long text as string. Can any one tell me how to get the free text.
    And i am uploading data from presentation server, not from app server.
    Thanks in advance.
    Arun
    Edited by: arun on Mar 18, 2010 7:01 AM

    You have to cook your own logic. But what is the reason for not sorting the table?
    If you do not want to disturb the main intrenal table, you can move the contents into a temporary internal table, and sort it by descending order. The first record would have the maximum value.
    here is a logic to find the maximum value.
    loop at itab.
    if itab-value > v_max.
    v_max = itab-value.
    endif.
    endlop.
    V_max would have the maximum value at the end lo the loop.
    Regards,
    Ravi

  • Reg Modification of a field in internal table.

    Hi
    i have requirement like this. I have a header and an items in a report. In header, i need to display the no. of . items(count). In my report i am displaying the records before moving to internal table(Direct write). Also i want to download that report into a CSV file.
    Regards
    Ravi

    hi,
    Check out this sample code
    report ztest.
    data: begin of itab occurs 0,
    fld1(10) type c,
    fld2(10) type c,
    fld3(10) type c,
    end of itab.
    data: begin of iout occurs 0,
    rec(1000) type c,
    end of iout.
    parameters: p_file type localfile default 'C:\test.csv'.
    data: file type string.
    start-of-selection.
        * Build the ITAB
    itab-fld1 = 'A'.
    itab-fld2 = 'B'.
    itab-fld3 = 'C'.
    append itab.
    itab-fld1 = 'D'.
    itab-fld2 = 'E'.
    itab-fld3 = 'F'.
    append itab.
    itab-fld1 = 'G'.
    itab-fld2 = 'H'.
    itab-fld3 = 'I'.
    append itab.
        * Build the output internal table from ITAB
        * Concatenate all fields into IOUT-REC
    loop at itab.
    concatenate itab-fld1 itab-fld2 itab-fld3 into iout-rec
    separated by ','.
    condense iout-rec no-gaps.
    append iout.
    endloop.
        * Now Download
    file = p_file.
    call function 'GUI_DOWNLOAD'
    exporting
    filename = file
    tables
    data_tab = iout
    exceptions
    others = 22.

  • Reg deleting entries from internal table

    Hi experts,
       I have two internal tables , ITAB1 and ITAB2 (same structure), i like to delete the records from ITAB1 which are in ITAB2 without looping .How it can be done?
    regards,
    Kannan

    Lozan,
    itab1 is having 1,2,3,4.
    itab2 is having 1,2,5,6,7.
    Now I move the contents in itab1 and itab2 to itab3.
    itab3 is having now 1,2,3,4,1,2,5,6,7.
    Now I will sort this itab3,thus itab3 is now having
    1,1,2,,2,3,4,5,6,7.
    <b>Now,if  I use delete adjacent duplicates from itab3,will it won't result in
    1,2,3,4,5,6,7 in itab3?</b>
    K.Kiran.
    Message was edited by:
            Kiran K
    Message was edited by:
            Kiran K

  • Reg. internal table logic

    Hi,
    I have an internal table with 5 fields (Vbeln, A, B, C, D ) and records like this:
    Record1:
    Field vbeln (value is  6000000001), Field A (value is 2006), Field B (value is 1130), Field C (value is initial), Field D (value is initial)
    Record1:
    Field vbeln (value is  6000000001), Field A (value is initial), Field B (value is initial), Field C (value is 2005), Field D (value is 1134)
    Now whenever, Field A and Field B has values, field C and field D are initial and vice versa.
    I Want to get all of the field values in just one record like below when the key vbeln is same.:
    Field vbeln (value is  6000000001), Field A (value is 2006), Field B (value is 1130), Field C (value is 2005), Field D (value is 1134)
    I know I can create another internal table, copy the contents, use the looping logic and achieve the same but wondering if there is any better way of doing the same?
    Appreciate your input.
    Thanks!

    Hi,
    You need another internal tables. Please try this.
    SORT ITAB1.
    ITAB2[] = ITAB1[].
    LOOP AT ITAB1.
      LOOP AT ITAB2 WHERE ITAB2-VBELN EQ ITAB1-VBELN
                      AND ITAB2-DATE1 NE ITAB1-DATE1
                      AND ITAB2-TIME1 NE ITAB1-TIME1.
        ITAB3-VBELN = ITAB1-VBELN.
        ITAB3-DATE1 = ITAB1-DATE1.
        ITAB3-TIME1 = ITAB1-TIME1.
        ITAB3-DATE2 = ITAB2-DATE2.
        ITAB3-TIME2 = ITAB2-TIME2.
        APPEND ITAB3.
      ENDLOOP.
    ENDLOOP.
    Regards,
    Ferry Lianto

  • Reg  comparison of two  internal tables

    hi friends,
    please help me solving this.
    there are two internal tables t_zvs38 and t_value
    1.t_value like seahlpres
    2.t_zvs38 like zvs38.
    values in t_value will be like this.
    first line wil contain zmdtype(mandatory document) and second line will contain
    zmdtypet (the description for zmdtype).
    eg.
    D001 -
    -zmdtype
    internal----
    zmdtypet
    D002
    external
    D003
    renewal
    values in t_zvs38.
    for a particular sales.org the zmdtype is filled.
    select vkorg zmdtype into corrsponding fields of table t_zvs38
    where vkorg = p_vkorg.
    Now i want to compare t_value and t_zvs38 with field zmdtype
    and delete the contents of  t_value which are not in t_zvs38.
    i have written like this.
    loop at t_value.
    read table t_zvs38 with key zmdtype = t_value-string.
    if sy-subrc ne 0.
    delete t_value. "to delete zmdtype
    sy-tabix = sy-tabix + 1.
      delete t_value. " to delete zmdtypet
    else.
    sy-tabix = sy-tabix +2. "to go to next zmdtype.
    endif.
    endloop.
    but it is deleting all the contents of t_value.
    points are assured.

    CLEAR zvs32t.
      SELECT zvs32tzmdtype zvs32tzmdtypet
        INTO (zvs32t-zmdtype, zvs32t-zmdtypet)
        FROM zvs32t
        JOIN zvs32
        ON   zvs32tzmdtype = zvs32zmdtype
        WHERE zvs32t~spras    = sy-langu
        AND   zvs32~zfrenewal = space.
         WRITE zvs32t-zmdtype TO t_value.
        APPEND t_value.
        WRITE zvs32t-zmdtypet TO t_value.
        APPEND t_value.
      ENDSELECT.
      SELECT vkorg vkbur zmdtype FROM zvs38 INTO CORRESPONDING FIELDS OF TABLE t_zvs38
      WHERE vkorg = p_vkorg
    AND vkbur = p_vkbur.
      LOOP AT t_value INTO wa_area1.
        v_index = sy-tabix.
        READ TABLE t_zvs38 INTO wa_area2 WITH KEY zmdtype = wa_area1-string
      BINARY SEARCH.
       IF sy-subrc NE 0.
          IF l_flag IS INITIAL.
            DELETE t_value INDEX v_index.
           ELSE.
            CLEAR l_flag.
          ENDIF.
       ELSE.
          l_flag = 'X'.
       ENDIF.
      ENDLOOP.
    Using this code ,i am unable to ge the correct output.Thank u all for ur help.

Maybe you are looking for

  • Cannot send email- Possible firewall issue

    Hi all, I have recently downloaded firefox, which was meant to replace safari on my macbook. Since doing this I have been having issues in sending emails from my aol accounts on mail. Does anyone know how to rectify this so that I can send emails aga

  • Src and href wrong

    Hi all, In my jee web app, I used href="/pages/jsp/emailToSms/sendSms.jsp" but while I run the program it shows that http://localhost:8080/EmailToSMS/pages/jsp/emailToSms/pages/jsp/emailToSms/sendSms.jsp. My project name is EmailToSMS and folder stru

  • Is there a way toeither have 2 bookmark toolbars [BT] displayed or resize the one [BT] to show more bookmarks?

    I use quite a few different boookmarks quite regularly. I would like to display more bookmarks on my bookmark toolbar instead of having to use the drop down meny to the right at the end of the toolbar. IS there any way to do this by either resizeing

  • Chat program in release 4.7c

    hi guys, I was wondering how one can create a chat program in abap. As its possible in Java & .Net why an abaper under estimate himself. Now here imagine a simple chat program where one can send some text from his SAP GUI which will appear on others

  • Questation about instaling MBAM 2.5

    Hi all , i have two questation about instaling MBAM :) a) is possible install report server on another comtuter then MBAM server ? I want install mbam in the server a and in the server b I want have report services with report services DB b)if I try