Export Internal table by calling static method

Hi friends,
Can u please tell me how to get internal table in export parameter by calling static method.
OR  can u tell me how to declare internal table in method parameter.
Thanks in advance

Raja's method will work for all tables irrespective of the structure and is the best possible approach.  However, if your requirement is simple and you do not have to deal with a lot many tables,
1. Create a Type-Pool, suppose ztypl
2. Within the type pool, declare a Structure type,
TYPES: BEGIN OF ztypl_struct1,
         "Place your fields here
       END OF ztypl_strict1,
       "Create a table of type ztypl_struct1 here
       ztypl_table1 TYPE TABLE OF ztypl_struct1.
Use "ZTYPL_TABLE1" as the "Associated type" in your method's Parameter definition in SE24.
eg.
IT_TABLE      TYPE     ZTYPL_TABLE1
If you are writing your class in an include,
    METHODS my_method1
      IMPORTING
        it_table1   TYPE ztypl_table1.
Do remember to include
TYPE-POOLS: ztypl.
in your class's Constructor / Include program.
Please award points if helpful.
Regards,
Ryan
Message was edited by:
        Ryan Cannel

Similar Messages

  • Export internal table to Excel file pressing a new button created in ALV

    Hello, I am trying to implement the functionality to export to excel file inside a button that i have created into my ALV. I don't want to use FileDownload UI.
    The code I have set for event handler of this button is the following:
    METHOD attach_files .
      TYPES:
        BEGIN OF tipo_alv_tab,
          tipod    TYPE objid,
          descd   TYPE p1000-stext,
          begda   TYPE begdatum,
          endda   TYPE enddatum,
          pernr     TYPE pernr_d,
          nombre  TYPE ad_namefir,
          email     TYPE ad_smtpadr,
          posicion TYPE p1000-stext,
          uodesc   TYPE p1000-stext,
        END OF tipo_alv_tab.
      DATA:
        i_alv_tab    TYPE TABLE OF tipo_alv_tab,
        conv_out     TYPE REF TO cl_abap_conv_out_ce,
        content      TYPE xstring,
        lv_filename  TYPE string,
        xml_out      TYPE string.
    Fill values from memory
      IMPORT name1 TO i_alv_tab  FROM MEMORY ID 'ZCA'.
    Build XML file with internal table information
      CALL TRANSFORMATION ('ID') SOURCE tab = i_alv_tab[] RESULT XML xml_out.
    Build XSTRING with XML
      CALL FUNCTION 'CRM_IC_XML_STRING2XSTRING'
        EXPORTING
          instring   = xml_out
        IMPORTING
          outxstring = content.
    Format XSTRING
      conv_out = cl_abap_conv_out_ce=>create( encoding = 'UTF-8'  ).
    Convert data
      conv_out->convert( EXPORTING data = xml_out IMPORTING buffer = content ).
    Save file
      CALL METHOD cl_wd_runtime_services=>attach_file_to_response
        EXPORTING
          i_filename      = 'Excel File.xls'
          i_content       = content
          i_mime_type     = 'application/msexcel'
          i_in_new_window = i_in_new_window
          i_inplace       = i_inplace.
    ENDMETHOD.
    When pressing the button, the file created is without extension, and with a rare name. When trying to open the file, it seems to be corrupted.
    Does anyone know what am I doing wrong???
    Please, help is really really appreciated!!!!

    Hi Jorge,
    The export data to excel functionality is available inbuilt in ALV and you dont have to write any implementation. However, if you want to create your own button for it, you can do so as below.
    data:
    lr_button type ref to cl_salv_wd_fe_button,
    lr_function type ref to cl_salv_wd_function.
    CREATE OBJECT lr_button.
    lr_button->set_text( 'Export to excel' ).
    lr_button->set_tooltip( 'Export data to excel' ).
    lr_function = l_alv_model->if_salv_wd_function_settings~create_function( id = 'EXCEL' ).
    lr_function->set_function_std( IF_SALV_WD_C_STD_FUNCTIONS=>EXPORT_EXCEL ).
    lr_function->set_editor( lr_button ).
    Now, you have created your own button, created a user defined function for the ALV and set this button as editor for the function. And using the set_function_std method, we have just mapped the functionality of your new button to the existing export to excel functionality in ALV.
    Hope this is what you are looking for.
    Regards
    Nithya

  • How to pass a internal table used in one method to another method in a view

    hi all,
    Is it possible to pass a internal table from one method to another method in a view??
    If so , kindly help me.

    Hi Bala,
    If you want to pass this internal table between different methods of the same view then write the contents of this internal table to a context node of your view using BIND_TABLE. You can then read the contents of this internal table from the other method using the reference of that node & the GET_STATIC_ATTRIBUTES_TABLE method.
    However if you want to pass the internal table between methods of different views then create a context node at the COMPONENTCONTROLLER level & then do a context mapping of this node to your local views context in both your views. You can follow the same BIND_TABLE & GET_STATIC_ATTRIBUTES_TABLE methods approach.
    Regards,
    Uday

  • Problem while exporting internal table to memory id using EXPORT

    Hi friends,
    Iam facing a following problem.
    I have 4 line items in my va01 tcode.
    now when i give material number and quantity and hit enter the processing for that line item starts.
    iam moving that current line item to a internal table lt_vbap in userexit_check_vbap.
    now for the 2nd line item also i have to move to internal table lt_vbap.
    but my problem is that in internal table lt_vbap iam not getting all the line items.
    every time the current line item is being processed the the previous line items are being refreshed.
    from lt_vbap internal table.
    how can i export internal table.
    code
    move vbap to lt_vbap.
    append lt_vbap.
    export lt_vbap to memory id 'ZXYZ'.

    >
    Prakash Pandey wrote:
    > Hi Priyanka,
    >
    > The internal table lt_vbap will always be empty unless you import it from the Memory ID (in your case ZXYX).
    >
    > Use the code this way:
    >
    > IMPORT lt_vbap FROM MEMORY ID 'ZXYX'.
    >
    > move vbap to lt_vbap.
    >
    > append lt_vbap.
    >
    > export lt_vbap to memory id 'ZXYZ'.
    >
    > Regards,
    > Prakash Pandey
    The memory id shud be same in both cases

  • Export INTERNAL TABLE to shared buffer

    Hi all,
    My requirement:
    Export INTERNAL TABLE to shared buffer or SAP Memory.
    Any help will be appreciated.
    Can SET/GET parameter be adopted for internal tables?
    Thanks,
    Tabraiz

    EXPORT (OBJ_TAB) TO MEMORY ID 'ABCD'
    also refer to
    http://help.sap.com/saphelp_45b/helpdata/en/34/8e73a36df74873e10000009b38f9b8/content.htm

  • Import/export internal tabl

    Hi,
    This is regarding import/export internal table to 2 different prog, somehow when i execute in prog ztest_hl7, it doesnt work. Please help.
    report ztest_hl7.
    TYPES:
    BEGIN OF tab_type,
    para TYPE string,
    dobj TYPE string,
    END OF tab_type.
    DATA:
    id TYPE c LENGTH 10 VALUE 'TEXTS',
    text1 TYPE string VALUE `IKE`,
    text2 TYPE string VALUE `TINA`,
    line TYPE tab_type,
    itab TYPE STANDARD TABLE OF tab_type.
    line-para = 'P1'.
    line-dobj = 'TEXT1'.
    APPEND line TO itab.
    line-para = 'P2'.
    line-dobj = 'TEXT2'.
    APPEND line TO itab.
    EXPORT itab TO MEMORY ID id.
    submit ztest_hl6 and return.
    report ztest_hl6.
    data : id TYPE c LENGTH 10 VALUE 'TEXTS'.
    TYPES:
    BEGIN OF tab_type,
    para TYPE string,
    dobj TYPE string,
    END OF tab_type.
    DATA: itab TYPE STANDARD TABLE OF tab_type,
         wa_itab type tab_type.
    IMPORT itab FROM MEMORY ID id.
    loop at itab into wa_itab.
    write:
    wa_itab-para,
    wa_itab-dobj.
    endloop.
    Edited by: Hui Leng Yeoh on Jun 26, 2008 11:25 AM

    Hi There are few syntax errors. Comment ur code and Paste this code and check. It is working fine.
    report ztest_hl7.
    TYPES:
    BEGIN OF tab_type,
    para TYPE string,
    dobj TYPE string,
    END OF tab_type.
    DATA:
    id(10) TYPE c VALUE 'TEXTS',
    text1 TYPE string, " VALUE `IKE`,
    text2 TYPE string, " VALUE `TINA`,
    line TYPE tab_type,
    itab TYPE STANDARD TABLE OF tab_type.
    text1 = 'IKE'.
    text2 = 'TINA'.
    line-para = 'P1'.
    line-dobj = 'TEXT1'.
    APPEND line TO itab.
    line-para = 'P2'.
    line-dobj = 'TEXT2'.
    APPEND line TO itab.
    EXPORT itab TO MEMORY ID id.
    SUBMIT z7569411 AND RETURN.
    data : id(10) TYPE c VALUE 'TEXTS'.
    TYPES:
    BEGIN OF tab_type,
    para TYPE string,
    dobj TYPE string,
    END OF tab_type.
    DATA: itab TYPE STANDARD TABLE OF tab_type,
    wa_itab type tab_type.
    IMPORT itab FROM MEMORY ID id.
    loop at itab into wa_itab.
    write:
    wa_itab-para,
    wa_itab-dobj.
    endloop.
    Thanks,
    vinod.

  • JUNIT : how to call static methods through mock objects.

    Hi,
    I am writing unit test cases for an action class. The method which i want to test calls one static method of a helper class. Though I create mock of that helper class, but I am not able to call the static methods through the mock object as the methods are static. So the control of my test case goes to that static method and again that static method calls two or more different static methods. So by this I am testing the entire flow instead of testing the unit of code of the action class. So it can't be called as unit test ?
    Can any one suggest me that how can I call static methods through mock objects.

    The OP's problem is that the object under test calls a static method of a helper class, for which he wants to provide a mock class
    Hence, he must break the code under test to call the mock class instead of the regular helper class (because static methods are not polymorphic)
    that wouldn't have happened if this helper class had been coded to interfaces rather than static methods
    instead of :
    public class Helper() {
        public static void getSomeHelp();
    public class MockHelper() {
        public static void getSomeHelp();
    }do :
    public class ClassUnderTest {
        private Helper helper;
        public void methodUnderTest() {  // unchanged
            helper.getSomeHelp();
    public interface Helper {
        public void getSomeHelp();
    public class HelperImpl implements Helper {
        public void getSomeHelp() {
            // actual implementation
    public class MockHelper implements Helper {
        public void getSomeHelp() {
            // mock implementation
    }

  • Exporting Internal Table from Methods

    Hi Experts,
    I wanted to export an internal table from Methods and I am using below syntax and its not working.
    METHODS get_data IMPORTING value(s_matnr) type mara-matnr
                     exporting it_tab TYPE STANDARD TABLE itab.
    Please let me know what is the proper syntax.
    Thanks
    Basanagouda

    Hi,
    Define itab as a 'table type' of standard table.
    Example: TYPES: t_sflight TYPE STANDARD TABLE OF sflight.
    METHODS : get_data IMPORTING s_carrid type sel_carrid
    EXPORTING e_tab type t_sflight.
    ENDCLASS

  • Exporting internal table in a oops

    hi friends,
    I have to pass internal table to a method and export that internal table.
    now when i am passing this internal table i am getting the last value of the table..
    i am enclosing code here please go through and modify me regarding this..
    REPORT  ZTEST_ABAP_PROXY.
    DATA PRXY TYPE REF TO ZCO_MI_PROXY_OUTBOUND.
    DATA: BEGIN OF I_MARA OCCURS 0,
      MATNR LIKE MARA-MATNR,
      ERNAM LIKE MARA-ERNAM,
      END OF I_MARA.
    CREATE OBJECT PRXY.
    DATA IT TYPE  ZMT_PROXY_OUTBOUND OCCURS 0 WITH HEADER LINE.
    TRY.
        SELECT MATNR ERNAM INTO TABLE I_MARA FROM MARA UP TO 10 ROWS.
        LOOP AT I_MARA.
          IT-MT_PROXY_OUTBOUND-MATNR = I_MARA-MATNR.
          IT-MT_PROXY_OUTBOUND-ERNAM = I_MARA-ERNAM.
          APPEND IT.
        ENDLOOP.
        CALL METHOD PRXY->EXECUTE_ASYNCHRONOUS
          EXPORTING
            OUTPUT = IT.
        COMMIT WORK.
      CATCH CX_AI_SYSTEM_FAULT .
        DATA FAULT TYPE REF TO CX_AI_SYSTEM_FAULT .
        CREATE OBJECT FAULT.
        WRITE :/ FAULT->ERRORTEXT.
    ENDTRY.
    i need to pass all the values of internal table to output at once..
    Thanks and Regards
    Vijay

    Hi Vijay,
    I think the problem is with the output parameter.
    Might be I'll give you the background and then explain you the problem. This may help.
    In the older release of ABAP there used to be Tables as one of the tabs where one could import/export tables to/from the FM. The problem was that it would difficult to identify what table are being imported and what are bein exported.
    So with later releases of ABAP this tab was removed and currently there are Exporting/Importing/Changing tabs. You can use changing in your case if you are passing the table to modify the same.
    Now the problem.
    As stated above the OUTPUT is a line type (means structure) while IT is a internal table with header lines. So the record in the wa of this table is only transferred to OUTPUT.
    What needs to be done.
    You need to change the type of the OUTPUT to table type. I am not sure if you know about table type.
    You can create a Table Type is se11 under Data Type.
    I hope this helps.
    Regards,
    Saurabh

  • Export internal table from report to web-dynpro

    Hi,
    I am trying to export an internal table from a report to my web dynpro pragram however its not working.
    Statement used in my report -
    EXPORT it_ordbk FROM it_ordbk TO MEMORY ID 'ZORDBK'.
    Statement used in my web dynpro program
    IMPORT it_ordbk to it_ordbk  FROM MEMORY ID 'ZORDBK'.
    This dynpro application is being called in HTML container on the screen.
    Kindly help.
    Cordially,
    Danish

    Hi Danish,
    do not use export or import in Webdynpro.
    try to create a class with global variables and in the report or at the place of Export fille the data .
    and next in the place of Import memory to to call the global variable in the webdynpro and fill the internal table
    go to se24> create a zclasss->  methods initialize>create a ztable same as export table and also declare in glaobal vairaible
    --> next in the webdynpro program -->call the method retrive and push the global data to internal table.
    Prabhudas

  • Unable to Capture ALV output in an Internal Table, after CALL TRANSACTION

    Dear all,
    My requirement is to run multiple materials in T-code CK86_99 but as we know CK86_99 is only adequate to one material at a time.
    So, I want to capture the Output of the T-code in my Internal table with respect to all the Material Numbers I use in the Select-Options of my Z Program.
    Below is the Code I developed so far, but the Class
    cl_salv_bs_runtime_info=>get_data_ref(
            IMPORTING r_data = lf_ref ).
    is not capturing the Ouput...
    Please have a look and enlighten me how it could be solved.
    TABLES : mara.
    DATA : BEGIN OF wa_mara,
      matnr TYPE mara-matnr,
      END OF wa_mara.
    DATA: it_bdcdata TYPE TABLE OF bdcdata,
          wa_it_bdcdata LIKE LINE OF it_bdcdata,
          it_mara LIKE TABLE OF wa_mara.
    *      BELNR(10).
    FIELD-SYMBOLS:<fs_tab> TYPE ANY TABLE,
    <fs_line> TYPE any.
    DATA:lf_ref TYPE REF TO data,
         lf_ref1 TYPE REF TO data.
    SELECT-OPTIONS so_matnr FOR mara-matnr.
    PARAMETERS p_werks LIKE t001w-werks.
    *BELNR = 'Z92'. " Give Document Number here
    SELECT matnr FROM mara INTO TABLE it_mara WHERE matnr IN so_matnr.
    DATA opt TYPE ctu_params.
    LOOP AT it_mara INTO wa_mara.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-program  = 'SAPMKKB0'.
    wa_it_bdcdata-dynpro   = '0300'.
    wa_it_bdcdata-dynbegin = 'X'.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'BDC_CURSOR'.
    wa_it_bdcdata-fval = 'KKB0-MATNR'.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'KKB0-MATNR'.
      wa_it_bdcdata-fval = wa_mara-matnr.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'BDC_CURSOR'.
    wa_it_bdcdata-fval = 'KKB0-WERKS'.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
      wa_it_bdcdata-fnam = 'KKB0-WERKS'.
    wa_it_bdcdata-fval = p_werks.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'BDC_OKCODE'.
    wa_it_bdcdata-fval = 'OSNY'."'ONLI'."=CRET'.
      APPEND wa_it_bdcdata TO it_bdcdata.
    *  CLEAR wa_it_bdcdata.
    * wa_it_bdcdata-program  = 'SAPLKKRSOO'.
    * wa_it_bdcdata-dynpro   = '0100'.
    * wa_it_bdcdata-dynbegin = 'X'.
    *  APPEND wa_it_bdcdata TO it_bdcdata.
    *  CLEAR wa_it_bdcdata.
    * wa_it_bdcdata-fnam = 'BDC_OKCODE'.
    *  wa_it_bdcdata-fval = 'BACK'."=CRET'.
    *  APPEND wa_it_bdcdata TO it_bdcdata.
    *  CLEAR wa_it_bdcdata.
    * wa_it_bdcdata-program  = 'SAPMKKB0'.
    * wa_it_bdcdata-dynpro   = '0300'.
    * wa_it_bdcdata-dynbegin = 'X'.
    *  APPEND wa_it_bdcdata TO it_bdcdata.
    *  CLEAR wa_it_bdcdata.
    * wa_it_bdcdata-fnam = 'BDC_OKCODE'.
    * wa_it_bdcdata-fval = 'EXIT'."=CRET'.
    *  APPEND wa_it_bdcdata TO it_bdcdata.
      opt-dismode = 'N'.
    cl_salv_bs_runtime_info=>set(
        EXPORTING display  = abap_false
                  metadata = abap_true
    data     = abap_true ).
      CALL TRANSACTION 'CK86_99' USING it_bdcdata OPTIONS FROM opt.
      TRY.
    cl_salv_bs_runtime_info=>get_data_ref(
            IMPORTING r_data = lf_ref ).
          ASSIGN lf_ref->* TO <fs_tab>.
        CATCH cx_salv_bs_sc_runtime_info.
          MESSAGE 'Unable to retrieve ALV data' TYPE 'E'.
      ENDTRY.
    cl_salv_bs_runtime_info=>clear_all( ).
      IF <fs_tab> IS ASSIGNED.
        CREATE DATA lf_ref1 LIKE LINE OF <fs_tab>.
        ASSIGN lf_ref1->* TO <fs_line>.
      ENDIF.
    *LOOP AT <FS_TAB> ASSIGNING <FS_LINE>.
    *ENDLOOP.

    Hi Abhay,
          If you go to Transaction code SE93, enter the tcode "CK86_99" and click display, you may see the default value for transaction is "KKBB" and the screen field for P_SCREEN = 0300, P_TCODE = ck86_99.
          You may need to copy the transaction code "KKBB" and go to SE93 again, enter the tcode for "KKBB" then click display, now you may see the program name is "RKKB1000".
          Hope this answer your question.
    Thanks
    Hock Lin

  • How to export internal table and pass the internal table to another screen?

    Hi,
    I have a sql SELECT statement that select data from table into internal table. I would like to export out the internal table and pass to another screen and display the data in ALV list. How to export it out? I try but the error given was " The type of "OUT_SELECT_ITAB" cannot be converted to the type of  "itab_result".
    Another question is, how to pass the internal table that i export out from the function module to another screen?
    Here is the code
    ==============================================================
    FUNCTION ZNEW_SELECT_ZSTUD00.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(IN_SELECT_YEAR) TYPE  ZSTUD00-EYEAR
    *"  EXPORTING
    *"     REFERENCE(OUT_RESULT) TYPE  CHAR9
    *"     REFERENCE(OUT_SELECT_ITAB) TYPE  ZSTUD00
    *& Global Declarations
    DATA: itab TYPE ZSTUD00,
          itab_result TYPE TABLE OF ZSTUD00.
    *& Processing Blocks called by the Runtime Environment
    itab-eyear = IN_SELECT_YEAR.
    SELECT *
    FROM ZSTUD00
    INTO TABLE itab_result
    WHERE eyear = IN_SELECT_YEAR.
    IF sy-subrc = 0.
      out_result = 'Success'.
      OUT_SELECT_ITAB = itab_result.
    ELSE.
      out_result = 'Fail'.
    ENDIF.
    ENDFUNCTION.
    ===============================================================
    Please advise. Thanks
    Regards,
    Rayden

    Hi Nagaraj,
    I try to change it in Tables tab page but it state that TABLES parameters are obsolete. when i "Enter". I try to "Enter" again. it seem to be ok but it stil give me the same error.
    ================================================================
    FUNCTION ZNEW_SELECT_ZSTUD00.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(IN_SELECT_YEAR) TYPE  ZSTUD00-EYEAR
    *"  EXPORTING
    *"     REFERENCE(OUT_RESULT) TYPE  CHAR9
    *"  TABLES
    *"      OUT_SELECT_ITAB STRUCTURE  ZSTUD00
    *& Global Declarations
    DATA: itab TYPE ZSTUD00,
          itab_result TYPE TABLE OF ZSTUD00.
    *& Processing Blocks called by the Runtime Environment
    itab-eyear = IN_SELECT_YEAR.
    SELECT *
    FROM ZSTUD00
    INTO TABLE itab_result
    WHERE eyear = IN_SELECT_YEAR.
    IF sy-subrc = 0.
      out_result = 'Success'.
      OUT_SELECT_ITAB = itab_result.
    ELSE.
      out_result = 'Fail'.
    ENDIF.
    ENDFUNCTION.
    ===============================================================
    regards,
    Rayden

  • Export Internal Table to XML in Background

    Hi
    I need to export a internal table into xml file in background using open dataset. The file is getting created but i am not able to open the file using IE/XML editor . When i open the file uisng wordpad i can see some charcters at the end of file which prevents it from opening in xml editor. if i delete the characters(box like) and save the file. i am able to open the file
    When i downalod the same internal table via frontend using ws_downlod it works pefectly. no junk charcters are appended in the end. and hence files opens perfectly
    below is the extract of program
    START-OF-SELECTION.
       PERFORM get_data.
       PERFORM create_xml.
    FORM get_data.
       REFRESH accesos.
       CLEAR accesos.
       MOVE: '45050' TO accesos-socio-numero,
                     'MOISES MORENO' TO accesos-socio-nombre,
                     '0' TO accesos-socio-reposicion.
       APPEND accesos.
    ENDFORM.
    i am using the following function modules
    CALL FUNCTION 'SDIXML_DATA_TO_DOM'
            EXPORTING
                 name         = 'ACCESOS'
                 dataobject   = accesos[]
            IMPORTING
                 data_as_dom  = l_dom
    CHANGING
                 document     = m_document
            EXCEPTIONS
                 illegal_name = 1
                 OTHERS       = 2.
           CHECK NOT l_dom IS INITIAL.
    w_rc = m_document->append_child( new_child = l_dom ).
    CALL FUNCTION 'SDIXML_DOM_TO_XML'
    EXPORTING
    document      = m_document
    IMPORTING
    xml_as_string = w_string
    size          = w_size
    TABLES
    xml_as_table  = it_xml
    EXCEPTIONS
    no_document   = 1
    OTHERS        = 2.
    LOOP AT it_xml INTO xml_tab-d.
         APPEND xml_tab.
       ENDLOOP.
    The following syntax for open datset which does not work
      lv_physcial_file = '
    hdat03\test.xml'.
    OPEN DATASET lv_physcial_file IN BINARY MODE   FOR OUTPUT MESSAGE l_msg.
       LOOP AT xml_tab.
         TRANSFER xml_tab TO lv_physcial_file.
       ENDLOOP.
    The ws_download function works
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
                   BIN_FILESIZE = W_SIZE
                   FILENAME = GK_RUTA
                   FILETYPE = 'BIN'
    TABLES
                   DATA_TAB = XML_TAB
    EXCEPTIONS
                   OTHERS = 10.
    many thnaks

    Hi Chetan,
    Can you just try changing the syntax to the following, I not sure if that will help but just try and see.
    OPEN DATASET  lv_physcial_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    Regards
    Mohamed

  • Export Internal Table To E-Mail via attachted html or PDF file

    i have an ALV display report for which the data is in the internal table.
    Can anybody tell me how can i attach the simple  internal table as an attachment to the mail ...
    give me example  code if possible
    Maximum points will be given
    thanks in advance.

    here is the sample code but this code gives you two attachemetns as .xls files you try analyse and try it for PDF
    you have to change in the packed_list parameter that is passed to the FM.
    REPORT ZDOC_AS_EMAIL_3.
    *& Report ZEMAIL_ATTACH *
    *& Example of sending external email via SAPCONNECT *
    TABLES: ekko.
    PARAMETERS: p_email TYPE somlreci1-receiver.
    TYPES: BEGIN OF t_ekpo,
    ebeln TYPE ekpo-ebeln,
    ebelp TYPE ekpo-ebelp,
    aedat TYPE ekpo-aedat,
    matnr TYPE ekpo-matnr,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
    wa_ekpo TYPE t_ekpo.
    TYPES: BEGIN OF t_charekpo,
    ebeln(10) TYPE c,
    ebelp(5) TYPE c,
    aedat(8) TYPE c,
    matnr(18) TYPE c,
    END OF t_charekpo.
    DATA: wa_charekpo TYPE t_charekpo.
    DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
    WITH HEADER LINE.
    DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
    WITH HEADER LINE.
    DATA: l_t_objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
    DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
    t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    w_cnt TYPE i,
    w_sent_all(1) TYPE c,
    w_doc_data LIKE sodocchgi1,
    gd_error TYPE sy-subrc,
    gd_reciever TYPE sy-subrc.
    *START_OF_SELECTION
    START-OF-SELECTION.
    *Retrieve sample data from table ekpo
    PERFORM data_retrieval.
    *Populate table with detaisl to be entered into .xls file
    PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    *Populate message body text
    perform populate_email_message_body.
    *Send file by email as .xls speadsheet
    PERFORM send_file_as_email_attachment
                        tables it_message
                                it_attach
                            using p_email
        'Example . xls documnet attachment'
                                     'XLS'
                                'filename'
                        changing gd_error
                              gd_reciever.
    *Instructs mail send program for SAPCONNECT to send email(rsconn01)
    PERFORM initiate_mail_execute_program.
    *& Form DATA_RETRIEVAL
    *Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
    SELECT ebeln ebelp aedat matnr
    UP TO 10 ROWS
    FROM ekpo
    INTO TABLE it_ekpo.
    ENDFORM. " DATA_RETRIEVAL
    *& Form BUILD_XLS_DATA_TABLE
    *Build data table for .xls document
    FORM build_xls_data_table.
    *CONSTANTS: con_cret(2) TYPE c VALUE '0D', "OK for non Unicode
    *con_tab(2) TYPE c VALUE '09'. "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    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.
    CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
    INTO it_attach SEPARATED BY con_tab.
    CONCATENATE con_cret it_attach INTO it_attach.
    APPEND it_attach.
    LOOP AT it_ekpo INTO wa_charekpo.
    CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
    wa_charekpo-aedat wa_charekpo-matnr
    INTO it_attach SEPARATED BY con_tab.
    CONCATENATE con_cret it_attach INTO it_attach.
    APPEND it_attach.
    ENDLOOP.
    ENDFORM. " BUILD_XLS_DATA_TABLE
    *& Form SEND_FILE_AS_EMAIL_ATTACHMENT
    *Send email
    FORM send_file_as_email_attachment tables pit_message
                                              pit_attach
                                           using p_email
                                                p_mtitle
                                                p_format
                                              p_filename
                                        p_attdescription
                                        p_sender_address
                                    p_sender_addres_type
                                        changing p_error
                                              p_reciever.
    DATA: ld_error TYPE sy-subrc,
    ld_reciever TYPE sy-subrc,
    ld_mtitle LIKE sodocchgi1-obj_descr,
    ld_email LIKE somlreci1-receiver,
    ld_format TYPE so_obj_tp ,
    ld_attdescription TYPE so_obj_nam ,
    ld_attfilename TYPE so_obj_des ,
    ld_sender_address LIKE soextreci1-receiver,
    ld_sender_address_type LIKE soextreci1-adr_typ,
    ld_receiver LIKE sy-subrc.
    ld_email = p_email.
    ld_mtitle = p_mtitle.
    ld_format = p_format.
    ld_attdescription = p_attdescription.
    ld_attfilename = p_filename.
    ld_sender_address = p_sender_address.
    ld_sender_address_type = p_sender_addres_type.
    *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 it_attach INDEX w_cnt.
    w_doc_data-doc_size =
    ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
    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[] = pit_attach[].
    *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 = 0.
    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 = ld_attdescription.
    t_packing_list-obj_name = ld_attfilename.
    t_packing_list-doc_size = t_packing_list-body_num * 255.
    APPEND t_packing_list.
    **Create 1st attachment notification
    *t_packing_list-transf_bin = 'X'.
    *t_packing_list-head_start = 0.
    *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 = ld_attdescription.
    *t_packing_list-obj_name = ld_attfilename.
    *t_packing_list-doc_size = t_packing_list-body_num * 255.
    *APPEND t_packing_list.
    **Create 2nd attachment notification
    data: x type i.
    DESCRIBE TABLE t_attachment LINES X.
    append lines of it_attach to t_attachment.
    data: start type i,
          end type i,
          cal type i.
    start = X + 1.
    describe table t_attachment lines end.
    cal = end - start.
    t_packing_list-transf_bin = 'X'.
    t_packing_list-head_start = 0.
    t_packing_list-head_num = 1.
    t_packing_list-body_start = start.
    t_packing_list-body_num = end.
    *DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
    t_packing_list-obj_descr = 'Eng Change'. "ld_attdescription.
    t_packing_list-doc_type = ld_format.
    *t_packing_list-obj_name = 'Eng' .
    t_packing_list-doc_size = t_packing_list-body_num * 255.
    APPEND 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
    object_header = l_t_objhead
    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.
    *Populate zerror return code
    ld_error = sy-subrc.
    *Populate zreceiver return code
    LOOP AT t_receivers.
    ld_receiver = t_receivers-retrn_code.
    ENDLOOP.
    ENDFORM.
    *& Form INITIATE_MAIL_EXECUTE_PROGRAM
    *Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
    WAIT UP TO 2 SECONDS.
    SUBMIT rsconn01 " WITH mode = 'INT'
    "WITH output = 'X'
    AND RETURN.
    ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    *Populate message body text
    form populate_email_message_body.
    REFRESH it_message.
    it_message = 'Please find attached a list test ekpo records'.
    APPEND it_message.
    endform. " POPULATE_EMAIL_MESSAGE_BODY
    Edited by: S@N on Jun 13, 2008 2:06 PM

  • Help on calling static method in a multithreaded environment

    Hi,
    I have a basic question.. pls help and it is urgent.. plss
    I have a class with a static method which does nothing other than just writing the message passed to a file. Now i have to call this static method from many threads..
    What actually happens ???
    Does all the thread start to execute the static method or one method executes while the other threads wait for the current thread to complete execution?. I am not talking about synchronizing the threads...my question is what happens when multiple threads call a static method??
    Pls reply.. I need to design my project accordingly..
    Thanks
    Rajeev

    HI Omar,
    My doubt is just this..
    I wanted to know what might happen if two threads try to access a static method.. Logically only one thread can use the method since it is only only copy... but i was wondering what might happens if f threads try to access the same static method.. My Situation is this.. I have a cache which is just a hash table which will be only one copy for the whole application.. No when i get a request I have to check if the id is avaible in the cache. if it is available i call method 1 if not i call method2. Now Ideally the cache should be a static object and the method to check the id in the cache will be a normal instance method..
    I was just wondering what might happen if i make the method static.. If i can make it static i can can save a lot of space by not creating the object each time.. u know what i mean.. That y i wanted to know what happens..
    Rajeev

Maybe you are looking for

  • How to set up remote access on wvc80n without using TZO

    Just purchased the WVC80N, but how do you set it up for remote access without using TZO?  I can not get TZO to work w/ my Uverse 2wire 3800-hgv-b router.  Please help as the uverse customer support has not been helpful with port forwarding either.

  • Image Capture is not recognizing my Epson Stylus Scanner 2000

    I have an Epson Stylus Scanner 2000 printer that scans, prints, copies and fax. I faithfully used these fetures in my home-based buisness with my G3 until I traded for a Mac Pro. I can print without a glitch, no problems there. How can I scan and fax

  • Picture previews do not open in photoshop

    Since the update with a preview of the image being shown in the chat, it's a complete pain in the ass to open any image sent to me in PS. What I want to be able to do is click the preview, it opens in Windows Photo Viewer then, Right click > Open Wit

  • Accessing Multiple Identical Schemas from Single Form

    Hi, I'm working with oracle 9i. My question is as follows: If one has muliple schemas that are all identical, is it possible to setup an oracle form (Oracle Forms 9i) that is able to switch between schemas by selecting the schema from an objecton the

  • How do you clear a text area?

    any know how to do this?