How to add a row in internal table at first row

Hi All,
              I need to add a row in an internal table which already has some contents.I want to add this row in the first row.
Please advice.
Thanks in advance.

You mean - you  want to replace the 1st record in the internal table. or you want to sum the new values to the existed record.
If you want to replace - then you can use as
read table itab index 1.
if sy-subrc = 0.
    itab-f1 = 'new value'.
    modify itab index sy-tabix.
endif.
Regards,
Satya

Similar Messages

  • Convert multiple rows of internal table into one row of internal table

    Hi everyone,
    I have an internal table of structure
    Objid   - Sobid
    1         -     A
    1          -    B
    1           -   C
    1            -  D
    2        -      a
    2        -      b
    Now I have to show this in ALV format
    Objid - Sobid1- Sobid2 -Sobid3 -Sobid4 -Sobid5
    1      -   A   -      B   -       C  -     D       
    2       -  a     -     b
    Kindly help me it's urgent.
    bye

    Hi sandip,
    sorry i make a mistake. I have not seen that you will have it in ALV.
    Try this an use itab1-txt in your alv:
    DATA: BEGIN OF ITAB OCCURS 0,
      OBJID(1),
      DUMMY(1) VALUE '-',
      SOBID(1),
      END   OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 0,
      txt(20),
      END   OF ITAB1.
    ITAB-OBJID = '1'. ITAB-SOBID = 'A'. APPEND ITAB.
    ITAB-OBJID = '1'. ITAB-SOBID = 'B'. APPEND ITAB.
    ITAB-OBJID = '1'. ITAB-SOBID = 'C'. APPEND ITAB.
    ITAB-OBJID = '1'. ITAB-SOBID = 'D'. APPEND ITAB.
    ITAB-OBJID = '2'. ITAB-SOBID = 'a'. APPEND ITAB.
    ITAB-OBJID = '2'. ITAB-SOBID = 'b'. APPEND ITAB.
    LOOP AT ITAB.
      AT NEW OBJID.
        if sy-tabix <> 1. append itab1. clear itab1. endif.
        itab1-txt = ITAB-OBJID.
      ENDAT.
      AT NEW SOBID.
        concatenate itab1-txt ITAB-DUMMY ITAB-SOBID into itab1-txt.
      ENDAT.
    ENDLOOP.
    append itab1.
    loop at itab1. write: / itab1-txt. endloop.
    Regards, Dieter

  • How to Download XML File to internal table

    Hi Friends,
    This is my urgent requirement. How to download XML File to Internal table.
    regards
    pauldharma

    Hai,
    Please check this Link
    http://www.sap-img.com/abap/upload-direct-excel.htm
    PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
                begcol TYPE i DEFAULT 1 NO-DISPLAY,
                begrow TYPE i DEFAULT 1 NO-DISPLAY,
                endcol TYPE i DEFAULT 100 NO-DISPLAY,
                endrow TYPE i DEFAULT 32000 NO-DISPLAY.
    * Tick don't append header
    PARAMETERS: kzheader AS CHECKBOX.
    DATA: BEGIN OF intern OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern.
    DATA: BEGIN OF intern1 OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern1.
    DATA: BEGIN OF t_col OCCURS 0,
           col LIKE alsmex_tabline-col,
           size TYPE i.
    DATA: END OF t_col.
    DATA: zwlen TYPE i,
          zwlines TYPE i.
    DATA: BEGIN OF fieldnames OCCURS 3,
            title(60),
            table(6),
            field(10),
            kz(1),
          END OF fieldnames.
    * No of columns
    DATA: BEGIN OF data_tab OCCURS 0,
           value_0001(50),
           value_0002(50),
           value_0003(50),
           value_0004(50),
           value_0005(50),
           value_0006(50),
           value_0007(50),
           value_0008(50),
           value_0009(50),
           value_0010(50),
           value_0011(50),
           value_0012(50),
           value_0013(50),
           value_0014(50),
           value_0015(50),
           value_0016(50),
           value_0017(50),
           value_0018(50),
           value_0019(50),
           value_0020(50),
           value_0021(50),
           value_0022(50),
           value_0023(50),
           value_0024(50),
           value_0025(50),
           value_0026(50),
           value_0027(50),
           value_0028(50),
           value_0029(50),
           value_0030(50),
           value_0031(50),
           value_0032(50),
           value_0033(50),
           value_0034(50),
           value_0035(50),
           value_0036(50),
           value_0037(50),
           value_0038(50),
           value_0039(50),
           value_0040(50),
           value_0041(50),
           value_0042(50),
           value_0043(50),
           value_0044(50),
           value_0045(50),
           value_0046(50),
           value_0047(50),
           value_0048(50),
           value_0049(50),
           value_0050(50),
           value_0051(50),
           value_0052(50),
           value_0053(50),
           value_0054(50),
           value_0055(50),
           value_0056(50),
           value_0057(50),
           value_0058(50),
           value_0059(50),
           value_0060(50),
           value_0061(50),
           value_0062(50),
           value_0063(50),
           value_0064(50),
           value_0065(50),
           value_0066(50),
           value_0067(50),
           value_0068(50),
           value_0069(50),
           value_0070(50),
           value_0071(50),
           value_0072(50),
           value_0073(50),
           value_0074(50),
           value_0075(50),
           value_0076(50),
           value_0077(50),
           value_0078(50),
           value_0079(50),
           value_0080(50),
           value_0081(50),
           value_0082(50),
           value_0083(50),
           value_0084(50),
           value_0085(50),
           value_0086(50),
           value_0087(50),
           value_0088(50),
           value_0089(50),
           value_0090(50),
           value_0091(50),
           value_0092(50),
           value_0093(50),
           value_0094(50),
           value_0095(50),
           value_0096(50),
           value_0097(50),
           value_0098(50),
           value_0099(50),
           value_0100(50).
    DATA: END OF data_tab.
    DATA: tind(4) TYPE n.
    DATA: zwfeld(19).
    FIELD-SYMBOLS: <fs1>.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                mask      = '*.xls'
                static    = 'X'
           CHANGING
                file_name = filename.
    START-OF-SELECTION.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                filename                = filename
                i_begin_col             = begcol
                i_begin_row             = begrow
                i_end_col               = endcol
                i_end_row               = endrow
           TABLES
                intern                  = intern
           EXCEPTIONS
                inconsistent_parameters = 1
                upload_ole              = 2
                OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/ 'Upload Error ', SY-SUBRC.
      ENDIF.
    END-OF-SELECTION.
      LOOP AT intern.
        intern1 = intern.
        CLEAR intern1-row.
        APPEND intern1.
      ENDLOOP.
      SORT intern1 BY col.
      LOOP AT intern1.
        AT NEW col.
          t_col-col = intern1-col.
          APPEND t_col.
        ENDAT.
        zwlen = strlen( intern1-value ).
        READ TABLE t_col WITH KEY col = intern1-col.
        IF sy-subrc EQ 0.
          IF zwlen > t_col-size.
            t_col-size = zwlen.
    *                          Internal Table, Current Row Index
            MODIFY t_col INDEX sy-tabix.
          ENDIF.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE t_col LINES zwlines.
      SORT intern BY row col.
      IF kzheader = 'X'.
        LOOP AT intern.
          fieldnames-title = intern-value.
          APPEND fieldnames.
          AT END OF row.
            EXIT.
          ENDAT.
        ENDLOOP.
      ELSE.
        DO zwlines TIMES.
          WRITE sy-index TO fieldnames-title.
          APPEND fieldnames.
        ENDDO.
      ENDIF.
      SORT intern BY row col.
      LOOP AT intern.
        IF kzheader = 'X'
        AND intern-row = 1.
          CONTINUE.
        ENDIF.
        tind = intern-col.
        CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
        ASSIGN (zwfeld) TO <fs1>.
        <fs1> = intern-value.
        AT END OF row.
          APPEND data_tab.
          CLEAR data_tab.
        ENDAT.
      ENDLOOP.
      CALL FUNCTION 'DISPLAY_BASIC_LIST'
           EXPORTING
                file_name     = filename
           TABLES
                data_tab      = data_tab
                fieldname_tab = fieldnames.
    *-- End of Program
    http://sap.ittoolbox.com/groups/technical-functional/sap-dev/excel-file-download-to-an-internal-table-in-sap-crm-1719453#
    tables: zinv_release,
    zpo_release.
    ** decleration of data
    DATA: BEGIN OF my_tab OCCURS 0.
    INCLUDE STRUCTURE zinv_release.
    DATA: END OF my_tab.
    *DATA: hex_tab TYPE x VALUE '09'.
    DATA: rec(200)."'/usr/test.dat'.
    DATA:
    zhours(20) TYPE c,
    MINS(20) type c. "decimals.
    data: coma.
    coma = ','.
    SELECTION-SCREEN BEGIN OF BLOCK txt
    WITH FRAME TITLE text-001.
    PARAMETERS: dsn(60) DEFAULT '\\sapdev01\prod\'.
    SELECTION-SCREEN END
    OF BLOCK txt.
    *using a dataset to get text
    OPEN DATASET dsn FOR INPUT IN TEXT MODE.
    IF sy-subrc = 0.
    DO.
    READ DATASET dsn INTO rec.
    IF sy-subrc <> 0.
    EXIT.
    ENDIF.
    split rec at coma into
    zpo_release-REL_GRP
    zpo_release-REL_CODE
    zpo_release-RESPREL
    zpo_release-ALTREL
    zpo_release-MANAGER
    ZHOURS
    MINS
    zpo_release-FROMTIME
    zpo_release-TOTIME
    zpo_release-EXCLWKENDS.
    move zpo_release-REL_GRP to my_tab-REL_GRP.
    move zpo_release-REL_CODE to my_tab-REL_CODE.
    move zpo_release-RESPREL to my_tab-RESPREL.
    move zpo_release-ALTREL to my_tab-ALTREL.
    move zpo_release-MANAGER to my_tab-MANAGER.
    move ZHOURS to my_tab-ZHOURS.
    move MINS to my_tab-mins.
    move zpo_release-FROMTIME to my_tab-fromtime.
    move zpo_release-TOTIME to my_tab-totime.
    move zpo_release-EXCLWKENDS to my_tab-exclwkends.
    APPEND my_tab.
    ENDDO.
    INSERT zpo_release FROM TABLE my_tab ACCEPTING DUPLICATE KEYS.
    ** DELETE zmm_ppa_cc FROM TABLE tab.
    ** INSERT zzzak_emp FROM TABLE my_tab ACCEPTING DUPLICATE KEYS.
    IF sy-subrc = 0.
    MESSAGE i000(zv) WITH 'File Successful stored in DB.' '' '' ''.
    ** ELSE.
    MESSAGE i000(zv) WITH 'File already stored in DB.' '' '' ''.
    endif.
    ENDIF.
    reward if helpful
    raam

  • Determine Number of  rows in Internal Table

    Hi,
      I have defined my internal table as follows:
         TYPES : BEGIN OF ABC_KEY,
                  FIELD1(2)   TYPE C,
                  FIELD2(1)   TYPE C,
                  FIELD3(8)   TYPE N,
                  END OF ABC_KEY.
    DATA: itab1 TYPE TABLE OF ABC_KEY
                      WITH KEY FIELD1,
           wa_lines_1 LIKE LINE OF itab1.
    How can I retrieve the number of rows in Internal Table?
    Thanks.
    Regards,
    bw_newbie

    You can define the number of rows of the internal table using the DESCRIBE itab command .
    As the rest have already stated a sample code snippet .
    For more info type in DESCRIBE in your prgram and click on (F1) by placing the cursor on DESCRIBE .
    You will find more options as to how you can use the DESCRIBE command according to your requirement .
    Thanks ,
    Hari

  • How to Delete a Column in Internal Table

    Hi All,
    Does any one know ,How to Delete a Column in Internal Table?

    Hi,
       For deleting the column in the internal table, you have to eliminate the field which you want to delete.
    loop at itab into wa.
      move corresponding wa to wa1.
    append wa1 to itab1.
    clear wa1.
    clear wa.
    endloop.
    wa1 is the workarea without the field which you want to delete.
    itab1 is the internal table which consists of the deleted column.

  • How to delete records from dynamic internal table.

    Hi Experts,
    Need urgent help!!!
    Issue is with Dynamic internal tables.
    Below is code written by me :
    FORM select_query USING Lw_tabnam
                      TYPE  t682i-kotabnr.
      DATA :  lw_line  TYPE REF TO data,
              lw_line1 TYPE REF TO data.
        CREATE DATA Lw_line    TYPE (lw_TABNAM).
        ASSIGN      Lw_line->* TO   <WA_tbl>.
        CREATE DATA LW_LINE    TYPE STANDARD TABLE OF (Lw_tabnam)
                               WITH NON-UNIQUE DEFAULT KEY.
        ASSIGN      Lw_line->* TO <TBL>.
        SELECT * FROM  (Lw_tabnam)
                 INTO CORRESPONDING FIELDS OF TABLE <TBL>
                 WHERE (t_keys).
    Endform.
    code is working fine.
    here even the table name and where condition are dynamic,everything is fine upto this point.
    Now i have to delete some record from <TBL> based on some conditons.
         for ex : ( here lc_fieldname is KUNNR)
          loop at t_kunnr.
              lw_tabix = sy-tabix.
            Read table <tbl>
                    with key (lc_fieldname) = t_kunnr-kunnr ASSIGNING <wa_tbl>.
            If sy-subrc = 0.
            *Delete
            delete <tbl> from <wa_tbl>
    delete <tbl> index  lw_tabix.
            Endif.
         Endloop.
    The above delete statement doesn't work ,even we can't use index as it gives a syntax error " something related to "index is not allowed in standard table or hash table.
    Can you help me ab't how to delete records in Dynamic internal table?
    Other option that i am thinking of is to create a static table of type dynamic table.
    means, data itab type standard table of <tbl> .I know the syntax is wrong ,however is there any way to do this?
    Thanks in advance ,
    If you have any suggestion ab't this then do let me know.
    bye,
    Gaurav.

    Hi
    I wrote this code and it works fine:
    DATA LW_TABNAM(10) VALUE 'LFA1'.
    DATA : LW_LINES TYPE REF TO DATA,
           LW_LINE  TYPE REF TO DATA.
    FIELD-SYMBOLS: <TABLE> TYPE TABLE,
                   <WA>    TYPE ANY.
    CREATE DATA LW_LINES TYPE TABLE OF (LW_TABNAM)
    WITH NON-UNIQUE DEFAULT KEY.
    ASSIGN LW_LINES->* TO <TABLE>.
    CREATE DATA LW_LINE TYPE (LW_TABNAM).
    ASSIGN LW_LINE->* TO <WA>.
    DO 10 TIMES.
      APPEND INITIAL LINE TO <TABLE>.
    ENDDO.
    SY-TABIX = 4.
    DELETE <TABLE> INDEX SY-TABIX.
    WRITE SY-SUBRC.
    I hope it help you
    Max

  • How to scan data from one internal table to another

    Hi All,
    let me know how to scan all from one internal table to another internal table. Pls provide me the syntax and code.
    i am very thankful to you all in advance.
    Thanks & Regards,
    Nagarjuna.

    if u want to copy data from itab1 to itab2  then use
    itab2[] = itab1[].
    if u want to compare whether both itab1 and itab2 are same or not,use
    if itab1[] = itab2[].
    *--same
    else.
    *--not same
    endif.
    if u want to compare itabs based on primary key....
    loop at itab1.
    read table itab2 with key f1 = itab1-f1.
    if sy-subrc <> 0.
    *--not same....
    endif.
    endloop.
    if u want to copy only few lines(say from 1 to 3) of itab1 to itab2 then use...
    append lines of itab1 from 1 to 3 to itab2.
    if internal tables don't have same structure,
    say only fields f1 and f2 are common,then
    loop at itab1.
    itab2-f1 = itab1-f1.
    itab2-f2 = itab1-f2.
    append itab2.
    clear itab2.
    endloop.
    if there are many common fields then...
    loop at itab1.
    move-corresponding itab1 to itab2.
    append itab2.
    clear itab2.
    endloop.
    Please don't forget to reward points....!!!
    Regards
    vasu

  • How to read data from an internal table into a real table?

    Hello experts,
    I'm relatively new to ABAP and I'm trying to figure out how to read data from an internal table into a table that I created.  I'm trying to use the RRW3_GET_QUERY_VIEW_DATA function module to read data from a multiprovider.  I'm trying to read data from the e_cell_data and e_axis_data tables into a table that I've already created.  Please see code below.
    TABLES MULTITAB.
    DATA:
      query_name TYPE RSZCOMPID,
      s_cubename TYPE RSINFOPROV,
      t_cell_data TYPE RRWS_T_CELL,
      t_axis_data TYPE RRWS_THX_AXIS_DATA,
      t_axis_info TYPE RRWS_THX_AXIS_INFO,
      wa_t_cell_data like line of t_cell_data,
      wa_t_axis_data like line of t_axis_data,
      w_corp_tab like line of t_cell_data.
    s_cubename = 'CORP_MPO1'.
    query_name = 'Z_corp_test'.
        CALL FUNCTION 'RRW3_GET_QUERY_VIEW_DATA'
           EXPORTING
             i_infoprovider           = s_cubename
             i_query                  = query_name
            i_t_parameter            = query_string_tab
           IMPORTING
             e_cell_data              = t_cell_data
             e_axis_data              = t_axis_data
             e_axis_info              = t_axis_info.
    If anyone has any information to help me, I would greatly appreciate it.  Thanks.

    Hi,
    <li>Once you call the function module RRW3_GET_QUERY_VIEW_DATA, lets say data is available in the corresponding tables e_cell_data e_axis_data which you have mentioned.
    <li>Modify your internal table defined for other purpose, with data from e_cell_data e_axis_data like below.
    LOOP AT t_cell_data INTO wa_t_cell_data.
      "Get the required data from t_cell_data.
      MOVE-CORRESPONDING wa_t_cell_data TO it_ur_tab.
      "Modify your internal table wih data
      MODIFY it_ur_tab TRANSPORTING <field1> <field2> <field3>.
    ENDLOOP.
    LOOP AT t_axis_data INTO wa_t_axis_data.
      "Get the required data from t_cell_data.
      MOVE-CORRESPONDING wa_t_axis_data TO it_ur_tab.
      "Modify your internal table wih data
      MODIFY it_ur_tab TRANSPORTING <field1> <field2> <field3>.
    ENDLOOP.
    Thanks
    Venkat.O

  • How to move data from 2 internal table to 1 internal table

    Can any body send me code that how to move data from 2 internal table into one internal table.
    Moderator message : Read ABAP documentation. Thread locked.
    Edited by: Vinod Kumar on Jun 13, 2011 11:45 AM

    Hi Mohdarif92;
    I don't know your full needs. But general method should be as below code.
    Please check exam below code.
    Best regards.
    data : begin of gt_result.
                ... like mkpf-...
                ... like mkpf-...
                ... like mseg-...
                ... like mseg-...
              end of gt_result
    select *
    into table gt_mkpf
    from mkpf where ...
    select *
    into table mseg
    from mseg where ...
    loop at gt_mkpf.
         loop at gt_mseg where ... = mkpf-...
            move-corresponding gt_mkpf to gt_result.
            move-corresponding gt_mseg to gt_result.
            append gt_result
         endloop.
    endloop.

  • Grouping of two rows of internal table

    Hi all,
    I am having a requirement in which I want to group two rows of an internal table and assign a pointer to the two rows.
    This pointer variable will then be passed to ALV.
    Help reqd.
    regards.

    Hi Gaurav,
    Hope the below code helps:
    TYPES :BEGIN OF TY_ITAB2,
    DATA(400),
    END OF TY_ITAB2.
    DATA: ITAB3 TYPE TY_ITAB2 OCCURS 0 WITH HEADER LINE
    Loop at itab1.
    ITAB3-DATA = ITAB1-LABEL.
    APPEND ITAB3.
    ITAB3-DATA = ITAB1-MATNR.
    APPEND ITAB3.
    endloop.
                        or
    You can create a deep internal table. You can declare one Column as an internal table and store the NOTES in that Internal table for each row.
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm
    you can check the example in the link
    Kindly Reward Points If You Find The Reply Helpful.
    Cheers,
    Chaitanya.

  • Excel attachment contains only 1st row of Internal Table.

    Hello,
    I have designed a Vendor Ledger report and want to send the same as an excel attachment. I have made use of function module SO_NEW_DOCUMENT_ATT_SEND_API1 wherein I pass the parameters.
    The program works perfectly fine as I am receiving email along with the excel attachment. Also, the excel attachment opens without any errors. Also, the alignment of columns and data is perfect.
    But the problem is if my internal table is having 10 rows, I get only the first row of  the internal table in the excel sheet.
    I also put a break point just before calling the function module to send email, I could see that the internal table which contains the attachment is having all 10 rows.
    I really don't know what's going wrong in this.
    Request you to please help.
    Regards,
    Danish.

    Hi,
    Hi this is my code. Also, one thing I found that if i remove the Report Name i.e. "Vendor Ledger" , I get more than 1 row in my excel sheet. I feel there is some problem with the document size attributes.
    * Header for exception report
      CONCATENATE 'CC' 'Vendor' 'Stat' 'Name' 'Doc.No' 'FY' 'DDate' 'PDate'
                  'AssNo.' 'Doc.Tp' 'G/L' 'LAmt' 'LCurr' 'DAmt'
                  'D/C' 'Cl.Doc' 'TaxCd' 'TaxAmt'
                  INTO it_attachment SEPARATED BY
                  cl_abap_char_utilities=>horizontal_tab.
      CONCATENATE cl_abap_char_utilities=>cr_lf it_attachment INTO it_attachment.
      APPEND it_attachment.
    * Split Internal table data using horizontal tab.
      CLEAR it_main.
      LOOP AT it_main.
        CLEAR: lc_amt, dc_amt, tax_amt.
        lc_amt = it_main-lc_amount.
        dc_amt = it_main-amt_doccur.
        tax_amt = it_main-w_tax_base.
        CONCATENATE it_main-comp_code
                    it_main-vendor
                    it_main-status
                    it_main-name1
                    it_main-doc_no
                    it_main-fisc_year
                    it_main-doc_date
                    it_main-pstng_date
                    it_main-alloc_nmbr
                    it_main-doc_type
                    it_main-sp_gl_ind
                    lc_amt
                    it_main-loc_currcy
                    dc_amt
                    it_main-db_cr_ind
                    it_main-clr_doc_no
                    it_main-w_tax_code
                    tax_amt
                INTO it_attachment SEPARATED BY
                cl_abap_char_utilities=>horizontal_tab.
        CONCATENATE cl_abap_char_utilities=>cr_lf it_attachment INTO it_attachment.
        APPEND it_attachment.
      ENDLOOP.
    * Create Mail Body and Attachment.
      psubject = 'Vendor Ledger'.
      lv_message = 'Dear Sir/Madam,'.
      APPEND lv_message TO it_message.
      lv_message = ' '.
      APPEND lv_message TO it_message.
      lv_message = 'Attachment contain Vendor Ledger for Testing.'.
      APPEND lv_message TO it_message.
      lv_message = ' '.
      APPEND lv_message TO it_message.
      lv_message = ' '.
      APPEND lv_message TO it_message.
      lv_message = 'This is a System Generated Mail. Please do not reply.'.
      APPEND lv_message TO it_message.
    **Perform for populating mail characteristic info
      CLEAR gd_doc_data.
    * Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      READ TABLE it_attachment INDEX w_cnt.
      gd_doc_data-doc_size = 1.
      gd_doc_data-obj_name  = 'Danish'. "'SAPRPT'.
      gd_doc_data-obj_descr = psubject.
      gd_doc_data-sensitivty = 'F'.
    * Describe the body of the message
      CLEAR it_packing_list.
      REFRESH it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES it_packing_list-body_num.
      it_packing_list-doc_size = it_packing_list-body_num * 255.
      it_packing_list-doc_type = 'RAW'.
      APPEND it_packing_list.
    **Describe the attachment info
      CLEAR it_packing_list.
      it_packing_list-transf_bin = 'X'.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 1.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_attachment LINES  it_packing_list-body_num.
      it_packing_list-doc_type = 'XLS'.
      it_packing_list-obj_name = 'File'.
      it_packing_list-obj_descr = 'File'.
      it_packing_list-doc_size = it_packing_list-body_num * 255.
      APPEND it_packing_list.
      REFRESH it_receivers.
      CLEAR it_receivers.
      it_receivers-receiver = 'Email Address'.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      APPEND it_receivers.
    **Function Module to send mail
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = gd_doc_data
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = it_packing_list
          contents_bin               = it_attachment
          contents_txt               = it_message
          receivers                  = it_receivers
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
    Regards,
    Danish.

  • How to increase the length of internal table dynamically

    How to increase the length of internal table dynamically depending on the number of fields fetched into the internal table ?
    The requirement code :
    types: begin of t_data,
             form          like zscr_data_hdr-form,
             werks         like zscr_data_hdr-werks,
             matnr         like zscr_data_hdr-matnr,
             verid         like zscr_data_hdr-verid,
             lot           like zscr_data_hdr-lot,
             lot_qty       like zscr_data_hdr-lot_qty,
             udate         like zscr_data_hdr-udate,
             utime         like zscr_data_hdr-utime,
             zuser         like zscr_data_hdr-zuser,
             processed     like zscr_data_hdr-processed,
             defect        like zscr_defect_data-defect,
             vornr         like zscr_route_data-vornr,
             fld1          like zscr_defect_data-defect_val,
             fld2          like zscr_defect_data-defect_val,
             fld3          like zscr_defect_data-defect_val,
             fld4          like zscr_defect_data-defect_val,
             fld5          like zscr_defect_data-defect_val,
             fld6          like zscr_defect_data-defect_val,
             fld7          like zscr_defect_data-defect_val,
             fld8          like zscr_defect_data-defect_val,
             fld9          like zscr_defect_data-defect_val,
             fld10         like zscr_defect_data-defect_val,
             fld11         like zscr_defect_data-defect_val,
             fld12         like zscr_defect_data-defect_val,
             fld13         like zscr_defect_data-defect_val,
             fld14         like zscr_defect_data-defect_val,
             fld15         like zscr_defect_data-defect_val,
             fld16         like zscr_defect_data-defect_val,
             fld17         like zscr_defect_data-defect_val,
             fld18         like zscr_defect_data-defect_val,
             fld19         like zscr_defect_data-defect_val,
             fld20         like zscr_defect_data-defect_val,
             fld21         like zscr_defect_data-defect_val,
             fld22         like zscr_defect_data-defect_val,
             fld23         like zscr_defect_data-defect_val,
             fld24         like zscr_defect_data-defect_val,
             fld25         like zscr_defect_data-defect_val,
             fld26         like zscr_defect_data-defect_val,
             fld27         like zscr_defect_data-defect_val,
             fld28         like zscr_defect_data-defect_val,
             fld29         like zscr_defect_data-defect_val,
             fld30         like zscr_defect_data-defect_val,
             fld31         like zscr_defect_data-defect_val,
             fld32         like zscr_defect_data-defect_val,
             fld33         like zscr_defect_data-defect_val,
             fld34         like zscr_defect_data-defect_val,
             fld35         like zscr_defect_data-defect_val,
             fld36         like zscr_defect_data-defect_val,
             fld37         like zscr_defect_data-defect_val,
             fld38         like zscr_defect_data-defect_val,
             fld39         like zscr_defect_data-defect_val,
             fld40         like zscr_defect_data-defect_val,
             fld41         like zscr_defect_data-defect_val,
             fld42         like zscr_defect_data-defect_val,
             fld43         like zscr_defect_data-defect_val,
             fld44         like zscr_defect_data-defect_val,
             fld45         like zscr_defect_data-defect_val,
             fld46         like zscr_defect_data-defect_val,
             fld47         like zscr_defect_data-defect_val,
             fld48         like zscr_defect_data-defect_val,
             fld49         like zscr_defect_data-defect_val,
             fld50         like zscr_defect_data-defect_val,
             fld51         like zscr_defect_data-defect_val,
             fld52         like zscr_defect_data-defect_val,
             fld53         like zscr_defect_data-defect_val,
             fld54         like zscr_defect_data-defect_val,
             fld55         like zscr_defect_data-defect_val,
             fld56         like zscr_defect_data-defect_val,
             fld57         like zscr_defect_data-defect_val,
             fld58         like zscr_defect_data-defect_val,
             fld59         like zscr_defect_data-defect_val,
             fld60         like zscr_defect_data-defect_val,
             fld61         like zscr_defect_data-defect_val,
             fld62         like zscr_defect_data-defect_val,
             fld63         like zscr_defect_data-defect_val,
             fld64         like zscr_defect_data-defect_val,
             fld65         like zscr_defect_data-defect_val,
             fld66         like zscr_defect_data-defect_val,
             fld67         like zscr_defect_data-defect_val,
             fld68         like zscr_defect_data-defect_val,
             fld69         like zscr_defect_data-defect_val,
             fld70         like zscr_defect_data-defect_val,
             fld71         like zscr_defect_data-defect_val,
             fld72         like zscr_defect_data-defect_val,
             fld73         like zscr_defect_data-defect_val,
             fld74         like zscr_defect_data-defect_val,
             fld75         like zscr_defect_data-defect_val,
             fld76         like zscr_defect_data-defect_val,
             fld77         like zscr_defect_data-defect_val,
             fld78         like zscr_defect_data-defect_val,
             fld79         like zscr_defect_data-defect_val,
             fld80         like zscr_defect_data-defect_val,
             fld81         like zscr_defect_data-defect_val,
             fld82         like zscr_defect_data-defect_val,
             fld83         like zscr_defect_data-defect_val,
             fld84         like zscr_defect_data-defect_val,
             fld85         like zscr_defect_data-defect_val,
             fld86         like zscr_defect_data-defect_val,
             fld87         like zscr_defect_data-defect_val,
             fld88         like zscr_defect_data-defect_val,
             fld89         like zscr_defect_data-defect_val,
             fld90         like zscr_defect_data-defect_val,
             fld91         like zscr_defect_data-defect_val,
             fld92         like zscr_defect_data-defect_val,
             fld93         like zscr_defect_data-defect_val,
             fld94         like zscr_defect_data-defect_val,
             fld95         like zscr_defect_data-defect_val,
             fld96         like zscr_defect_data-defect_val,
             fld97         like zscr_defect_data-defect_val,
             fld98         like zscr_defect_data-defect_val,
             fld99         like zscr_defect_data-defect_val,
             fld100         like zscr_defect_data-defect_val,
             fld101         like zscr_defect_data-defect_val,
             fld102         like zscr_defect_data-defect_val,
             fld103         like zscr_defect_data-defect_val,
             fld104         like zscr_defect_data-defect_val,
             fld105         like zscr_defect_data-defect_val,
             fld106         like zscr_defect_data-defect_val,
             fld107         like zscr_defect_data-defect_val,
             fld108         like zscr_defect_data-defect_val,
             fld109         like zscr_defect_data-defect_val,
             fld110         like zscr_defect_data-defect_val,
             fld111         like zscr_defect_data-defect_val,
             fld112         like zscr_defect_data-defect_val,
             fld113         like zscr_defect_data-defect_val,
             fld114         like zscr_defect_data-defect_val,
             fld115         like zscr_defect_data-defect_val,
             fld116         like zscr_defect_data-defect_val,
             fld117         like zscr_defect_data-defect_val,
             fld118         like zscr_defect_data-defect_val,
             fld119         like zscr_defect_data-defect_val,
             fld120         like zscr_defect_data-defect_val,
             fld121         like zscr_defect_data-defect_val,
             fld122         like zscr_defect_data-defect_val,
             fld123         like zscr_defect_data-defect_val,
             fld124         like zscr_defect_data-defect_val,
             fld125         like zscr_defect_data-defect_val,
             fld126         like zscr_defect_data-defect_val,
             fld127         like zscr_defect_data-defect_val,
             fld128         like zscr_defect_data-defect_val,
             fld129         like zscr_defect_data-defect_val,
             fld130         like zscr_defect_data-defect_val,
             fld131         like zscr_defect_data-defect_val,
             fld132         like zscr_defect_data-defect_val,
             fld133         like zscr_defect_data-defect_val,
             fld134         like zscr_defect_data-defect_val,
             fld135         like zscr_defect_data-defect_val,
             dayst         like zscr_data_hdr-dayst,
           end of t_data.
    In this fld1 to fld135 are defined in internal table.
    But if the number of fields are more than 135 then the program is going to short dump.
    Some times fld1 to fid170 or more fields will be there in my internal table.
    Please suggest me how to make my requirement dynamic and display this data fetched into this internal table onto a .XLS file in the presentation server ?

    Hi
    You can try to use the type string:
    form like zscr_data_hdr-form,
    werks like zscr_data_hdr-werks,
    matnr like zscr_data_hdr-matnr,
    verid like zscr_data_hdr-verid,
    lot like zscr_data_hdr-lot,
    lot_qty like zscr_data_hdr-lot_qty,
    udate like zscr_data_hdr-udate,
    utime like zscr_data_hdr-utime,
    zuser like zscr_data_hdr-zuser,
    processed like zscr_data_hdr-processed,
    defect like zscr_defect_data-defect,
    vornr like zscr_route_data-vornr,
    fieldxx type string,
    dayst like zscr_data_hdr-dayst,
    end of t_data.
    So you can save you informations of every fld<n> concatenating their values into fieldxx.
    Max

  • Create an internal table with the rows of another internal table.

    Hi I want to know if posible to create an internal table structure with the  rows of another internal table?
    ex.
    If in i_tab column A has this values: row 1 = first, row 2 = second, row 3 = third.
    Now I want that the structure of my internal table be: first, second, third

    Hi,
    If you do this way then what will be the difference between the two table anyway?? First internal table has the same structure irrespective of which row you select. and you are going to store the data from each row to the rows of the second internal table. In that case, the structure of the internal table is the same as first table. and it would have same rows.
    Am I missing something here? or you want to declare the internal table with each field being the structure of the first table? In this case you'd have to do a dynamic declaration of data as the first table can have any no of rows then the second table would have any no of fields in the structure.
    Now if you know that your first internal table is going to have a fixed no of rows eg 3 rows then it becomes simple. Do the following then
    Data: begin of second_table occurs 0,
    first type <first_table type>,
    second type <first_table type>,
    third type <first_table type>,
    end of second_table.
    Regards
    Prasenjit

  • How to add additional field into output table for RFIDYYWT(Generic Withholding Tax Reporting)

    Hi Experts,
    How to add additional field into output table VENDORS/WH TAX TYPES AND CODES in RFIDYYWT(Generic Withholding Tax Reporting).
    I have no idea how to start with, please give some advice.
    Thanks!
    Ice

    Dear Ice,
    Use Append structure, see given link:
    https://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eb61446011d189700000e8322d00/content.htm
    Regards,
    Abbas.

  • How do we pass values and Internal tables to Sub-routines

    how do we pass values and Internal tables to Sub-routines

    Hi,
    You can use the USING..or TABLES..or Changing addition..
    Check this example.
    DATA: T_MARA TYPE STANDARD TABLE OF MARA.
    PERFORM DISPLAY USING T_MARA.
    FORM DISPLAY USING LT_MARA LIKE T_MARA.
    DATA: WA TYPE MARA.
    LOOP AT LT_MARA INTO WA.
      WRITE: / WA-MATNR.
    ENDLOOP.
    ENDFORM.
    Thanks
    Naren

Maybe you are looking for