Problem In Integrating 3 Internal Tables to make data for email attachment

Hi All,
I am facing a problem. I am having some data in 3 internal tables. Consider it Header Data, Details Data, Tail Data in 3 different Internal tables with different Fields.
Now I want to send this data as an attachment in email. Now the problem is I am integrating the data in 3 internal tables into 1 single internal table with the help of  following code :
loop at it1.
    concatenate it1-field1
                       it1-field2
        into itab.
        append itab.
endloop.
loop at it2.
    concatenate it2-field1
                       it2-field2
        into itab.
       append itab.
endloop.
similarly for 3rd internal table. But here it goes wrong.
For each and every field in each record, some specific number of characters are fixed. If any field doesn't uses those characters to complete, it has to leave the remaining characters blank and should start next field from there.
E.g.
Like record is :
AAA reserved chars : 10
XXX " " : 15
YYY " " : 8
so it should print like :
AAA XXX YYY .
But in attachment it is printing like :
AAAXXXYYY.
This is because I am using concatenate function. Please suggest me a way to integrate the data of 3 internal tables into a single internal table including the spaces reserved for each field.
Thanks.

Hi Ravi,
Did u try to use de addicion 'Separated by space'  in the concatenate function?
If it doesn't work, try this...
You have to do as if you want to create a text file, using de offset function.
Creating an internal table with one field and put all the records of your tables into this internal table.
data: wa_line(400).
data: begin of itab_line occurs 0,
           line(400),
        endif itab_line.
Loop at itab1.
clear wa_line.
write: itab1-field1 to wa_line+0(10).
write: itab1-field2 to wa_line+10(8).
write: itab1-fieldN to wa_line+nn(mm).
append wa_line to itab_line.
clear itab_line.
endloop.
Do the same with itab2 and itab3.
Cheers,
FC.

Similar Messages

  • How to fill internal table with no data in debugging mode

    Hi all,
             I modified one existing program.Now I want to test it.I am not given test data.So in the middle of my debugging, I found that one internal table with no data.My problem is how to fill that internal table with few records in that debugging mode just as we change contents in debugging mode.If I want to proceed further means that internal table must have some records.
    Please I dont know how to create test data so I am trying to create values temporarily in debugging mode only.
    Thanks,
    Balaji

    Hi,
    In the debugging do the following..
    Click the Table button..
    Double click on the internal table name..
    Then in the bottom of the screen you will get the buttons like CHANGE, INSERT, APPEND, DELETE..
    Use the APPEND button to insert records to the internal table..
    Thanks,
    Naren

  • Problem in processing internal table

    Hi All,
    Im facing some problem with an internal table with header.
    This is Xvbkd with heaer line.
    Header     100     0000000049     000010                         EXW     China
    1     100     0000000049     000000                         CIF     HK
    2     100     0000000049     000010                         CIF     HK
    3     100     0000000049     000020                         CIF     HK
    Now I want modify the internal table of 2nd record. The data above has modified in the header.but not reflected in the body.
    Here is my code:
    SELECT SINGLE inco1 inco2
                            INTO (knvv-inco1, knvv-inco2)
                            FROM knvv
                            WHERE kunnr EQ w_shipto
                              AND vkorg EQ vbak-vkorg
                              AND vtweg EQ vbak-vtweg
                              AND spart EQ vbak-spart.
                        IF sy-subrc EQ 0 AND
                            knvv-inco1 NE space or
                            knvv-inco2 NE space.
                          MOVE: knvv-inco1 TO wa_xvbkd-inco1,
                                knvv-inco2 TO wa_xvbkd-inco2.
                         READ table xvbkd with key vbeln = xvbap-vbeln
                                                    posnr = xvbap-posnr.
                          IF sy-subrc = 0.
                          xvbkd-inco1 = wa_xvbkd-inco1.
                          xvbkd-inco2 = wa_xvbkd-inco2.
                          modify table xvbkd from wa_xvbkd transporting  inco1 inco2.
                         endif.
                        ENDIF.
    Requirement: is the 2nd record(item 10) in above internal table has to reflect the change with EXW and China.
    Pls help me with ur valuable suggestions.
    Regards,
    Priya

    try,
    SELECT SINGLE inco1 inco2
                            INTO (knvv-inco1, knvv-inco2)
                            FROM knvv
                            WHERE kunnr EQ w_shipto
                              AND vkorg EQ vbak-vkorg
                              AND vtweg EQ vbak-vtweg
                              AND spart EQ vbak-spart.
                        IF sy-subrc EQ 0 AND
                            knvv-inco1 NE space or
                            knvv-inco2 NE space.
                          MOVE: knvv-inco1 TO xvbkd-inco1,
                                knvv-inco2 TO xvbkd-inco2.
                         READ table xvbkd with key vbeln = xvbap-vbeln
                                                    posnr = xvbap-posnr.
                          IF sy-subrc = 0.
                          modify xvbkd index sy-tabix.
                         endif.
                        ENDIF.
    Regards,
    John
    Edited by: jvanpelt on Jul 16, 2010 9:36 AM

  • Displaying an internal table with raw data in an ALV

    Hi Experts,
    Can you please help me out I'm retrieving an ABAP Report List which i submitted to memory, I'm using the function module LIST_FROM_MEMORY to retrieve the list from memory and storing it in an internal table. The problem is i'm struggling to display the List using an ALV coz the internal table contains raw data. Your help wil be much appreciated.

    My ASCII internal table is empty. Below I have included a code sample of what I want to do.
    Type-pools slis.
    DATA: MTAB_REPORT_LIST LIKE ABAPLIST OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF MTAB_REPORT_ASCII OCCURS 0,
            LINE(255) TYPE C,
          END OF MTAB_REPORT_ASCII.
    START-OF-SELECTION.
    *-- Submit a report.  This one is the chart of accounts
      SUBMIT ZPRINTREPORT
        EXPORTING LIST TO MEMORY           " Save list in memory
        AND RETURN.    " Return control to this program
    END-OF-SELECTION.
    *-- Get the list from memory
      CALL FUNCTION 'LIST_FROM_MEMORY'
           TABLES
                LISTOBJECT = MTAB_REPORT_LIST
           EXCEPTIONS
                NOT_FOUND  = 1
                OTHERS     = 2.
    if sy-subrc <> 0.
      write / 'unable 2 retrieve list from memory'.
    else.
    "REFRESH MTAB_REPORT_ASCII.
    CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
    listasci = MTAB_REPORT_ASCII " list converted to ASCII
    listobject = MTAB_REPORT_LIST
    EXCEPTIONS
    empty_list = 1
    list_index_invalid = 2
    OTHERS = 3.
    if sy-subrc = 1.
       write 'list ASCII list empty'.
    else.
    WRITE: MTAB_REPORT_ASCII, ' ff'.
    " perform build_alv tables MTAB_REPORT_LIST.
    endif.
    endif.
    "CALL FUNCTION 'WRITE_LIST'
    "      TABLES
    "           LISTOBJECT = MTAB_REPORT_LIST
    "      EXCEPTIONS
    "           EMPTY_LIST = 1
    "           OTHERS     = 2.
    FORM build_alv tables MTAB_REPORT_ASCII.
    ALV required data objects.
    "DATA: w_title   TYPE lvc_title,
    "        w_comm    TYPE slis_formname,
    "        w_status  TYPE slis_formname,
    "        x_layout  TYPE slis_layout_alv,
    "        t_event    TYPE slis_t_event,
    "        t_fieldcat TYPE slis_t_fieldcat_alv,
    "        t_sort     TYPE slis_t_sortinfo_alv.
    data int_fcat type SLIS_T_FIELDCAT_ALV.
    Layout
      x_layout-zebra = 'X'.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME         = sy-repid
                I_INTERNAL_TABNAME     = 'MTAB_REPORT_ASCII' 
                I_INCLNAME             = sy-repid
           CHANGING
                CT_FIELDCAT            = int_fcat
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM = sy-repid
                IT_FIELDCAT        = int_fcat
                I_SAVE             = 'A'
           TABLES
                T_OUTTAB           = MTAB_REPORT_ASCII
           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.
    ENDFORM.

  • How to get internal table from SAP Data Provider C#

    Hello.
    ABAP:
       DATA: lt_t001 TYPE TABLE OF t001.
       DATA: url(1000) TYPE c.
      SELECT * INTO TABLE lt_t001 FROM t001.
      CALL FUNCTION 'DP_CREATE_URL'
        EXPORTING
          type                 = 'APPLICATION'
          subtype           = 'X-R3TABLE'
        TABLES
          data                 = lt_t001
        CHANGING
          url                    = url
        EXCEPTIONS
          OTHERS           = 4.
    C#:
    using SAPDataProvider;
    using SAPTableFactoryCtrl;
    public void SetDataFromUrl(string url)
                SAPDataProviderClass p = new SAPDataProviderClass();
                p.SetDataFromURL("APPLICATION", "X-R3TABLE", url);
                ISapDPR3Table tbl = p.GetDataAsR3Table("APPLICATION", "X-R3TABLE");
                SAPTableFactoryClass tf = new SAPTableFactoryClass();
                Table tb = (Table)tf.NewTable();
                tb.ISAPrfcITab = tbl.DataTable; // Exception !!!!!!
    How to get internal table from SAP Data Provider ?

    Hi Sergey,
    I'm trying to do the same, have you found a solution to solved it?
    thanks for your help.
    Regards.
    Jonathan

  • Send An Internal Table Via Excel File As An Attachment of E-mail

    Hi,
    I've sent my internal table via Excel file as an attachment of email but all records of internal table are in a row of sended excel file.
    How can i send an internal table via excel file , records of internal table for each rows of excel file,as an attachment of email correctly?
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list     "   t_packing_list-doc_type   =  'XLS'.
                contents_bin               = pit_attach " this is a normal internal table.
                contents_txt               = pit_message
                receivers                  = t_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.

    Hi,
    CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.
    CONSTANTS:
    CON_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
    CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
          LOOP AT T_FINAL INTO WA_T_FINAL.
            CONCATENATE WA_T_FINAL-PERNR
                        WA_T_FINAL-NAME
                        WA_T_FINAL-LEVEL
                        WA_T_FINAL-POS
                        WA_T_FINAL-JOB
                        WA_T_FINAL-SECTION
                        WA_T_FINAL-DEPT
                        WA_T_FINAL-GROUP
                        WA_T_FINAL-EX_HEAD
                        WA_T_FINAL-SUPID
                        WA_T_FINAL-SUPNM
                        WA_T_FINAL-FHRNM
                        WA_T_FINAL-VACID
                        WA_T_FINAL-VAC_SECTION
                        WA_T_FINAL-VAC_DEPT
                        WA_T_FINAL-VAC_GROUP
                        WA_T_FINAL-VAC_EX_HEAD
                        WA_T_FINAL-VAC_FHRNM
            INTO T_FINAL3 SEPARATED BY CON_TAB.
            CONCATENATE CON_CRET T_FINAL3 INTO T_FINAL3.
            APPEND T_FINAL3.
          ENDLOOP.
    *Fill the document data.
      W_DOC_DATA-DOC_SIZE = 1.
    *Populate the subject/generic message attributes
      W_DOC_DATA-OBJ_LANGU = SY-LANGU.
      W_DOC_DATA-OBJ_NAME = 'REPORT'.
      W_DOC_DATA-OBJ_DESCR = LD_MTITLE . "mail description
      W_DOC_DATA-SENSITIVTY = 'F'.
    *Fill the document data and get size of attachment
      CLEAR W_DOC_DATA.
      READ TABLE T_FINAL1 INDEX W_CNT.
      W_DOC_DATA-DOC_SIZE =
      ( W_CNT - 1 ) * 255 + STRLEN( T_FINAL1 ).
      W_DOC_DATA-OBJ_LANGU = SY-LANGU.
      W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
      W_DOC_DATA-SENSITIVTY = 'F'.
      CLEAR T_ATTACHMENT.
      REFRESH T_ATTACHMENT.
      T_ATTACHMENT[] = PT_FINAL1[].
    *Describe the body of the message
      CLEAR T_PACKING_LIST.
      REFRESH T_PACKING_LIST.
      T_PACKING_LIST-TRANSF_BIN = SPACE.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 0.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = 'RAW'.
      APPEND T_PACKING_LIST.
    *Create 1st attachment notification
      T_PACKING_LIST-TRANSF_BIN = 'X'.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 1.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
      T_PACKING_LIST-OBJ_DESCR = 'Application 1'.
      T_PACKING_LIST-OBJ_NAME = 'Application 1'.
      T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
      APPEND T_PACKING_LIST.
      CLEAR T_PACKING_LIST.
    *Add the recipients email address
      CLEAR T_RECEIVERS.
      REFRESH T_RECEIVERS.
      T_RECEIVERS-RECEIVER = LD_EMAIL.
      T_RECEIVERS-REC_TYPE = 'U'.
      T_RECEIVERS-COM_TYPE = 'INT'.
      T_RECEIVERS-NOTIF_DEL = 'X'.
      T_RECEIVERS-NOTIF_NDEL = 'X'.
      APPEND T_RECEIVERS.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = W_DOC_DATA
          PUT_IN_OUTBOX              = 'X'
          SENDER_ADDRESS             = LD_SENDER_ADDRESS
          SENDER_ADDRESS_TYPE        = LD_SENDER_ADDRESS_TYPE
          COMMIT_WORK                = 'X'
        IMPORTING
          SENT_TO_ALL                = W_SENT_ALL
        TABLES
          PACKING_LIST               = T_PACKING_LIST
          CONTENTS_BIN               = T_ATTACHMENT
          CONTENTS_TXT               = IT_MESSAGE
          RECEIVERS                  = T_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.
    Edited by: Rahul Ghosh on Apr 6, 2009 6:42 AM

  • In which tables are the data for the aplication KSB1?

    I'm getting data from Qlik View with a BI tool called Qlik View.
    I need help to find in which tables are the data for KSB1 aplication.
    I've found something in COBK and COEP but there's more table involved since I didn't find all data.
    Somente can help me please?
    Regards.
    Robson

    I ran a trace and found some tables that may help you.
    COVP(View)
    CSKT
    CSLT
    CSKS
    CSKU
    AUFK
    Thanks
    Rathish

  • Problem in printing internal table data in Sapscript!

    Hi All,
    Am trying to print internal table data into main window of sapscript.
    This is what I have written.
    loop at it_final INTO wa_final.
                  CALL FUNCTION 'WRITE_FORM'
                   EXPORTING
                     window   = 'MAIN'
                     ELEMENT  = '670'
                     TYPE     = 'BODY'
                     FUNCTION = 'APPEND'
                   EXCEPTIONS
                     window  = 1
                     element = 2.
                 IF sy-subrc <> 0.
                 ENDIF.
    ENDLOOP.
    IN Sapscript :
    /E   670
    IT     &wa_final-vbeln&,,&wa_final-vbelv&,,&wa_final-payment&
    =      &wa_final-rundate&,,&wa_final-waers&,,&wa_final-creditcard&
    =      &wa_final-augru&,,&wa_final-dmbtr&
    Pls let me know if am missing anything.
    Thanks & Regards
    Himayat

    Check if your Programm is called at the Sapscript level.
    Are you calling the programm from the Sapscript using the PERFORM command? or are these Programm and Sapscript set in customizing?
    Using SE16 check the Message Type and see if Sapscript and the programm are connected at all.

  • HR abap :  how to declare internal table to fetch data from 0585 infotype

    Hi all ,
    I am able to fetch the data from pa0585 infotype for set of employee no , but the problem is as the fields in pa0585 (like Contr to ULIP , NSC , Medical Treatment,Contribution to Certain Pension Funds so on ..) will be changed dynamically and will be displayed based on the amount value in descending order iam not able to store the values of the fileds into internal table . I dont understand how to declare the internal table ..Please help in if u have solved this kind of problem.
    I shld get the output in this way ...
    Emp No     Name    Medical treatment       Contr to ULIP             ....... so on
    101          abc           10000                        150000                      .......so on
    102          xyz           12000                        150000                      .......so on
    My header shld be fixed and I shld display values in this way .... I can use write statement to display directly .
    Thanks ....

    Hi
    Decalre INFOTYPE
    Goto SE37 - Find FM -
    READINFOTYPE*

  • Problem in returning internal table from FM in ABAP Objects

    Hi All,
    I have to return an internal table from one of the FM i created in the controller class (_IMPL) of a view.
    The problem here is, the internal table i m getting here
    is of type to a structure!.
    but i have to return it as type ref to DATA, which cant be assigned directly.
    Now, my question is.. How can i convert ..
    internal table type structure
    to
    internal table type ref to DATA.
    Thanks and Regards,
    sudeep v d.

    Hi Sudeep.
    Can you see if something like this works for you?
    DATA: dref type ref to DATA.
    FIELD-SYMBOL: <fs> type ANY.
    LOOP AT <internaltable> INTO <structure>
    ASSIGN "<component_name>" component of <structure> TO <fs>
    CREATE DATA dref type <structure>.
    dref->* = <fs>.
    ENDLOOP.

  • Problem in displaying internal table contents to excel(color)

    Hello Gurus!!!!!
    The code is given below :-
    *& Module pool       ZDEMO_DOWNLD1
    PROGRAM  ZDEMO_DOWNLD1.
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    DATA : f_name(120) type c,
           f_name1(120) type c.
    case sy-ucomm.
    when 'ATTACH'.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
       DEF_FILENAME           = ' '
      DEF_PATH               = ' '
      MASK                   = ' '
      MODE                   = ' '
      TITLE                  = ' '
    IMPORTING
       FILENAME               = f_name
      RC                     =
    EXCEPTIONS
      INV_WINSYS             = 1
      NO_BATCH               = 2
      SELECTION_CANCEL       = 3
      SELECTION_ERROR        = 4
      OTHERS                 = 5
    *f_name = DEF_FILENAME.
    f_name1 = f_name.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endcase.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    type-pools ole2.
    data: h_excel type ole2_object, " Excel object
    h_mapl type ole2_object, " list of workbooks
    h_map type ole2_object, " workbook
    h_zl type ole2_object, " cell
    h_f type ole2_object, " font
    h_interior type ole2_object. " Color
    *tables: spfli.
    DATA: ls_emp TYPE zpm_emp_det,
           lt_emp TYPE zpm_emp_det OCCURS 0,
           l_projectname TYPE zpm_emp_item_det-project_name,
           l_projectname_last TYPE zpm_emp_item_det-project_name,
           l_empid TYPE zpm_emp_item_det-empid,
           l_empid_last TYPE zpm_emp_item_det-empid.
    DATA: l_projectname_key TYPE lvc_nkey,
          l_role_of_emp_key TYPE lvc_nkey,
          l_last_key TYPE lvc_nkey.
    DATA :  lt_project_main TYPE TABLE OF zsach_pm ,
            ls_project_main TYPE zsach_pm,
            lt_project TYPE zsach_pm OCCURS 0,
            ls_project TYPE zsach_pm.
    internal table for excel headings
    DATA : BEGIN OF lt_project_ex OCCURS 0,
             line(50) TYPE c,
           END OF lt_project_ex.
    DATA: lt_project1 TYPE zsach_pm OCCURS 0,
          ls_project1 TYPE zsach_pm.
    DATA :   lt_project_temp TYPE zsach_pm OCCURS 0 ,
             ls_project_temp TYPE zsach_pm.
    DATA: lt_project2 TYPE zsach_pm OCCURS 0,
          ls_project2 TYPE zsach_pm.
    TYPES: BEGIN OF st_username,
           username TYPE zuser_names-username,
           END OF st_username.
    DATA: it_tab TYPE TABLE OF st_username,
          wa_tab TYPE st_username.
    data : lt_project_excel like zsach_pm occurs 0 with header line.
    *DATA: f_name TYPE string.
    data h type i.
    table of flights
    data: it_spfli like spfli occurs 10 with header line.
    *& Event START-OF-SELECTION
        SELECT empid
               project_name
               role_of_emp
               competancy
               manager
               price_category
               rate_per_hour
               first_day_pro
               last_day_pro
               ckey
         FROM zpm_emp_item_det
         INTO CORRESPONDING FIELDS OF TABLE lt_project.
        LOOP AT lt_project INTO ls_project.
        ENDLOOP.
        SELECT projectid project_name client begin_date end_date
          FROM zpm_project_det
          INTO CORRESPONDING FIELDS OF TABLE lt_project_temp FOR ALL ENTRIES IN lt_project
          WHERE project_name = lt_project-project_name.
        LOOP AT lt_project_temp INTO ls_project_temp.
          MODIFY lt_project FROM ls_project_temp TRANSPORTING
            projectid project_name client begin_date end_date
            WHERE project_name = ls_project_temp-project_name.
        ENDLOOP.
        SELECT empid
               employee_name
               designation
               employee_type
               date_of_joining
        FROM zpm_emp_head_det
        INTO CORRESPONDING FIELDS OF TABLE lt_project1 FOR ALL ENTRIES IN lt_project
        WHERE empid = lt_project-empid.
        LOOP AT lt_project1 INTO ls_project1.
          MODIFY lt_project FROM ls_project1 TRANSPORTING
                empid
                employee_name
                designation
                employee_type
                date_of_joining
             WHERE empid = ls_project1-empid.
        ENDLOOP.
    tell user what is going on
    call function 'SAPGUI_PROGRESS_INDICATOR'
    exporting
    PERCENTAGE = 0
    text = text-007
    exceptions
    others = 1.
    start Excel
    create object h_excel 'EXCEL.APPLICATION'.
    perform err_hdl.
    set property of h_excel 'Visible' = 1.
    perform err_hdl.
    tell user what is going on
    call function 'SAPGUI_PROGRESS_INDICATOR'
    exporting
    PERCENTAGE = 0
    text = text-008
    exceptions
    others = 1.
    get list of workbooks, initially empty
    call method of h_excel 'Workbooks' = h_mapl.
    perform err_hdl.
    add a new workbook
    call method of h_mapl 'Add' = h_map.
    perform err_hdl.
    tell user what is going on
    call function 'SAPGUI_PROGRESS_INDICATOR'
    exporting
    PERCENTAGE = 0
    text = text-009
    exceptions
    others = 1.
    output column headings to active Excel sheet
    perform fill_cell using 1 1 1 'Project ID'(001).
    perform fill_cell using 1 2 1 'Emp ID'(002).
    perform fill_cell using 1 3 1 'Project Name'(003).
    perform fill_cell using 1 4 1 'Client'(004).
    perform fill_cell using 1 5 1 'Begin Date'(005).
    perform fill_cell using 1 6 1 'End Date'(006).
    perform fill_cell using 1 7 1 'Role of Employee'(007).
    perform fill_cell using 1 8 1 'Module / Competancy'(008).
    perform fill_cell using 1 9 1 'Employee name'(009).
    perform fill_cell using 1 10 1 'Price Category'(010).
    perform fill_cell using 1 11 1 'Rate P/H'(011).
    perform fill_cell using 1 12 1 '1st day in project'(012).
    perform fill_cell using 1 13 1 'Last day in project'(013).
    perform fill_cell using 1 14 1 'Currency'(014).
    perform fill_cell using 1 15 1 'Manager'(015).
    perform fill_cell using 1 16 1 'Emp Type'(016).
    perform fill_cell using 1 17 1 'Designation'(017).
    perform fill_cell using 1 18 1 'Joining Date'(018).
    perform fill_cell using 1 19 1 'Last Date'(019).
    loop at lt_project into ls_project.
    *lt_project_excel[] = lt_project[].
    endloop.
    copy flights to active EXCEL sheet
    h = sy-tabix + 1.
    *perform fill_cell1 using h 1 0 ls_project-PROJECTID.
    *perform fill_cell1 using h 2 0 ls_project-EMPID.
    *perform fill_cell1 using h 3 0 ls_project-PROJECT_NAME.
    *perform fill_cell1 using h 4 0 ls_project-client.
    *perform fill_cell1 using h 5 0 ls_project-BEGIN_DATE.
    *perform fill_cell1 using h 6 0 ls_project-END_DATE.
    *perform fill_cell1 using h 7 0 ls_project-ROLE_OF_EMP.
    *perform fill_cell1 using h 8 0 ls_project-COMPETANCY.
    *perform fill_cell1 using h 9 0 ls_project-EMPLOYEE_NAME.
    *perform fill_cell1 using h 10 0 ls_project-PRICE_CATEGORY.
    *perform fill_cell1 using h 11 0 ls_project-RATE_PER_HOUR.
    *perform fill_cell1 using h 12 0 ls_project-FIRST_DAY_PRO.
    *perform fill_cell1 using h 13 0 ls_project-LAST_DAY_PRO.
    *perform fill_cell1 using h 14 0 ls_project-CKEY.
    *perform fill_cell1 using h 15 0 ls_project-MANAGER.
    *perform fill_cell1 using h 16 0 ls_project-EMPLOYEE_TYPE.
    *perform fill_cell1 using h 17 0 ls_project-DESIGNATION.
    *perform fill_cell1 using h 18 0 ls_project-DATE_OF_JOINING.
    *perform fill_cell1 using h 19 0 ls_project-LAST_WORKING_DAT.
    perform fill_cell1 using h 1 0 lt_project_excel-PROJECTID.
    perform fill_cell1 using h 2 0 lt_project_excel-EMPID.
    perform fill_cell1 using h 3 0 lt_project_excel-PROJECT_NAME.
    perform fill_cell1 using h 4 0 lt_project_excel-client.
    perform fill_cell1 using h 5 0 lt_project_excel-BEGIN_DATE.
    perform fill_cell1 using h 6 0 lt_project_excel-END_DATE.
    perform fill_cell1 using h 7 0 lt_project_excel-ROLE_OF_EMP.
    perform fill_cell1 using h 8 0 lt_project_excel-COMPETANCY.
    perform fill_cell1 using h 9 0 lt_project_excel-EMPLOYEE_NAME.
    perform fill_cell1 using h 10 0 lt_project_excel-PRICE_CATEGORY.
    perform fill_cell1 using h 11 0 lt_project_excel-RATE_PER_HOUR.
    perform fill_cell1 using h 12 0 lt_project_excel-FIRST_DAY_PRO.
    perform fill_cell1 using h 13 0 lt_project_excel-LAST_DAY_PRO.
    perform fill_cell1 using h 14 0 lt_project_excel-CKEY.
    perform fill_cell1 using h 15 0 lt_project_excel-MANAGER.
    perform fill_cell1 using h 16 0 lt_project_excel-EMPLOYEE_TYPE.
    perform fill_cell1 using h 17 0 lt_project_excel-DESIGNATION.
    perform fill_cell1 using h 18 0 lt_project_excel-DATE_OF_JOINING.
    perform fill_cell1 using h 19 0 lt_project_excel-LAST_WORKING_DAT.
    *endloop.
    disconnect from Excel
    *CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
       DOCUMENT_DATA                    =
      PUT_IN_OUTBOX                    = ' '
      SENDER_ADDRESS                   = SY-UNAME
      SENDER_ADDRESS_TYPE              = 'B'
      COMMIT_WORK                      = ' '
    IMPORTING
      SENT_TO_ALL                      =
      NEW_OBJECT_ID                    =
      SENDER_ID                        =
    TABLES
       PACKING_LIST                     =
      OBJECT_HEADER                    =
      CONTENTS_BIN                     =
      CONTENTS_TXT                     =
      CONTENTS_HEX                     =
      OBJECT_PARA                      =
      OBJECT_PARB                      =
       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
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    free object h_excel.
    perform err_hdl.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    FORM FILL_CELL *
    sets cell at coordinates i,j to value val boldtype bold *
    form fill_cell using i j bold val.
    call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
    perform err_hdl.
    set property of h_zl 'Value' = val .
    perform err_hdl.
    get property of h_zl 'Font' = h_f.
    perform err_hdl.
    set property of h_f 'Bold' = bold .
    perform err_hdl.
    SET PROPERTY OF h_f 'ColorIndex' = 11 .
    perform err_hdl.
    endform.
    *& Form fill_cell1
    text
    -->P_H text
    -->P_1 text
    -->P_0 text
    -->P_IT_SPFLI_CARRID text
    form fill_cell1 using i j bold val.
    call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
    perform err_hdl.
    set property of h_zl 'Value' = val .
    perform err_hdl.
    get property of h_zl 'Font' = h_f.
    perform err_hdl.
    set property of h_f 'Bold' = bold .
    perform err_hdl.
    SET PROPERTY OF h_f 'ColorIndex' = 14 .
    perform err_hdl.
    endform. " fill_cell1
    *& Form ERR_HDL
    outputs OLE error if any *
    --> p1 text
    <-- p2 text
    form err_hdl.
    if sy-subrc <> 0.
    write: / 'Error in OLE-Automation:'(010), sy-subrc.
    stop.
    endif.
    endform. " ERR_HDL
    Entire excel file is displayed ,but the problem is I want to display the excel file in one shot i.e not <b>line by line</b>
    Kindly suggest if there is any keyword or FM to display the contents in excel using internal table.
    It should not take much time. Just by executing code , the contents of internal table should be displayed.
    Helpful answers will be rewarded
    Thanks,
    Sachin

    Hi Kavitha,
    maybe it's not sophisticated enough for your requirement, but I found function XXL_FULL_API easy to use. This will give same functionality as 'download' button in ALV-Grid display.
    Regards,
    Christian

  • [internal tables] TYPES or DATA

    Hi,
    starting with ABAP and try to understand internal tables. The structure
    of an internal table isn't quiet clear. They have a work area and a table body,
    but why do I need a additionally type of line?
    Is this content, my tutorial uses DATA to define the itab and TYPES to define
    the workarea (type of line). I don't really understand the different between those
    commands.
    Does anyone got a good web blog to understand internal tables completly?
    thx
    chris

    Hi,
    The Statements TYPES and DATA
    Each ABAP program define its own data types using the statement.
    TYPES dtype TYPE type ...
    and declare its own variables or instance attributes of classes using the statement
    DATA var {TYPE type} ...
    Within the program or a class, you can also define local data types and variables within procedures. Local variables in procedures obscure identically-named variables in the main program or class.
    When creating data types and data objects, there are a number of naming convention that also apply for other local program definitions, such as procedures. These are described in detail in the keyword documentation.
    The Additions TYPE and LIKE
    The additions TYPE type and LIKE dobj are used in various ABAP statements. The additions can have various meanings, depending on the syntax and context.
    ·        Definition of local types in a program
    ·        Declaration of data objects
    ·        Dynamic creation of data objects
    ·        Specification of the type of formal parameters in subroutines
    ·        Specification of the type of formal parameters in methods
    ·        Specification of the type of field symbols
    Constructing New Data Types
    The TYPE addition allows you to construct new data types in the TYPES, DATA; CONSTANTS; and STATICSstatements. In the TYPES statement, these are local data types in the program. In the other statements, they are attributes of new data objects, meaning that the newly defined data types are not free-standing. Rather, they are linked to database objects.This means that you can refer to them using the LIKEaddition, but not using TYPE.
    To construct new data types, the addition TYPE can be used with the following type constructors:
    ·        Construction of reference types
    REF TO type|dobj
    ·        Construction of structured data types
    BEGIN OF struc_type.
    END OF struc_type.
    ·        Construction of table types
    tabkind OF linetype
    These data types only exist during the runtime of the ABAP program.
    Referring to Known Data Types or Data Objects
    Using the additions TYPE or LIKE in the TYPESstatement, local data types in a program can be referred to known data types or data objects. This is mainly the case with user-defined elementary data types. If you declare variables using the additions TYPE type or LIKE dobj with statement DATA, the data type of var is already fully defined before the declaration is made.
    The known types or data that are referred to must be visible at the point where the data type or variable is declared.
    A known data type can be any of the following:
    ·        A predefined ABAP type to which you refer using the TYPE addition
    ·        An existing local data type in the program to which you refer using the TYPE addition
    ·        The data type of a local data object in the program to which you refer using the LIKE addition
    ·        A data type in the ABAP Dictionary to which you refer using the TYPE addition. To ensure compatibility with earlier releases, it is still possible to use the LIKE addition to refer to database tables and flat structures in the ABAP Dictionary. However, you should use the TYPE addition in new programs.
    The LIKE addition takes its technical attributes from a visible data object. As a rule, you can use LIKE to refer to any object that has been declared using DATA or a similar statement, and is visible in the current context.  The data object only has to have been declared. It is irrelevant whether the data object already exists in memory when you make the LIKE reference.
    ·        In principle, the local data objects in the same program are visible. As with local data types, there is a difference between local data objects in procedures and global data objects. Data objects defined in a procedure obscure other objects with the same name that are declared in the global declarations of the program.
    ·        You can also refer to the data objects of other visible ABAP programs. These might be, for example, the visible attributes of global classes in class pools. If a global class cl_lobal has a public instance attribute or static attribute attr, you can refer to it as follows in any ABAP program:
    DATA dref TYPE REF TO cl_global.
    DATA:  f1 LIKE cl_global=>attr,
           f2 LIKE dref->attr.
    You can access the technical properties of an instance attribute using the class name and a reference variable without first having to create an object. The properties of the attributes of a class are not instance-specific and belong to the static properties of the class.
    TYPES: BEGIN OF struct,
             number_1 TYPE i,
             number_2 TYPE p DECIMALS 2,
           END OF struct.
    DATA:  wa_struct TYPE struct,
           number    LIKE wa_struct-number_2,
           date      LIKE sy-datum,
           time      TYPE t,
           text      TYPE string,
           company   TYPE s_carr_id.
    This example declares variables with reference to the internal type STRUCT in the program, a component of an existing data object wa_struct, the predefined data object SY-DATUM, the predefined ABAP type t and STRING, and the data element S_CARR_ID from the ABAP Dictionary.
    Referring to Generic Data Types
    If you refer to one of the generic predefined ABAP types of fixed length (c, n, p, x) in the TYPES or DATA statement, you must specify the undefined technical attributes.
    TYPES|DATA var[(length)] TYPE type ...
    TYPES|DATA var TYPE type ...
    DATA: text1,
          text2 LENGTH 2,
          text3 TYPE c LENGTH 3,
          pack TYPE p DECIMALS 2 VALUE '1.225'.
    This example creates three character variables with field lengths of one, two, and three bytes respectively, and a packed number variable with field length 8 bytes and two decimal places. If the attribute Fixed point arithmetic is set, the value of pack is 1.23.
    This example shows how to declare elementary data objects with reference to predefined ABAP types.
    PROGRAM demo_elementary_data_objects.
    DATA text1  TYPE c LENGTH 20.
    DATA text2  TYPE string.
    DATA number TYPE i.
    text1 = 'The number'.
    number = 100.
    text2 = 'is an integer.'.
    WRITE: text1, number, text2.
    This program produces the following output on the screen:
    The number              100 is an integer.
    In this example, the data objects text1, text2 and number are declared with the DATA statement. The technical attributes are determined by referring to the predefined ABAP types c, string, and I. Values from unnamed literals are assigned to the data objects. The contents of the named data objects are displayed on the list.
    Specifying a Start Value
    When you declare an elementary fixed-length variable, the DATAstatement automatically fills it with the type-specific initial value as listed in the table in the Predefined ABAP Types section.
    However, you can also specify a starting value of a fixed-length elementary variable (also within a structure declaration) using the VALUE addition in the DATAstatement:
    DATA var ... VALUE val|{IS INITIAL}.
    Specifying start values:
    DATA: counter TYPE p VALUE 1,
          date    TYPE d VALUE '19980601',
          flag    TYPE n VALUE IS INITIAL.
    After this data declaration, the character string flag contains its type specific
    Initial value ‘0’.
    Regarsd

  • Problem populating an internal table

    Hello,
    I am having a problem with filling an internal table. I cannot seem to grasp this and I struggle with this in every program. I am attaching pieces of my program so that maybe someone can help me. I have a selection screen that I populate with dates. if the dates are populated, I want to use these dates for the selection. If the dates are initial, I want to read an entry from the TVARV table and populate the dates that will used in the selection. I tried various code statements and I cannot get it to work. i get messages like "is a table without a header line and therefore has no component "LOW" or other messages similar to this. I would like that if the s_udate is populated, I could fill the tvarv table and not have to call the form.
    also if anyone has some documentation on working with internal tables without header lines (I think I read in here that internal tables without header lines is the way to go ), could you please include that as well so that I could try to understand how this suppose to work 
    thanks in advance for the help
    TYPES: BEGIN OF ty_tvarv_date,
            low     TYPE   tvarv_val,          "start date
            high    TYPE   tvarv_val,          "end date
           END OF ty_tvarv_date.
    TYPES: ty_t_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date INITIAL SIZE 0,
    DATA   it_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date INITIAL SIZE 0.
    SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(22) text-002.
    SELECT-OPTIONS s_udate FOR sy-datlo.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK a.
    PERFORM select_date_tvarv CHANGING it_tvarv_date.
    PERFORM select_data643_mseg USING    it_tvarv_date
                                         it_zfi_gl_subcontrk[]
                                  CHANGING it_mseg643.
    <b>*******************************************************************</b>
    FORM select_date_tvarv CHANGING p1_it_tvarv_date TYPE ty_t_tvarv_date.
    IF s_udate IS INITIAL.
      SELECT low high
        FROM tvarv
        INTO  TABLE p1_it_tvarv_date
        WHERE name EQ  'Z_SUBCONTRK_DATES'.
      IF sy-subrc NE 0.
        IF sy-batch IS INITIAL.
          MESSAGE i899 WITH text-027.
          LEAVE LIST-PROCESSING.
        ELSE.
          MESSAGE e899 WITH text-027.
        ENDIF.
      ENDIF.
    ELSE.
         MOVE s_udate to p1_it_tvarv_date.
         MOVE s_udate-low(8)  to p1_it_tvarv_date-low.
         MOVE s_udate-high(8) to p1_it_tvarv_date-high.
    ENDIF.
    ENDFORM. " FORM SELECT_DATE_TVARV
    <b>*******************************************************************</b>
    FORM select_data643_mseg USING p1_tvarv_date       TYPE ty_t_tvarv_date
                                   p1_zfi_gl_subcontrk TYPE ty_t_zfi_gl_subcontrk
                          CHANGING p1_it_mseg          TYPE ty_t_mseg643.
      DATA: wa_tvarv_date type ty_tvarv_date.
      READ TABLE p1_tvarv_date INTO wa_tvarv_date INDEX 1.
      SELECT abukrs  awerks amatnr aerfmg a~erfme
             akostl abwart amblnr awempf acharg akzbew algort bbudat
        FROM mseg AS a INNER JOIN mkpf AS b ON amblnr EQ bmblnr
          AND b~budat <= wa_tvarv_date-high
          AND b~budat >= wa_tvarv_date-low
            INTO TABLE p1_it_mseg
            FOR ALL ENTRIES IN p1_zfi_gl_subcontrk
            WHERE a~bukrs   EQ p1_zfi_gl_subcontrk-bukrs_from
            AND   a~werks   EQ p1_zfi_gl_subcontrk-werks_from
            AND   a~wempf   EQ p1_zfi_gl_subcontrk-werks_to643
            AND   a~matnr   EQ p1_zfi_gl_subcontrk-matnr
            AND   a~bwart   EQ'643'.
      IF sy-subrc NE 0.
        IF sy-batch IS INITIAL.
          MESSAGE i899 WITH text-027.
          LEAVE LIST-PROCESSING.
        ELSE.
          MESSAGE e899 WITH text-027.
        ENDIF.
      ENDIF.
    ENDFORM. " FORM SELECT_DATA643_MSEG

    In tables with header line, you need not define an explicit work area.
    System will create a so-called work area, which is called header line.
    This header line is like any other work area. the difference is that it can be accessed using internal table name. A record will be by default read into header line in a READ statement.
    For ex,
    READ TABLE p1_tvarv_date INTO wa_tvarv_date INDEX 1.
    Here you used to read the 1st record into wa_tvarv_date.
    But after making it table with header line you can use
    READ TABLE p1_tvarv_date INDEX 1.
    This will move the data to header line and it can be accessed by name p1_tvarv_date.
    See the code below.
    TYPES: BEGIN OF ty_tvarv_date,
    low TYPE tvarv_val, "start date
    high TYPE tvarv_val, "end date
    END OF ty_tvarv_date.
    TYPES: ty_t_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date INITIAL SIZE 0,
    DATA it_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date <b>WITH HEADER LINE INITIAL</b> SIZE 0.
    SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(22) text-002.
    SELECT-OPTIONS s_udate FOR sy-datlo.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK a.
    PERFORM select_date_tvarv CHANGING it_tvarv_date.
    PERFORM select_data643_mseg USING it_tvarv_date
    it_zfi_gl_subcontrk[]
    CHANGING it_mseg643.
    FORM select_date_tvarv CHANGING p1_it_tvarv_date TYPE ty_t_tvarv_date.
    IF s_udate IS INITIAL.
    SELECT low high
    FROM tvarv
    INTO TABLE p1_it_tvarv_date
    WHERE name EQ 'Z_SUBCONTRK_DATES'.
    IF sy-subrc NE 0.
    IF sy-batch IS INITIAL.
    MESSAGE i899 WITH text-027.
    LEAVE LIST-PROCESSING.
    ELSE.
    MESSAGE e899 WITH text-027.
    ENDIF.
    ENDIF.
    ELSE.
    MOVE s_udate to p1_it_tvarv_date.
    MOVE s_udate-low(8) to p1_it_tvarv_date-low.
    MOVE s_udate-high(8) to p1_it_tvarv_date-high.
    ENDIF.
    ENDFORM. " FORM SELECT_DATE_TVARV
    FORM select_data643_mseg USING p1_tvarv_date TYPE ty_t_tvarv_date
    p1_zfi_gl_subcontrk TYPE ty_t_zfi_gl_subcontrk
    CHANGING p1_it_mseg TYPE ty_t_mseg643.
    <b>READ TABLE p1_tvarv_date INDEX 1.</b>
    SELECT abukrs awerks amatnr aerfmg a~erfme
    akostl abwart amblnr awempf acharg akzbew algort bbudat
    FROM mseg AS a INNER JOIN mkpf AS b ON amblnr EQ bmblnr
    <b>AND b~budat <= p1_tvarv_date-high
    AND b~budat >= p1_tvarv_date-low</b>
    INTO TABLE p1_it_mseg
    FOR ALL ENTRIES IN p1_zfi_gl_subcontrk
    WHERE a~bukrs EQ p1_zfi_gl_subcontrk-bukrs_from
    AND a~werks EQ p1_zfi_gl_subcontrk-werks_from
    AND a~wempf EQ p1_zfi_gl_subcontrk-werks_to643
    AND a~matnr EQ p1_zfi_gl_subcontrk-matnr
    AND a~bwart EQ'643'.
    IF sy-subrc NE 0.
    IF sy-batch IS INITIAL.
    MESSAGE i899 WITH text-027.
    LEAVE LIST-PROCESSING.
    ELSE.
    MESSAGE e899 WITH text-027.
    ENDIF.
    ENDIF.
    ENDFORM. " FORM SELECT_DATA643_MSEG

  • Problem in declaring internal table

    hai experts ,
    i am new to web dynpro abap .. my problem is i want to declare a internal table for a table using the web dynpro code wizard .. i found many threads regarding that .. but for mee its not working .. many of them posted that get_static_attributes_table method will solve the problem .. but i used the method in the wizard but it saying that method does not  exist ..pls solve the problem ..
    say where to enter the method in the wizard ..
    thanks & kind regards
    chinnaiya

    Hi Chinnaiya,
    Your post isnt that clear as to what you intend to do. Do you intend to just create an internal table declaration which would be able to hold your context nodes data or do you wish to use the get_static_attributes method to fetch all your tables data into this internal table?
    If you want to just declare an internal table which can hold the data then you would have to do it manually. You can't generate your internal table declaration using the code wizard. Suppose your context nodes name is SFLIGHT then you can use the below syntax to declare a table & work area respectively.
    DATA: lt_sflight TYPE wd_this->elements_sflight,  " Internal table
                wa_sflight TYPE wd_this->element_sflight.  " Work area
    For each node <node> of a controller context, a structure type element_<node> is implicitly generated in the interface IF_<ctrl>. The structure fields correspond to the attributes a node element consists of. Similarly for each node <node> of a controller context, a standard table type elements_<node> is implicitly generated in the interface IF_<ctrl>. The line type of this table is element_<node>. This constant can be used to
    type an internal table that can hold the attributes of multiple node elements. So as how said here you can even declare the work area and internal table like shown below in your MAIN view:
    DATA: lt_sflight TYPE if_main=>elements_sflight,  " internal table
               wa_sflight TYPE if_main=>element_sflight.  " work area
    But the disadvantage of this approach as how pointed out by Thomas in 1 of this earlier threads is that this coding works fine only for this particular view. If you copy the same code and try to use it in another view say VIEW1 then it wouldn't work as the interface name would have changed from if_main to if_view1. So its suggested to use the earlier approach.
    Regards,
    Uday

  • Problem in convering internal table to CSV file

    Hi,
    Iam converting internal table data to CSV format with the code given below.
    LOOP AT it_details_final INTO wa_details_final.
    CLEAR : t_attachment.
    CONSTANTS : c_sep TYPE c VALUE ','.
    CONCATENATE wa_details_final-wf_rectype
                             wa_details_final-wf_bankn
                             wa_details_final-wf_znme1
                             wa_details_final-wf_rzawe
                             wa_details_final-wf_lifnr
                             wa_details_final-wf_chect
                             wa_details_final-wf_rwbtr
                             wa_details_final-wf_chkladat
                        cl_abap_char_utilities=>newline
               INTO t_attachment SEPARATED BY c_sep.
    APPEND t_attachment.
        CLEAR t_attachment.
      ENDLOOP.
    Problem is ,data in one of the fields contain comma ( , ).
    So, data after comma is getting shifted to the adjacent cell.
    Please help me
    Thanks & Regards,
    Sravanthi

    Hello,
    Try this perform
    the ignorefields variable is used if you dont want a particular field in the output. You can ignore it for now
      DATA: p_ignoredfields(1024).
    CONSTANTS : const_sep TYPE c VALUE ','.
    * itab to store data ready to be sent to csv file
      DATA: BEGIN OF wa_csvdata,
        line(4096),
      END OF wa_csvdata.
      DATA: gt_csvdata LIKE TABLE OF wa_csvdata.
    *&      Form  CONVERT_TO_CSV
    *       text
    FORM convert_to_csv  TABLES   lt_datatab USING value(p_ignoredfields).
      FIELD-SYMBOLS: <wa_datatab> TYPE ANY.
      FIELD-SYMBOLS: <wa_field> TYPE ANY.
    * character variable incase table fields are of a diff type (ie: int)
      DATA: lv_data TYPE string.
    * set to X if the no data has been put into the csv workarea
      DATA: flag_firstcol TYPE xflag.
    * move the structure one character to the right since first char
    *  is position 0 in SAP
      SHIFT p_ignoredfields BY 1 PLACES RIGHT.
      REFRESH gt_csvdata.
      CLEAR wa_csvdata.
      LOOP AT lt_datatab ASSIGNING <wa_datatab>.
        flag_firstcol = 'X'.
        DO.
    *  one by one assign each position of the structure to the field
          ASSIGN COMPONENT sy-index OF STRUCTURE <wa_datatab> TO <wa_field>.
          IF sy-subrc <> 0.
            EXIT.
          ELSE.
    *  if the current field needs to be ignored then continue the do loop
            IF p_ignoredfields+sy-index(1) = '.'.
              CONTINUE.
            ENDIF.
    *  we use lv_data since concatenate fails for integer types
            lv_data = <wa_field>.
    *  remove commas in the data
            WHILE sy-subrc = 0.
              REPLACE const_sep WITH '' INTO lv_data.
            ENDWHILE.
    *       if this data belongs to the first non ignored column
            IF flag_firstcol = 'X'.
              wa_csvdata = lv_data.
              flag_firstcol = ''.
            ELSE.
              CONCATENATE wa_csvdata const_sep lv_data INTO wa_csvdata.
            ENDIF.
          ENDIF.
        ENDDO.
        APPEND wa_csvdata TO gt_csvdata.
        CLEAR wa_csvdata.
      ENDLOOP.
    ENDFORM.                    " CONVERT_TO_CSV

Maybe you are looking for