Uploading a file in bsp application

i want to upload a file in abap.
i am using gui_upload function.
DATA:  BEGIN OF pic_tab OCCURS 10,
         data TYPE sdokcntbin,
       END OF pic_tab.
DATA:  aux_string TYPE string.
DATA:  aux_length TYPE i.
TABLES: zpro_pa,
        zbsp_pkgklg.
PARAMETERS: p_packid LIKE zpro_pa-package_id,
            p_file(256) DEFAULT 'c:\test.jpg'.
START-OF-SELECTION.
  aux_string = p_file.
  DELETE FROM zbsp_pkgklg WHERE type = 'PACKAGE'
                       AND identifier = p_packid.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                      = aux_string
        filetype                      = 'BIN'
      IMPORTING
        filelength                    = aux_length
    TABLES
      data_tab                      = pic_tab
        separator_not_allowed         = 10
  zbsp_pkgklg-type = 'PACKAGE'.
  zbsp_pkgklg-identifier = p_packid.
  LOOP AT pic_tab.
    IF aux_length > 1022.
      zbsp_pkgklg-length = 1022.
      aux_length = aux_length - 1022.
    ELSE.
      zbsp_pkgklg-length = aux_length.
    ENDIF.
    zbsp_pkgklg-line = sy-tabix.
    zbsp_pkgklg-data = pic_tab-data." here not able tocopy
    INSERT zbsp_pkgklg.
    IF sy-subrc <> 0.
      MESSAGE a001.
    ENDIF.
  ENDLOOP.
am not able to copyfrom pic_tb field data into zbsp_pkgklgfield data.
can anyone tell whats the problem?.

You'll find about a million things in this forum alone on this topic.
<a href="/people/brian.mckellar/blog/2004/06/11/bsp-trouble-shooting-getting-help">BSP Trouble Shooting: Getting Help</a>
I would suggest you do a search not only in this forum for "file upload" but also take a look at the weblogs from Brian McKellar and Thomas Jung. Both have many examples of this topic.

Similar Messages

  • How to get full file path while uploading a file in flex Applications

    How to get full file path while uploading a file in flex applications.
    FileReference Object is giving file name and other details but not the actual path.
    Is there any workaround to to get the file path?.
    Thanks

    Why not ask in the Flex forum; it is more likely that someone over there knows.

  • How do upload a file to the application server into a directory?

    hi to all,
    i want to upload file into the database..i need upload the file into the application server and save it to a directory..is there any way?where i can read about this?any information?
    ashwiny

    Hello,
    First, we need to determine the terms we are using, in order to avoid confusion. We (including the documentation) are using "upload" to describe storing the file on the server, and "download" to pull it from the server into local machine.
    You can use the "File Browse" item to upload any file you need from your local machine and into a database table. The default APEX configuration (in the dads.conf file) stored the uploaded file in a table called wwv_flow_file_objects$. In your application, you can access this table using a view called APEX_APPLICATION_FILES.
    After you uploaded a file, any user can access it, using the download procedure described in the reference I gave you. The download procedure gives you an option to store the download file anywhere you need, using the "Open/Save" dialog box.
    I believe this is covering everything you need. If you still having problems, please consider posting the relevant application pages on apex.oracle.com. It will be easier to understand and help you.
    Regards,
    Arie.

  • How to upload excel file in Webdynpro application using ABAP

    Hi Experts,
    Am developing a webdynpro application in which it will take an excel file as input and display the contents in the form of a table in output. I am able to upload tab delimited text file and populate the table using the below code but not able to do the same with .xls file. Pls let me know if I need to use a different function module for upload excel file.
    get single attribute
      wd_context->get_attribute(
        EXPORTING
          name =  `DATASOURCE`
        IMPORTING
          value = l_xstring ).
      CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
        EXPORTING
          in_xstring = l_xstring
        IMPORTING
          out_string = l_string.
      SPLIT l_string  AT cl_abap_char_utilities=>newline INTO TABLE i_data.
    Bind With table Element.
      LOOP AT i_data INTO l_string.
        SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
        READ TABLE fields INTO lv_field INDEX 1.
        fs_table-name = lv_field.
        READ TABLE fields INTO lv_field INDEX 2.
        fs_table-age = lv_field.
        APPEND fs_table TO t_table1.
      ENDLOOP.
    lo_nd_data = wd_context->get_child_node( 'DATA_TAB' ).
    lo_nd_data->bind_table( T_TABLE1 ).
    Thanks,
    Subathra

    Dear Exports
    Can anyone guide me how to uplode the .xlsx or ..xls formatted excel file using abap webdynpro without converting it to .txt file. Because my client requirement is only to upload the excel file. because to convert the .xlsx flie to .txt file it will be time taking and cost expanssive. Another requirement is suppose today i have create a application for uploading a file which has 8 columns and 10 rows. suppose tomorrow the client will make some changes in that flat file means the client will add 2 extra columns and 10 more columns in that fil. and will upload that file. Then the new file will be display on the browser or old file. but my requirement is to display the new file in browser.
    Can anyone kindly help to solve my problem. I am completely fresher in this field and I need to do it as soon as possible. Please help to solve the problem. 
    Regards
    Rashmita

  • Trying to add some security to uploading .DWF files from my application

    My application uses the LDAP authentication scheme, and its working great.
    But my application also provides a link to Floor Plans that are stored on the files system in DWF format.
    The link is on the directory path which is an attribute to the record.
    Part of the directory path is masked because the files on my system are located in the Document Root. (Thats fine).
    But the link can be copied and pasted into any browser without any means of validation or security.
    We like our LDAP authentication scheme, but I need to secure these files.
    I've found something in the Pro Oracle Application Express book that sounds promising, but I don't know how to apply it.
    In Chapter 9, File Storage, and the Standard upload section, I read about the "WWV_FLOW_API.SET_SECURITY_GROUP_ID" procedure. This procedure accepts the numeric value of the Workspace. If I could somehow use this procedure along with a condition for UpLoading the file that might work.
    Can anyone give me some ideas here?
    The example the book gives is this EXEC WWV_FLOW_API.SET_SECURITY_GROUP_ID(99999nnnnnn);
    where (99999nnn..) is the same numeric id as SELECT &WORKSPACE_ID. from dual;
    I appreciaate any ideas!

    bounce

  • Transport data from Javascript file to BSP application

    Hi,
            How can we transport data from Javascript file that is stored in MIME repository to the BSP application that uses this Javascript?
    To elaborate :
    I  have a  BSP application which calls few functions from a Javascript file that is stored in the MIME repository. Now, i need to pass one of the values that is obtained dynamically in the Javascript function to the BSP application inorder to store it in DB.. How can I do this?
    Thanks,
    Vasuki

    Hi,
    you must only identify in which variable the javascript function stores the values. So you can enrich
    your bsp application with such a function. Then you must transfer the value to a hidden input field.
    This field content can be requested via  request->get_form_field( 'name_of_the_field' ).
    On the other side, check out, if ther is a getter function in this library.
    Use firwefox with firbug plugin an set breakpoint in the javascript function to get an overview about the dom modcel.
    Best regards, Stefan

  • .css file in BSP Application

    Hi,
        Where can i find the .css file in a BSP application ?
    kindly help!
    Regards,
    Bharath Mohan B.

    Hi,
    Referr to the below link...
    This should help you :
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/4e/7feef553415e4fb357e80f7a6223b1/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/4e/7feef553415e4fb357e80f7a6223b1/frameset.htm</a>
    <i>Do reward each useful answer..!</i>
    Thanks,
    Tatvagna.

  • Upload a file to the application top using File Upload feature of OAF

    Hi,
    I am facing some problem when trying to upload a file from my desktop to the application directory (e.g. AR TOP).
    I do not want to use the fnd_lob table,want to load the file to that directory directory, is it possible using OAF file upload?

    Refer the following code
    * Method used to write the contents (data) from an Oracle BLOB column to
    * an O/S file. This method uses one of two ways to get data from the BLOB
    * column - namely using Streams. The other way to read data from an
    * Oracle BLOB column is to use getBytes() method.
    * @throws java.io.IOException
    * @throws java.sql.SQLException
    public void readBLOBToFileStream()
    throws IOException, SQLException {
    FileOutputStream outputFileOutputStream = null;
    InputStream blobInputStream = null;
    String sqlText = null;
    Statement stmt = null;
    ResultSet rset = null;
    BLOB image = null;
    int chunkSize;
    byte[] binaryBuffer;
    int bytesRead = 0;
    int bytesWritten = 0;
    int totBytesRead = 0;
    int totBytesWritten = 0;
    try {
    stmt = conn.createStatement();
    outputBinaryFile2 = new File(outputBinaryFileName2);
    outputFileOutputStream = new FileOutputStream(outputBinaryFile2);
    sqlText =
    "SELECT image " +
    "FROM test_blob " +
    "WHERE id = 2 " ;
    rset = stmt.executeQuery(sqlText);
    rset.next();
    image = ((OracleResultSet) rset).getBLOB("image");
    // Will use a Java InputStream object to read data from a BLOB (can
    // also be used for a CLOB) object. In this example, we will use an
    // InputStream to read data from a BLOB.
    blobInputStream = image.getBinaryStream();
    chunkSize = image.getChunkSize();
    binaryBuffer = new bytechunkSize;
    while ((bytesRead = blobInputStream.read(binaryBuffer)) != -1) {
    // Loop through while reading a chunk of data from the BLOB
    // column using an InputStream. This data will be stored
    // in a temporary buffer that will be written to disk.
    outputFileOutputStream.write(binaryBuffer, 0, bytesRead);
    totBytesRead += bytesRead;
    totBytesWritten += bytesRead;
    outputFileOutputStream.close();
    blobInputStream.close();
    conn.commit();
    rset.close();
    stmt.close();
    System.out.println(
    "==========================================================\n" +
    " INPUT STREAMS METHOD\n" +
    "==========================================================\n" +
    "Wrote BLOB column data to file " + outputBinaryFile2.getName() + ".\n" +
    totBytesRead + " bytes read.\n" +
    totBytesWritten + " bytes written.\n"
    } catch (IOException e) {
    System.out.println("Caught I/O Exception: (Write BLOB value to file - Streams Method).");
    e.printStackTrace();
    throw e;
    } catch (SQLException e) {
    System.out.println("Caught SQL Exception: (Write BLOB value to file - Streams Method).");
    System.out.println("SQL:\n" + sqlText);
    e.printStackTrace();
    throw e;
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Download File from BSP-Application

    Hello !
    i hope i can get some help for my problem.
    from my BSP-Application i want to download an internal table to p:\eigenedateien\bv.txt (always the same filename)
    the internal table ist type table of string.
    i read that gui_download doesn't work in my BSP
    so i went through this weblog 756
    but it is really hard.
    i put some code from the weblog in my application:
    concatenate 'attachment; filename='
    w_para-pwert = p:\eigenedatieen\bv.txt
                w_para-pwert into dl_pathfile.
    Download der Datei
    Create the cached response object that we will insert our content into
    dl_xstring = 'Test'. "nur zum testen
                CREATE OBJECT CACHED_RESPONSE TYPE CL_HTTP_RESPONSE
                       EXPORTING ADD_C_MSG = 1.
    set the data and the headers
                CACHED_RESPONSE->SET_DATA( DL_XSTRING ).
                CACHED_RESPONSE->SET_HEADER_FIELD( NAME  =
                                        IF_HTTP_HEADER_FIELDS=>CONTENT_TYPE
                                                   VALUE = 'text/html' ).
    Set the filename into the response header
           CACHED_RESPONSE->SET_HEADER_FIELD( NAME  = 'Content-Disposition'
                                       VALUE = DL_PATHFILE ).
    Set the Response Status
                CACHED_RESPONSE->SET_STATUS( CODE = 200 REASON = 'OK' ).
    Set the Cache Timeout - 60 seconds - we only need this in the cache
               CACHED_RESPONSE->SERVER_CACHE_EXPIRE_REL( EXPIRES_REL = 60 ).
    Create a unique URL for the object
                CALL FUNCTION 'GUID_CREATE'
                  IMPORTING
                    EV_GUID_32 = GUID.
                CONCATENATE RUNTIME->APPLICATION_URL '/' GUID INTO URL.
    Cache the URL
                CL_HTTP_SERVER=>SERVER_CACHE_UPLOAD( URL      = URL
                                               RESPONSE = CACHED_RESPONSE ).
    Ende Download
    now it should be cached.
    but hot can i start the download to p:\eigenedateien... now?
    thanks very much for your help
    Helmut

    Hi,
    Could you try adding at the end:
    navigation->response_complete( ).
    and/or
    data: guid type guid_32,
          display_url TYPE string.
    call function 'GUID_CREATE'
    importing
    ev_guid_32 = guid.
    concatenate runtime->application_url '/' guid into display_url.
    cl_http_server=>server_cache_upload( url = display_url response = cached_response ).
    Best regards,
    Guillaume
    Message was edited by: Guillaume Garcia

  • File Upload in BSP Applications and store in Application server

    Hi we have requirement to store the attachments from BSP application into the external/internal storage space connected to application server.
    I search for weblogs and all talking about <a href="http://help.sap.com/saphelp_me21sp2/helpdata/en/eb/8c683c8de8a969e10000000a114084/content.htm">File Upload in BSP Applications and store in MIME Repository</a>.
    But our requirement is upload and store(no need to read the file content) attachments from BSP page into file server, and then make a link back in BSP page to open.
    I know we can handle documnets in R/3 using DMS, but our system is SRM.
    Please give a suggestion and solution.
    Thanks,
    Giri

    Hi,
    I faced a similar problem some time ago (uploading a file via BSP, storing it to the application server and then linking the archived document to a business object.
    Here is the coding I used:
    when 'SubmitUploadFile'. "OnInputProcessing
        DATA: data_fileupload TYPE REF TO CL_HTMLB_FILEUPLOAD,
              l_filename type string,
              l_archiv_doc_id type SAPB-SAPADOKID,
              l_content type string,
              l_file_ixos(100) type c value '/transfer/PV2/aus/IXOS/',
              l_file(200) type c,
              tbl_bin TYPE STANDARD TABLE OF tbl1024,
              wa_bin type TBL1024,
              l_xstring type xstring,
              l_arc_doc_id type SAPB-SAPADOKID,
              l_doctype type TOADD-DOC_TYPE,
              l_filename_e type DRAW-FILEP.
    upload the file from the BSP web interface (e.g. file C:TempSUTestPDF_SU.pdf)
        data_fileupload ?= CL_HTMLB_MANAGER=>GET_DATA(
                                           request = runtime->server->request 
                                           name    = 'fileUpload'
                                           id      = ‘InputFieldFileUpload’
        IF NOT data_fileupload IS INITIAL.
          l_filename         = data_fileupload->file_name.
          l_content      = data_fileupload->file_content.
          l_content_type = data_fileupload->file_content_type.
        ENDIF.
    The uploaded file is returned as XSTRING, so we have to convert it to BINARY
    (or STRING alternatively)!
        l_xstring = l_content.
        CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
          EXPORTING
            BUFFER          = l_xstring
            APPEND_TO_TABLE = 'X'
          TABLES
            BINARY_TAB      = tbl_bin.
    split path for storing the file to the application server
        l_filename_c = l_filename.
        CALL FUNCTION 'CV120_SPLIT_PATH'
          EXPORTING
            PF_PATH  = l_filename_c
          IMPORTING
            PFX_FILE = l_filename_e.
    write the uploaded file to the application server
        l_filename = l_filename_e.
        concatenate l_file_ixos l_filename into l_file.
        open dataset l_file for output IN LEGACY BINARY MODE.
        loop at tbl_bin into wa_bin.
          transfer wa_bin-line to l_file.
        endloop.
        close dataset l_file.
    store the uploaded file on the IXOS-archive
        l_doctype = l_content_type.
        CALL FUNCTION 'ARCHIVOBJECT_CREATE_FILE'
          EXPORTING
            ARCHIV_ID                = '2T'
            DOCUMENT_TYPE            = l_doctype
            PATH                     = l_file_arc
          IMPORTING
            ARCHIV_DOC_ID            = l_arc_doc_id
          EXCEPTIONS
            ERROR_ARCHIV             = 1
            ERROR_COMMUNICATIONTABLE = 2
            ERROR_UPLOAD             = 3
            ERROR_KERNEL             = 4
            OTHERS                   = 5.
    link the archived document to the business object ‘DRAW’
        CALL FUNCTION 'ARCHIV_CONNECTION_INSERT'
          EXPORTING
            ARCHIV_ID                   = '2T'
            ARC_DOC_ID                  = l_arc_doc_id
            AR_OBJECT                   = 'DRW'
            OBJECT_ID                   = g_object_id_arc
            SAP_OBJECT                  = 'DRAW'
           DOC_TYPE                    = l_extend
         EXCEPTIONS
           ERROR_CONNECTIONTABLE       = 1
           OTHERS                      = 2.
    Remark: It´s vital to convert the uploaded file from XSTRING to BINARY. Otherwise the file cannot be stored/archived properly.
    The archived document can then be displayed by inserting the (IXOS-web client-)link to the BSP page (e.g. http://193.228.208.78:4060/archive.dll/get?arc=2T&doc=44439F1B4F701E65E1000000C1E4D00A).
    Hope this helps!
    Regards,
    Ulli

  • How to increase the field lenght of file uplaod in BSP application

    Hi All,
       I am facing a problem with u201Cuploadu201D filed length in BSP application.
    When we upload the file in BSP page, the path displayed should be the full path (i.e. from where the file is being upload the file)
    Now this field is appearing 20 char length
    Now I want to increase the length of the upload field (Input field) to be 100 char so that the path is visible.
    In the current application the file upload is being done through a structure (attributes)
    In this structure the fields are like this
    PAGE_NAME
    ID
    FOR
    TAGS
    ROW_INDEX
    COLUMN_INDEX
    OTR_NAME
    REQUIRED_NAME
    MAXLENGTH
    SIZE
    TABLE_NAME
    ON_SELECT
    VALUE
    DISABLED
    ONCLICK
    TEXT
    TYPE
    Using this method:
    CALL METHOD cl_htmlb_fileupload=>factory
              EXPORTING
                Id      = ls_form_save-id
              RECEIVING
                Element = lv_fileup.
            bee_table->add ( level = 2 element = lv_fileup ).
    This cl_htmlb_fileupload is named as class interface.
    Which has the CLG_HTMLB_FILEUPLOAD (it is a class) it is defined in attributes.
    In this class it has the attribute u201CSIZEu201D by default string 20.
    Now I need to change this attribute length from 20 to 100
    For this I copied the standard class CL_HTMLB_FILEUPLOAD into ZCL_HTMLB_FILEUPLOAD.
    This ZCL_HTMLB_FILEUPLOAD contains all attributes of the standard class CL_HTMLB_FILEUPLOAD
    Including the one class (CLG_HTMLB_FILEUPLOAD), this is defined as an attribute (ABOVE MENTIONED?)
    This class is appearing in non editable mode, so   I have copied this class into zclass (ZCLG_HTMLB_FILEUPLOAD).but still I am not able to edit the attribute called u201Csizeu201D
    And also I am not bale to add the zclass in place of the ZCLG_HTMLB_FILEUPLOAD
    Kindly tell me how to modify the length of the field u201Csize u201Cand also how to add the zclass in the attributes of one class (syntax)
    Thanks in advance
    Rambabu.A

    Hi,
    Class CLG_HTMLB_FILEUPLOAD is a class automatically generated when a BSP Element is created. You should not change/create such a class, unless by creating your own BSP Element.
    As per your requirement, you can use the SIZE parameter of method factory:
    ls_form_save-size = '100'.
    CALL METHOD cl_htmlb_fileupload=>factory
    EXPORTING
    Id = ls_form_save-id
    Size = ls_form_save-size
    RECEIVING
    Element = lv_fileup.
    Regards,
    Tanguy

  • Download and upload bsp application

    Hi All,
    Pl. guide me with my requirement. I have a bsp application in one server and for some reasons the same bsp application is required in another server but these two servers are not in land scape and hence i cannot transport. Is there any way to download the whole application and upload it into the target server. I feel this approach is silly but is there any other way or should i create it again fron the scratch in the new server.Pl. guide me.
    thanks & regards,
    jeeva.

    Hi Jeeva
       Why dont you try the above link given by Raja..
    It works fine .... You will get the sourcecode downloaded in a .bsp extension file for each page....But the only major problem is ... It doesnot talk about anything related to How to upload those files in the application....For that you had to take the help of BASIS ..
    But if your problem get solved by just getting the source code downloaded then try this code...This is the same code that RAJA has linked to...Just paste the code in a report program...and execute it...
    type-pools: SO2.
    types: t_page_list type standard table of o2pagkey.
    parameters: g_appl type O2APPLNAME.
    constants: c_separator_line type string value
    perform main.
    form main.
      data: l_pages type t_page_list,
      l_ref_page type ref to cl_o2_api_pages,
      l_table type o2pageline_table,
      l_folder type string,
      l_lower type string,
      l_filename type string.
      field-symbols: <f_page> type o2pagkey.
    * get local directory path
      call method CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE
    * EXPORTING
    * WINDOW_TITLE =
    * INITIAL_FOLDER =
      CHANGING
      SELECTED_FOLDER = l_folder
      EXCEPTIONS
      CNTL_ERROR = 1
      ERROR_NO_GUI = 2
      NOT_SUPPORTED_BY_GUI = 3
      others = 4.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        return.
      ENDIF.
      if l_folder is initial. return. endif.
    * get all pages of selected BSP application
      perform get_all_pages changing l_pages.
    * perform each page
      loop at l_pages assigning <f_page>.
    * load page data
        perform load_page using <f_page>
        changing l_ref_page.
        if l_ref_page is bound.
    * collect the content of the page in an internal table
          perform print using l_ref_page
          changing l_table.
          if not l_table is initial.
            l_lower = <f_page>-pagekey.
            translate l_lower to lower case.
    * determine file path for the page
            concatenate l_folder '' l_lower into l_filename.
    * download the content of the page to file
            perform download using l_filename l_table.
          endif.
        endif.
      endloop.
    endform.                    "main
    form download using p_filename type string
    p_table type standard table.
    * download the content of an internal table to a local file
      call method CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
        EXPORTING
          FILENAME                = p_filename
        CHANGING
          DATA_TAB                = p_table
        EXCEPTIONS
          FILE_WRITE_ERROR        = 1
          NO_BATCH                = 2
          GUI_REFUSE_FILETRANSFER = 3
          INVALID_TYPE            = 4
          NO_AUTHORITY            = 5
          UNKNOWN_ERROR           = 6
          HEADER_NOT_ALLOWED      = 7
          SEPARATOR_NOT_ALLOWED   = 8
          FILESIZE_NOT_ALLOWED    = 9
          HEADER_TOO_LONG         = 10
          DP_ERROR_CREATE         = 11
          DP_ERROR_SEND           = 12
          DP_ERROR_WRITE          = 13
          UNKNOWN_DP_ERROR        = 14
          ACCESS_DENIED           = 15
          DP_OUT_OF_MEMORY        = 16
          DISK_FULL               = 17
          DP_TIMEOUT              = 18
          FILE_NOT_FOUND          = 19
          DATAPROVIDER_EXCEPTION  = 20
          CONTROL_FLUSH_ERROR     = 21
          NOT_SUPPORTED_BY_GUI    = 22
          ERROR_NO_GUI            = 23
          others                  = 24.
      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.                    "download
    form get_all_pages changing p_pages type t_page_list.
    * get all pages of the application
      select applname pagekey from o2pagdir into table p_pages
      where applname = g_appl and
      pagetype <> so2_controller.
    endform.                    "get_all_pages
    form load_page using p_key type o2pagkey
    changing p_data type ref to cl_o2_api_pages.
    * load the data of one page
      clear p_data.
      call method cl_o2_api_pages=>load_with_access_permission
        EXPORTING
          p_mode    = 'SHOW'
          p_pagekey = p_key
          p_version = 'A' "'I' for inactive version
        IMPORTING
          p_page    = p_data
        EXCEPTIONS
          others    = 1.
    endform.                    "load_page
    form print using p_data type ref to cl_o2_api_pages
    changing p_table type o2pageline_table.
    * collect the content of a page into an internal table
      data: l_attrs type o2pagattr,
      l_params type o2pagpar_tabletype,
      l_source type rswsourcet,
      l_layout type o2pageline_table,
      l_ev_handlers type so2_ev_handler_list,
      l_typtyp(11) type c,
      l_line type string.
      field-symbols: <f_param> type o2pagpars,
      <f_evh_name> type so2_ev_handler_name.
      refresh p_table.
    * get page properties
      CALL METHOD P_DATA->GET_ATTRS
        IMPORTING
          P_ATTRS = l_attrs
        EXCEPTIONS
          others  = 1.
      check l_attrs-pagetype <> so2_controller.
      append c_separator_line to p_table.
      concatenate '*' l_attrs-applname '/' l_attrs-pagekey into l_line.
      append l_line to p_table.
      append c_separator_line to p_table.
      append space to p_table.
    * local types
      if l_attrs-pagetype = so2_full_page.
        CALL METHOD P_DATA->GET_TYPE_SOURCE
          IMPORTING
            P_SOURCE = l_source
          EXCEPTIONS
            others   = 1.
        if not l_source is initial.
          append c_separator_line to p_table.
          append '* local types' to p_table.
          append c_separator_line to p_table.
          append lines of l_source to p_table.
          do 3 times.
            append space to p_table.
          enddo.
        endif.
      endif.
    * page attributes
      if l_attrs-pagetype = so2_full_page or
      l_attrs-pagetype = so2_view_page.
        CALL METHOD P_DATA->GET_PARAMETERS
          IMPORTING
            P_PARAMETERS = l_params
          EXCEPTIONS
            others       = 1.
        if not l_params is initial.
          append c_separator_line to p_table.
          append '* page attributes' to p_table.
          append c_separator_line to p_table.
          loop at l_params assigning <f_param>.
            if <f_param>-typtype = so2_paramtyp_type.
              l_typtyp = 'TYPE'.
            else.
              l_typtyp = 'TYPE REF TO'.
            endif.
            concatenate <f_param>-aliasname l_typtyp
            <f_param>-type into l_line
            separated by space.
            append l_line to p_table.
          endloop.
          do 3 times.
            append space to p_table.
          enddo.
        endif.
      endif.
    * layout
      append c_separator_line to p_table.
      append '* layout' to p_table.
      append c_separator_line to p_table.
      CALL METHOD P_DATA->GET_PAGE
        IMPORTING
          P_CONTENT = l_layout
        EXCEPTIONS
          others    = 1.
      append lines of l_layout to p_table.
      do 3 times.
        append space to p_table.
      enddo.
    * event handler
      if l_attrs-pagetype = so2_full_page.
        CALL METHOD P_DATA->GET_EVENT_HANDLER_LIST
          EXPORTING
            P_WITH_ALL_PREDEFINED = ' '
          IMPORTING
            P_EV_HANDLER_L        = l_ev_handlers
          EXCEPTIONS
            others                = 1.
        loop at l_ev_handlers assigning <f_evh_name>.
          append c_separator_line to p_table.
          concatenate '* eventhandler' <f_evh_name>-name into l_line
          separated by space.
          append l_line to p_table.
          append c_separator_line to p_table.
          clear l_source.
          CALL METHOD P_DATA->GET_EVENT_HANDLER
          EXPORTING
          P_NAME = <f_evh_name>-key
          IMPORTING
          P_SOURCE = l_source
    * P_ATTRS =
          EXCEPTIONS
          others = 1.
          append lines of l_source to p_table.
          do 3 times.
            append space to p_table.
          enddo.
        endloop.
      endif.
    endform.                    "print
    RGDS
    Mithlesh

  • Upload tab-delimited file from the application server to an internal table

    Hello SAPients.
    I'm using OPEN DATASET..., READ DATASET..., CLOSE DATASET to upload a file from the application server (SunOS). I'm working with SAP 4.6C. I'm trying to upload a tab-delimited file to an internal table but when I try load it the fields are not correctly separated, in fact, they are all misplaced and the table shows '#' where supposedly there was a tab.
    I tried to SPLIT the line using as separator a variable with reference to CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB but for some reason that class doesn't exist in my system.
    Do you know what I'm doing wrong? or Do you know a better method to upload a tab-delimited file into an internal table?
    Thank you in advance for your help.

    Try:
    REPORT ztest MESSAGE-ID 00.
    PARAMETER: p_file LIKE rlgrap-filename   OBLIGATORY.
    DATA: BEGIN OF data_tab OCCURS 0,
          data(4096),
          END   OF data_tab.
    DATA: BEGIN OF vendor_file_x OCCURS 0.
    * LFA1 Data
    DATA: mandt  LIKE bgr00-mandt,
          lifnr  LIKE blf00-lifnr,
          anred  LIKE blfa1-anred,
          bahns  LIKE blfa1-bahns,
          bbbnr  LIKE blfa1-bbbnr,
          bbsnr  LIKE blfa1-bbsnr,
          begru  LIKE blfa1-begru,
          brsch  LIKE blfa1-brsch,
          bubkz  LIKE blfa1-bubkz,
          datlt  LIKE blfa1-datlt,
          dtams  LIKE blfa1-dtams,
          dtaws  LIKE blfa1-dtaws,
          erdat  LIKE  lfa1-erdat,
          ernam  LIKE  lfa1-ernam,
          esrnr  LIKE blfa1-esrnr,
          konzs  LIKE blfa1-konzs,
          ktokk  LIKE  lfa1-ktokk,
          kunnr  LIKE blfa1-kunnr,
          land1  LIKE blfa1-land1,
          lnrza  LIKE blfa1-lnrza,
          loevm  LIKE blfa1-loevm,
          name1  LIKE blfa1-name1,
          name2  LIKE blfa1-name2,
          name3  LIKE blfa1-name3,
          name4  LIKE blfa1-name4,
          ort01  LIKE blfa1-ort01,
          ort02  LIKE blfa1-ort02,
          pfach  LIKE blfa1-pfach,
          pstl2  LIKE blfa1-pstl2,
          pstlz  LIKE blfa1-pstlz,
          regio  LIKE blfa1-regio,
          sortl  LIKE blfa1-sortl,
          sperr  LIKE blfa1-sperr,
          sperm  LIKE blfa1-sperm,
          spras  LIKE blfa1-spras,
          stcd1  LIKE blfa1-stcd1,
          stcd2  LIKE blfa1-stcd2,
          stkza  LIKE blfa1-stkza,
          stkzu  LIKE blfa1-stkzu,
          stras  LIKE blfa1-stras,
          telbx  LIKE blfa1-telbx,
          telf1  LIKE blfa1-telf1,
          telf2  LIKE blfa1-telf2,
          telfx  LIKE blfa1-telfx,
          teltx  LIKE blfa1-teltx,
          telx1  LIKE blfa1-telx1,
          xcpdk  LIKE  lfa1-xcpdk,
          xzemp  LIKE blfa1-xzemp,
          vbund  LIKE blfa1-vbund,
          fiskn  LIKE blfa1-fiskn,
          stceg  LIKE blfa1-stceg,
          stkzn  LIKE blfa1-stkzn,
          sperq  LIKE blfa1-sperq,
          adrnr  LIKE  lfa1-adrnr,
          mcod1  LIKE  lfa1-mcod1,
          mcod2  LIKE  lfa1-mcod2,
          mcod3  LIKE  lfa1-mcod3,
          gbort  LIKE blfa1-gbort,
          gbdat  LIKE blfa1-gbdat,
          sexkz  LIKE blfa1-sexkz,
          kraus  LIKE blfa1-kraus,
          revdb  LIKE blfa1-revdb,
          qssys  LIKE blfa1-qssys,
          ktock  LIKE blfa1-ktock,
          pfort  LIKE blfa1-pfort,
          werks  LIKE blfa1-werks,
          ltsna  LIKE blfa1-ltsna,
          werkr  LIKE blfa1-werkr,
          plkal  LIKE  lfa1-plkal,
          duefl  LIKE  lfa1-duefl,
          txjcd  LIKE blfa1-txjcd,
          sperz  LIKE  lfa1-sperz,
          scacd  LIKE blfa1-scacd,
          sfrgr  LIKE blfa1-sfrgr,
          lzone  LIKE blfa1-lzone,
          xlfza  LIKE  lfa1-xlfza,
          dlgrp  LIKE blfa1-dlgrp,
          fityp  LIKE blfa1-fityp,
          stcdt  LIKE blfa1-stcdt,
          regss  LIKE blfa1-regss,
          actss  LIKE blfa1-actss,
          stcd3  LIKE blfa1-stcd3,
          stcd4  LIKE blfa1-stcd4,
          ipisp  LIKE blfa1-ipisp,
          taxbs  LIKE blfa1-taxbs,
          profs  LIKE blfa1-profs,
          stgdl  LIKE blfa1-stgdl,
          emnfr  LIKE blfa1-emnfr,
          lfurl  LIKE blfa1-lfurl,
          j_1kfrepre  LIKE blfa1-j_1kfrepre,
          j_1kftbus   LIKE blfa1-j_1kftbus,
          j_1kftind   LIKE blfa1-j_1kftind,
          confs  LIKE  lfa1-confs,
          updat  LIKE  lfa1-updat,
          uptim  LIKE  lfa1-uptim,
          nodel  LIKE blfa1-nodel.
    DATA: END   OF vendor_file_x.
    FIELD-SYMBOLS:  <field>,
                    <field_1>.
    DATA: delim          TYPE x        VALUE '09'.
    DATA: fld_chk(4096),
          last_char,
          quote_1     TYPE i,
          quote_2     TYPE i,
          fld_lth     TYPE i,
          columns     TYPE i,
          field_end   TYPE i,
          outp_rec    TYPE i,
          extras(3)   TYPE c        VALUE '.,"',
          mixed_no(14) TYPE c        VALUE '1234567890-.,"'.
    OPEN DATASET p_file FOR INPUT.
    DO.
      READ DATASET p_file INTO data_tab-data.
      IF sy-subrc = 0.
        APPEND data_tab.
      ELSE.
        EXIT.
      ENDIF.
    ENDDO.
    * count columns in output structure
    DO.
      ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      columns = sy-index.
    ENDDO.
    * Assign elements of input file to internal table
    CLEAR vendor_file_x.
    IF columns > 0.
      LOOP AT data_tab.
        DO columns TIMES.
          ASSIGN space TO <field>.
          ASSIGN space TO <field_1>.
          ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
          SEARCH data_tab-data FOR delim.
          IF sy-fdpos > 0.
            field_end = sy-fdpos + 1.
            ASSIGN data_tab-data(sy-fdpos) TO <field_1>.
    * Check that numeric fields don't contain any embedded " or ,
            IF <field_1> CO mixed_no AND
               <field_1> CA extras.
              TRANSLATE <field_1> USING '" , '.
              CONDENSE <field_1> NO-GAPS.
            ENDIF.
    * If first and last characters are '"', remove both.
            fld_chk = <field_1>.
            IF NOT fld_chk IS INITIAL.
              fld_lth = strlen( fld_chk ) - 1.
              MOVE fld_chk+fld_lth(1) TO last_char.
              IF fld_chk(1) = '"' AND
                 last_char = '"'.
                MOVE space TO fld_chk+fld_lth(1).
                SHIFT fld_chk.
                MOVE fld_chk TO <field_1>.
              ENDIF.       " for if fld_chk(1)=" & last_char="
            ENDIF.         " for if not fld_chk is initial
    * Replace "" with "
            DO.
              IF fld_chk CS '""'.
                quote_1 = sy-fdpos.
                quote_2 = sy-fdpos + 1.
                MOVE fld_chk+quote_2 TO fld_chk+quote_1.
              ELSE.
                MOVE fld_chk TO <field_1>.
                EXIT.
              ENDIF.
            ENDDO.
            <field> = <field_1>.
          ELSE.
            field_end = 1.
          ENDIF.
          SHIFT data_tab-data LEFT BY field_end PLACES.
        ENDDO.
        APPEND vendor_file_x.
        CLEAR vendor_file_x.
      ENDLOOP.
    ENDIF.
    CLEAR   data_tab.
    REFRESH data_tab.
    FREE    data_tab.
    Rob

  • Error while uploading the file from Allpcation server in LSMW-7th step

    Hi Experts,
    what should be the specific CODE PAGE should be maintained while uploading the file from application server in LSMW-7th Step
    Thanks in advance,
    KSR

    Hi
    I mean that there is any seperate CODE PAGE which comes at the bottom of screen while uploading the file from the application server in 7th step.
    Is there any specific CODE PAGE to be maintained...
    Thanks in advance
    Oarsk

  • Not able to integrate the Adobe flex4 with BSP application.

    HI,
    I have created one flex4 application using the BSP(XML).  I am able to run the flex application, data retriving properly and working fine.but when I imported the SWF file into BSP application(MIME Repository) and  if  I run  the application from  the BSP (HTMLfile ).  it's  giving the Error # 2302.
    and at  the same time I have created flex application using  flex builder 3 using BSP then  its working fine again.I am able to execute the application from the BSP also.
    Is it possible to integarte the Flex4 with BSP?
    Thanks and Regards
    Aravind.

    flash 4 is very much compatible.
    can you check in your falsh builder whats set at
    Project->Properties->Flex Build Path->Framework Linkage
    is it merge into code or RSL?
    you should use merged into  code.
    Also when you refer the swf file in your bsp page are you using relative url for the swf  ?

Maybe you are looking for

  • How to get a copied transaction from MIR4 only to display??

    hi all, we have two transactions named ZZMIR4 and ZZZMIR4. Both are copies from MIR4, but the first one is for modifications and the other one is only to display.... I use two registers in T169 to get this...ZZMIR4 has T169-TRTYP = 'V' so we can chan

  • Dead Time Capsule replaced by a refurb but now drops connection...

    Hi Guys, I took delivery of Apple's replacement for my dead TC with the fried PSU. Sadly it's only a refurb and I'm having problems maintaining a connection to it via my iMac. It's connected via Gbit ethernet and I can mount the TC and the USB back-u

  • Restore one full backup(need to move), 1 differential backup,2 transaction log backup

    Is following script correct? I don't need to add "move" when do restore differential, log later. Correct? RESTORE DATABASE AdventureWorks FROM DISK = 'C:\AdventureWorks.BAK' WITH MOVE 'Adventureworks_DB' TO 'C:\test\Adventureworks.mdf', MOVE 'Adventu

  • Multiple IT1005 for one job

    Can we have multiple planned compensation (IT1005) records for one job within the same country? The standard SAP has the time constraint as "3" for IT1005 and that means that it can have multiple records with the same dates. We want to use different

  • 360 degree panorama spin in Edge Animate (was: 360 degree panorama )

    I am trying to create 360 degree panorama. I've got an existing panoramic image made in photoshop which I imported into edge animate. I need the image move continuously and start over at the beginning seamlessly when the animation gets to the end of