File Upload In DMS Using Web Dynpro ABAP

Hi,
I have a requirement to upload files in DMS using Web Dynpro. I have written the code by the hint of the following thread:-
scn.sap.com/thread/1865934 
My code is uploading all files but when I try to view them from CV03N only txt files are displaying , Images and PDF files are not
showing there.
Please help me. It's urgent requuirement.
Thanks
Amit

TYPES : BEGIN OF zst_ts_raw_line,
             line TYPE orblk,
            END OF zst_ts_raw_line.
  DATA : ls_draw TYPE draw ,
           ls_api_ctrl TYPE cvapi_api_control,
           ls_message TYPE messages,
           lv_documentnumber TYPE draw-doknr,
           it_objectlinks  TYPE STANDARD TABLE OF  dms_db_drad,
           ig_objectlinks TYPE  dms_db_drad ,
           it_documentdescriptions  TYPE STANDARD TABLE OF  bapi_doc_drat,
           ig_documentdescriptions TYPE  bapi_doc_drat ,
           it_originals_of_doc TYPE STANDARD TABLE OF  cvapi_doc_file,
           ig_originals_of_doc TYPE  cvapi_doc_file ,
           lv_storage_cat TYPE cv_storage_cat,
           lv_size TYPE i ,
           lt_bindata TYPE STANDARD TABLE OF zst_ts_raw_line,"  STANDARD TABLE  OF zst_ts_raw_line,
           ls_bindata TYPE  zst_ts_raw_line ,"SOLISTI1,"sdokcntbin ,
           ls_drao TYPE drao,
           lt_drao TYPE TABLE OF drao,
           lt_DRAT TYPE TABLE OF DMS_DB_DRAT,
           ls_DRAT TYPE DMS_DB_DRAT,
           lt_files TYPE cvapi_tbl_doc_files,
           ls_files TYPE cvapi_doc_file,
           l_string TYPE string.
  DATA : ex_pf_ftp_dest           TYPE  rfcdes-rfcdest.
  DATA : ex_pf_http_dest          TYPE  rfcdes-rfcdest.
  DATA lo_nd_upload TYPE REF TO if_wd_context_node.
  DATA lo_el_upload TYPE REF TO if_wd_context_element.
  DATA ls_upload TYPE wd_this->element_upload.
  DATA lo_nd_upload1 TYPE REF TO if_wd_context_node.
  DATA lo_el_upload1 TYPE REF TO if_wd_context_element.
  DATA ls_upload1 TYPE wd_this->element_upload1.
  DATA lo_nd_upload2 TYPE REF TO if_wd_context_node.
  DATA lo_el_upload2 TYPE REF TO if_wd_context_element.
  DATA ls_upload2 TYPE wd_this->element_upload2.
*   navigate from <CONTEXT> to <UPLOAD> via lead selection
  lo_nd_upload = wd_context->get_child_node( name = wd_this->wdctx_upload ).
  lo_el_upload = lo_nd_upload->get_element( ).
  lo_el_upload->get_static_attributes(  IMPORTING   static_attributes = ls_upload ).
* navigate from <CONTEXT> to <UPLOAD1> via lead selection
  lo_nd_upload1 = wd_context->get_child_node( name = wd_this->wdctx_upload1 ).
  lo_el_upload1 = lo_nd_upload1->get_element( ).
  lo_el_upload1->get_static_attributes( IMPORTING static_attributes = ls_upload1 ).
* navigate from <CONTEXT> to <UPLOAD2> via lead selection
  lo_nd_upload2 = wd_context->get_child_node( name = wd_this->wdctx_upload2 ).
  lo_el_upload2 = lo_nd_upload2->get_element( ).
  lo_el_upload2->get_static_attributes( IMPORTING  static_attributes = ls_upload2 ).
  DATA : lv_file_name   TYPE filep.
  ls_draw-dokar = 'Document Type'.
  ls_draw-dokvr = '00'.
  ls_draw-doktl = '000'.
  ls_draw-dwnam = sy-uname.
  lv_storage_cat = 'Storage space'.
  ls_DRAT-doknr = 'Document Type'.
  ls_DRAT-dokvr = '00'.
  ls_DRAT-doktl = '000'.
  ls_DRAT-dktxt = 'Test Document'.
  ls_drat-dktxt_uc = 'Test Document'.
  append ls_drat to lt_drat.
  ls_api_ctrl-tcode = 'CV01N'.
  ls_api_ctrl-commit_flag = 'X'.
  ls_api_ctrl-save_flag = 'X'.
  ls_api_ctrl-api_mode = 'X'.
  ls_api_ctrl-no_update_task = 'X'.
  ls_draw-filep = ls_upload-filename. "l_string. *
  ig_objectlinks-dokar = doc type
  ig_objectlinks-dokvr = '00'.
  ig_objectlinks-doktl = '000'.
  ig_objectlinks-dokob = 'LFA1'.
  ig_objectlinks-objky =  lifnr.
  APPEND ig_objectlinks TO it_objectlinks.
  CALL FUNCTION 'CVAPI_DOC_CREATE'
    EXPORTING
      ps_draw        = ls_draw
*•  PF_STATUSLOG             = ' '
*•  PF_REVLEVEL              =
      ps_api_control = ls_api_ctrl
*•  PF_FTP_DEST              = ' '
*•  PF_HTTP_DEST             = ' '
*•  PF_HOSTNAME              = ' '
*•  PF_CONTENT_PROVIDE       = ' '
    IMPORTING
      psx_message    = ls_message
*•  PFX_DOKAR                =
      pfx_doknr      = lv_documentnumber
    TABLES
      pt_drad_x      = it_objectlinks
      pt_drat_x      = lt_drat
*      pt_files_x     = lt_files.
*      documentdescriptions = it_documentdescriptions.
  IF sy-subrc NE 0.
    WRITE: 'no number'.
  ENDIF.
  IF ls_message-msg_type CA 'EA'.
  ELSE.
    ls_draw-doknr = lv_documentnumber.
    COMMIT WORK.
  ENDIF.
  DATA lv_count TYPE i.
  DO 3 TIMES.
    REFRESH : lt_files,lt_bindata,lt_drao.
    lv_count = lv_count + 1.
    ls_files-appnr = lv_count."'1'.
    CASE lv_count.
      WHEN '1'.
        ls_files-filename = ls_upload-filename. "wa_general-REF_FILE_NAME1.  "
        ls_upload-filecontent = ls_upload-filecontent.
      WHEN '2'.
        ls_files-filename = ls_upload1-filename. "wa_general-REF_FILE_NAME1.  "
        ls_upload-filecontent = ls_upload1-filecontent.
      WHEN '3'.
        ls_files-filename = ls_upload2-filename. "wa_general-REF_FILE_NAME1.  "
        ls_upload-filecontent = ls_upload2-filecontent.
    ENDCASE.
    MOVE ls_files-filename TO lv_file_name.
    CALL FUNCTION 'CV120_DOC_GET_APPL'
      EXPORTING
*•PF_DIALOG        =
*•PF_DISPLAY       =
*       PF_FILE   = 'DO.TXT'
        pf_file   = lv_file_name "wa_general-REF_FILE_NAME1 "
*•PF_TYPDT         =
      IMPORTING
        pfx_dappl = ls_files-dappl.
    ls_files-updateflag = 'I'.
    ls_files-langu = sy-langu.
    ls_files-storage_cat = 'Srotage ID'.
    ls_files-description = 'DMS'.
    APPEND ls_files TO lt_files.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer        = ls_upload-filecontent "wa_general-ref_doc1   "
*•  APPEND_TO_TABLE       = ' '
      IMPORTING
        output_length = lv_size
      TABLES
        binary_tab    = lt_bindata.
    DATA : lv_zaehl TYPE obzae.
    CLEAR lv_zaehl.
    LOOP AT lt_bindata INTO ls_bindata.
      CLEAR ls_drao.
      lv_zaehl = lv_zaehl + 1.
      ls_drao-orblk = ls_bindata-line.
      ls_drao-orln = lv_size.
*      ls_drao-dokar = ls_draw-dokar.
*      ls_drao-doknr = lv_documentnumber.
*      ls_drao-dokvr = ls_draw-dokvr.
*      ls_drao-doktl = ls_draw-doktl.
      ls_drao-zaehl = lv_zaehl.
*      ls_drao-appnr = lv_count."'1'.
      APPEND ls_drao TO lt_drao.
    ENDLOOP.
    CALL FUNCTION 'CVAPI_DOC_CHECKIN'
      EXPORTING
        pf_dokar           = ls_draw-dokar
        pf_doknr           = lv_documentnumber
        pf_dokvr           = ls_draw-dokvr
        pf_doktl           = ls_draw-doktl
        ps_api_control     = ls_api_ctrl
        pf_content_provide = 'TBL'
      IMPORTING
        psx_message        = ls_message
      TABLES
        pt_files_x         = lt_files
        pt_content         = lt_drao.
    COMMIT WORK.
  ENDDO.

Similar Messages

  • How to save file in km using web dynpro abap

    Hi Experts,
    We have a requirement that file should be saved in a folder in km, the name of the folder should be the employee number.
    Could you please tell me how to create folder with employee number in KM and store file in it using web dynpro abap.
    Thanks and Regards,
    Santhoshi.

    Thanks Naga Raju Meesala.
    How come all these methods are deprecated...getEP5User
    Also, since I am building a weddynpro DC, what is the proper way to include these jar files as Used DCs?
    Now proceed in the same way with the variable PORTAL_HOME and add the following .jar files:
    u2022 \lib\prtapi.jar The portal runtime APIs
    u2022 \portalapps\com.sap.portal.usermanagement\lib\com.sap.security.api.ep5.jar The user management APIs of the Enterprise Portal 5.0 are deprecated, but still in use in SAP NetWeaver 04
    u2022 \portalapps\com.sap.netweaver.bc.rf\lib\bc.rf.framework_api.jar KM Repository Framework APIs
    u2022 \portalapps\com.sap.netweaver.bc.rf.service\lib\bc.rf.global.service.urlgenerator_api.jar Repository Framework Utility: URL Generator
    u2022 \portalapps\com.sap.netweaver.bc.sf\lib\bc.sf.framework_api.jar Repository Framework: Repository Services
    u2022 \portalapps\com.sap.netweaver.bc.util\lib\bc.util.public_api.jar Repository Framework Utilities

  • How to display the data of CJ2C(T-CODE) using web dynpro abap

    Hi all:
        How to display the data of CJ2C(T-CODE) using web dynpro abap.
        CJ2C used to display a Gantt Chart.
        Thanks.

    Hi,
    Create a Value attribute (resource) of type Resource, bind it with the property of File Upload UI element.
    On action place the code and Deploy the application
    byte[] bytes = new byte[ 1024];
    FileOutputStream out = new FileOutputStream( new File( <path in server>));
    InputStream in = resource.read( true);
    int len;
    while( ( len = in.read( bytes)) > 0)
         out.write( bytes, 0, len);
    in.close();
    out.close();
    Regards
         Vinod V

  • Overwriting a File in the KM using web dynpro

    Hello,
    im using the createresource method to upload files into the km using web dynpro.
    (using the following tutorial: https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70a60afe-d576-2a10-68bf-9ce3988dc39e )
    however, if i try to upload a file which is already there, it doesnt overwrite it, instead it throws an exception without any additiona info.
    is there any way of doing this?
    many thanks,
    Eli.
    Edited by: Eli Eren on Nov 24, 2008 11:22 PM

    Hi,
    first check, if the resource exists, then decide to create or update content:
        IResource resource = (ResourceFactory.getInstance().getResource(rid, ctx));
        ICollection aCollection=(ICollection)resource;
        // get new resource RID
        RID newResRid = RID.getRID(repository+RID.PATH_SEPARATOR+resourceName);
        // try to find the resource
        IResource newResource = (ResourceFactory.getInstance().getResource(newResRid, ctx));
        if(newResource!=null)  {
          // does exist - update content
          newResource.updateContent(content);
        else  {
          // does not exist - create
          newResource = aCollection.createResource(resourceName, null, content);
    Hope that helps,
    Romano

  • Adobe form to save data using Web Dynpro ABAP

    Hi. I am pretty new to SAP world and trying to learn and work on a task given to me relate to
    creating Adobe offline form using Web Dynpro ABAP same time.
    I have several questions and hopefully, many gurus like you will provide answers.
    I noticed there are many examples creating and using Adobe interactive forms (though not many newer version),
    but I didn't see (at least I didn't find any) any detail example on saving data to an internal table (such as fixed assets, vendor master, etc)
    using interactive form. Is there any detail explanation/example on this?
    I have ask this question in another forum (before I found this forum) but didnu2019t get the answer yet.
    2. When I tried to see graphic layout and modify the layout from Web Dynpro, I can't see the graphic layout.
    All I see is text list of fields/buttons that I created, but can't see section for graphic layout where I can modify layout.
    I am sure I didn't install/configure something correctly.
    Anyone has any idea what I didn't do?
    I have another question, but I will wait till later after I figure out above ones first.
    Thanks for all your help in advance.
    John

    Hi John,
    In the WD4A view, there is a button "Show/Hide Layout Preview".
    Click on that button to be able to see the Layout.
    Note that this button is next to the Pretty Print button.
    regards,
    Reema.

  • Reading HTML Content using Web Dynpro ABAP

    Hello,
    I was wondering if it is possible to read the content (HTML) behind a given URL using Web Dynpro ABAP.  If so, are there any functions available to parse the HTML ?   I have been asked to develop an application that requires going to a URL, reading the content, and formatting a table from that content for presentaion within Web Dynpro ABAP.  The HTML of the URL is nothing more than a "Table of Contents" to existing documentation ( Word Documents )
    Thank you for any help / advice you can provide
    Larry

    You can get the HTML returned in a table using fm RSFO_HTML_REQUEST2.
    Once you have that, you can convert it to a string using any number of methods. CL_RSR_WWW_RENDERER=>TABLE_TO_STRING should work fine.
    One option for parsing it would be to get it converted into an iXML object, but you might have to do quite a bit of manipulation first depending on what the html looks like. You can see more info here on iXML classes: [http://help.sap.com/saphelp_nw04/helpdata/de/86/8280ba12d511d5991b00508b6b8b11/frameset.htm|http://help.sap.com/saphelp_nw04/helpdata/de/86/8280ba12d511d5991b00508b6b8b11/frameset.htm]
    Otherwise I would just make use of find statements with regex patterns to sort through the html.

  • Create portal user using web dynpro abap application

    Dear All,
    I would like to know is it possible to create portal user-id through web dynpro abap application.
    My requirement is
    > I have to create a web dynpro abap application. In the web dynpro abap application I have name email-id and phone number as entry fields.
    > I will click on submit, one unique id will get created. This unique id will be the login id for portal.
    I found how to create portal user using web dynpro java, but i could not find regarding web dynpro abap.
    If it is possible to create the portal users using web dynpro abap pls share the code as well.
    Regards,
    Swapnil Indulkar

    Hi swapnil,
    I think by using BAPi.. BAPI_USER_CREATE1 you can create.
    Please check this...
    Create portal user from webdynpro abap
    Creating user and assigning a group through code
    user administration su01
    How can i get the portal user id from logon ticket in the webdyn 4 ABAP
    Cheers,
    Kris.
    Edited by: kissnas on May 21, 2011 8:47 AM

  • Upload file into KM using Web Dynpro ABAP

    Hi, I'm looking at converting an existing Web Dynpro Java application to a Web Dynpro ABAP application. However, I cannot find how to upload a file and store it in the Portal KM repository using WDA. I have been able to do it successfully using WDJ. Any help on how to do this would be very much appreciated. Thanks.

    Hi, I'm looking at converting an existing Web Dynpro Java application to a Web Dynpro ABAP application. However, I cannot find how to upload a file and store it in the Portal KM repository using WDA. I have been able to do it successfully using WDJ. Any help on how to do this would be very much appreciated. Thanks.

  • Shooping cart creation in SRM 7.0 using web dynpro ABAP classes.

    Hi,
    We have recently upgraded to SRM 7.0 from SRM 4.0. We are using customized portal application for the creation of the shopping cart.I am planning to create custom FM which will use the standard Web dynpro ABAP classes to create the shopping cart.
    Could you please guide with the classes that are need to be implemented and the sequence of the classes used in the shopping cart creation.
    I think these are the classes that are used in the standard web dynpro ABAP component.
    CL_FPM_EVENT ->                  Creates an instance of this class based on an event ID.
    CL_BADI_FLT_DATA_TRANS_AND_DB -> Data Handling: Transport and Database.
    CL_EXITHANDLER ->               Class for Ext. Services Within Framework of Exit Technique.
    CL_EX_BBP_DOC_CHANGE_BADI ->     BAdI Class CL_EX_BBP_DOC_CHANGE_BADI.
    CL_BBP_OBJECTS_ACCESS ->         Access Functions for Object Types.
    /SAPSRM/CL_PDO_BO_SC ->          Shopping Cart BO.
    Your expert comments will be appreciated...
    Regards,
    Naresh

    Dear Poster,
    As no response has been provided to the thread in some time I must assume the issue is resolved, if the question is still valid please create a new thread rephrasing the query and providing as much data as possible to promote response from the community.
    Best Regards,
    SDN SRM Moderation Team

  • Rules Engine using Web Dynpro ABAP

    Hi,
    Can we build a Rules Engine which works with Web Dynpro-ABAP?  Something similar to BRM in CE-7.2.
    Thanks,
    Prasanna

    Do you mean BRM or BRF.  BRF is the name of the business rules framework that is integrated in the ABAP engine. BRM is Business Rules Management and a part of NetWeaver CE - running on the Java Stack and a part of SAP NetWeaver BPM (Business Process Management).
    Generally if your work is all ABAP based you would use BRF.  Here is a small eLearning that shows the usage of BRF within Web Dynpro ABAP.
    http://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/c0181bb1-28e7-2c10-538c-a093c616310e

  • When to use 'Web dynpro ABAP' and when to go for 'Web Dynpro Java'

    Hi,
    I am trying to learn 'Web dynpro ABAP' from tutorials available on SDN as i am presently working in ABAP. I am also Java learned.
    Please tell me the selection criteria for using Web Dynpro component / application using ABAP or JAVA.
    Regards,
    Tanaya

    Hi,
    Go through this
    Web Dynpro: ABAP or Java?
    WebDynpro for ABAP Vs Java
    Re: Javascript future in Webdynpro (JAVA and ABAP)
    Javascript future in Webdynpro (JAVA and ABAP)
    PradeeP

  • E-recruiting using web dynpro ABAP

    Hi experts,
      I am new to HR E-recruiting. I understand the concepts through SDN and [help.sap.com]. But I want to know how to develop E-Recruiting in Web dynpro ABAP. Is there any tutorial or document for this....
    I cant get a clear idea till now. Please provide me with some steps,documents and procedures .
    Thanks&Regards,
    vino

    Vino,
    check these links
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/72/c9b54015c4752ae10000000a155106/frameset.htm
    EREC 600-http://help.sap.com/saphelp_erp60_sp/helpdata/en/72/c9b54015c4752ae10000000a155106/frameset.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/45/8150635e9c40c1e10000000a1553f7/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/30adcac6-7a55-2a10-9fa9-a61d947f6ec9
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a07122ae-8216-2a10-c9a5-996717a0648b
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/24396589-0a01-0010-3c8c-ab2e3acf6fe2
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/erphcm/sap%2be-recruiting
      E-Recruitment-SAP E-Recruiting
    Thanks
    Bala Duvvuri

  • Not able to upload file in DMS(Document Mang. system) using Web dynpro ABAP

    Hi All,
    I am facing a problem while uploading the file into the DMS ( Document Management System ) from Webdnrpo .
    I am using the BAPI - BAPI_DOCUMENT_CREATE2 to create the document .
    CASE - 1
    when i am providing the storage category mention below and no data carrier1
    ls_documentfiles-storagecategory = 'ZHMEL_CS'.  it is not able to upload the document in the DMS system and when i check
    in the debugg mode it giving error as  ""Error while checking in and storing: C:\TEST.TXT "" .
    CASE - 2
    When i am not using the storage category and providing the the data carrier as default
    ls_documentdata-DATACARRIER1 = 'DEFAULT'. It is able to create the document in the DMS but i am not able to read that document .
    I checked with DMS Consultant that DMS is configured for  ZOL ( documenttype) with a storage category  as 'ZHMEL_CS'.
    The code which i have used is below :
    ls_documentdata-documenttype = 'ZOL'.
    ls_documentdata-documentversion = '00'.
    ls_documentdata-documentpart = '000'.
    ls_documentdata-description = 'Test Document'.
    ls_documentdata-laboratory = '001'.
    ls_documentdata-WSAPPLICATION1 = 'TXT'.
    ls_documentdata-DOCFILE1 = 'C:\TEST.TXT'.
    ls_documentdata-SAVEDOCFILE1 = 'C:\TEST.TXT'.
    *ls_documentdata-FILESIZE1 = 000000000000.
    *ls_documentdata-FILESIZE2 = 000000000000.
    ls_documentdata-WSAPPLICATION1 = 'TXT'.
    ls_documentfiles-DOCUMENTTYPE = 'ZOL'.
    ls_documentfiles-DOCUMENTPART = '000'.
    ls_documentfiles-DOCUMENTVERSION = '00'.
    ls_documentfiles-storagecategory = 'ZHMEL_CS'.
    ls_documentfiles-WSAPPLICATION = 'TXT'.
    ls_documentfiles-DOCPATH = 'C:\'.""lv_filename.
    ls_documentfiles-DOCFILE = 'TEST.TXT'."lv_filename.
    ls_documentfiles-description = 'Test Document'.
    ls_documentfiles-language = 'EN'.
    ls_documentfiles-CHECKEDIN = 'X'.
    APPEND ls_documentfiles to lt_documentfiles .
    *&----Fill Descriptions
    w_descr-language = 'EN'.
    w_descr-language_iso = 'EN'.
    w_descr-description = 'Test'.
    append w_descr to lt_descr.
    clear w_descr.
    **w_hostname = 'HMEL-DV1R3_DR3_00'.
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
    EXPORTING
    documentdata = ls_documentdata
    *hostname = 'content-srv'
    *pf_http_dest = 'SAPHTTPA'
    *pf_ftp_dest  = 'SAPFTPA'
    IMPORTING
    DOCUMENTNUMBER = lv_DOCUMENTNUMBER
    return = gv_return
    TABLES
    documentdescriptions       = lt_descr
    documentfiles              = lt_documentfiles.
    Please let me know your valuable inputs on the same ..
    Edited by: Omm Awasthi on Dec 30, 2010 12:22 AM
    Edited by: Omm Awasthi on Dec 30, 2010 12:25 AM

    Hi omm , from functional side your require a document type and content repository
    I have used below code in a function module to create document , we have create object link as PO to the doc.
    FUNCTION ZFM_SR_CREATE_FROM_EXTERNAL .
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(IV_DOCUMENTNUMBER) TYPE  DOKNR OPTIONAL
    *"     VALUE(IV_DOCUMENTTYPE) TYPE  DOKAR OPTIONAL
    *"     VALUE(IV_DOCUMENTVERSION) TYPE  DOKVR OPTIONAL
    *"     VALUE(IV_DOCUMENTPART) TYPE  DOKTL_D OPTIONAL
    *"     VALUE(IV_STORAGE_CAT) TYPE  CV_STORAGE_CAT OPTIONAL
    *"     VALUE(IV_DOKST) TYPE  DOKST OPTIONAL
    *"     VALUE(IT_DM_FILES) TYPE  ZDM_TT_FILES OPTIONAL
    *"     VALUE(IV_EBELN) TYPE  EBELN
    *"  EXPORTING
    *"     VALUE(EV_DOCUMENTNUMBER) TYPE  DOKNR
    *"     VALUE(ES_RETURN) TYPE  BAPIRET2
    V00.00  DD.MM.YYYY                                                   *
    *********************New Method of Uploading File*********************************
      CONSTANTS path_name    TYPE dms_path
               VALUE '/tmp/'.
      CONSTANTS log TYPE dms_path VALUE '/tmp/logFO.txt'.
      DATA: ls_draw TYPE bapi_doc_draw2,
            lt_documentfiles TYPE TABLE OF bapi_doc_files2,
            ls_documentfiles TYPE bapi_doc_files2,
            ls_dm_files TYPE zdm_files,
            lv_filename TYPE string,
            lv_ext TYPE string,
            lv_file_type TYPE draw-dappl,
            lv_file_name TYPE dms_path,
            lv_msg(80) TYPE c,
            lt_objectlinks TYPE TABLE OF bapi_doc_drad,
            ls_objectlinks TYPE bapi_doc_drad,
            lv_ebelp   TYPE ebelp
    Prepare Data
      MOVE iv_documentnumber TO ls_draw-documentnumber.
      MOVE iv_documenttype TO ls_draw-documenttype.
      MOVE iv_documentversion TO ls_draw-documentversion.
      MOVE iv_documentpart TO ls_draw-documentpart.
      ls_draw-statusextern = iv_dokst.
      ls_draw-statusintern = iv_dokst.
      ls_draw-username = sy-uname.
      LOOP AT it_dm_files INTO ls_dm_files.
        SPLIT ls_dm_files-filepath AT '.' INTO lv_filename lv_ext.
        CALL FUNCTION 'CV120_DOC_GET_APPL'
          EXPORTING
            pf_file   = ls_dm_files-filepath
          IMPORTING
            pfx_dappl = lv_file_type.
        TRANSLATE lv_file_type TO UPPER CASE.
        OPEN DATASET log FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
        TRANSFER lv_ext TO log.
        ls_documentfiles-wsapplication = lv_file_type.
        TRANSLATE ls_documentfiles-wsapplication TO UPPER CASE.
        CONCATENATE path_name
                           lv_filename
                            lv_ext
                            INTO lv_file_name.
        CONDENSE lv_file_name  NO-GAPS.
        TRANSFER lv_file_name TO log.
        OPEN DATASET lv_file_name FOR OUTPUT IN BINARY MODE MESSAGE lv_msg.
    *Transfer Attachment Content to Application Server
        TRANSFER ls_dm_files-content TO lv_file_name.
        CLOSE DATASET lv_file_name.
        TRANSFER 'move data to lt_files' TO log.
        ls_documentfiles-storagecategory = iv_storage_cat.
        ls_documentfiles-docfile = lv_file_name.
        ls_documentfiles-DOCUMENTVERSION = IV_DOCUMENTVERSION.
        APPEND ls_documentfiles TO lt_documentfiles.
        CLEAR lv_file_name.
        CLOSE DATASET log.
      ENDLOOP.
      IF iv_ebeln IS NOT INITIAL.
        ls_objectlinks-objecttype = 'EKPO'.
        SELECT SINGLE ebelp INTO lv_ebelp FROM ekpo WHERE
                                          ebeln = iv_ebeln
                                          AND loekz eq space.
        CONCATENATE iv_ebeln lv_ebelp INTO ls_objectlinks-objectkey.
        APPEND ls_objectlinks TO lt_objectlinks.
      ENDIF.
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
       EXPORTING
         documentdata   = ls_draw
         pf_ftp_dest    = 'SAPFTPA'
         pf_http_dest   = 'SAPHTTPA'
       IMPORTING
         documentnumber = ev_documentnumber
         return         = es_return
       TABLES
         objectlinks          = lt_objectlinks
         documentfiles  = lt_documentfiles.
    DATA:   ls_doc_data  type bapi_doc_draw2,
       ls_doc_datax type bapi_doc_drawx2,
       ls_return type bapiret2.
    Set value for document data
      ls_doc_data-statusextern  = 'IW'.
      ls_doc_data-statusintern  = 'IW'.
    Set value for document data check
    ls_doc_datax-statusextern = 'X'.
    ls_doc_datax-statusintern = 'X'.
    CALL FUNCTION 'BAPI_DOCUMENT_CHANGE2'
      EXPORTING
        DOCUMENTTYPE               = 'ROS'
        DOCUMENTNUMBER             = IV_DOCUMENTNUMBER
        DOCUMENTPART               = IV_DOCUMENTPART
        DOCUMENTVERSION            = IV_DOCUMENTVERSION
        DOCUMENTDATA               = ls_doc_data
        DOCUMENTDATAX              = ls_doc_datax
      HOSTNAME                   =
      DOCBOMCHANGENUMBER         =
      DOCBOMVALIDFROM            =
      DOCBOMREVISIONLEVEL        =
      SENDCOMPLETEBOM            = ' '
          pf_ftp_dest    = 'SAPFTPA'
          pf_http_dest   = 'SAPHTTPA'
      CAD_MODE                   = ' '
      ACCEPT_EMPTY_BOM           = ' '
    IMPORTING
       RETURN                     =  ls_return
    TABLES
      CHARACTERISTICVALUES       =
      CLASSALLOCATIONS           =
      DOCUMENTDESCRIPTIONS       =
      OBJECTLINKS                =
      DOCUMENTSTRUCTURE          =
       DOCUMENTFILES              = lt_documentfiles.
      LONGTEXTS                  =
      COMPONENTS                 =
      move es_return to ES_RETURN.
      IF es_return-type CA 'EA' ."NE 'E' AND es_return-type NE 'A'.
        "do nothing
      ELSE.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = 'X'.
      ENDIF.
      LOOP AT lt_documentfiles INTO ls_documentfiles.
        DELETE DATASET ls_documentfiles-docfile.
      ENDLOOP.
    ENDFUNCTION.

  • Upload .xls file in internal table in web dynpro abap

    Hi everyone,
    i want to upload .xls(excel file) into an internal table.....after lots of attempts i came to a conclusion that web dynpro only supports .CSV(another format of excel file) to be uploaded into internal table....i tried many ways....is there a way i can upload .xls file...kindly help me in the same. following is the code i m using
      DATA LO_EL_CONTEXT TYPE REF TO IF_WD_CONTEXT_ELEMENT.
      DATA LS_CONTEXT TYPE WD_THIS->ELEMENT_CONTEXT.
      DATA ITEM_FILE TYPE WD_THIS->ELEMENT_CONTEXT-EXCEL_UPLOAD.
      get element via lead selection
      LO_EL_CONTEXT = WD_CONTEXT->GET_ELEMENT( ).
      @TODO handle not set lead selection
      IF LO_EL_CONTEXT IS INITIAL.
      ENDIF.
      get single attribute
      LO_EL_CONTEXT->GET_ATTRIBUTE(
        EXPORTING
          NAME =  `EXCEL_UPLOAD`
        IMPORTING
          VALUE = ITEM_FILE ). "xstring format
    DATA S_CONT TYPE STRING.
    DATA CONVT TYPE REF TO CL_ABAP_CONV_IN_CE.
    DATA: FIELDS1 TYPE STRING_TABLE.
    1st tried this code-> using "cl_abap_conv_in_ce"
    CALL METHOD cl_abap_conv_in_ce=>create
    EXPORTING
    *encoding = c_encoding "optional
    input = ITEM_FILE
    RECEIVING
    conv = CONVT.
    CALL METHOD CONVT->read
    IMPORTING
    data = S_CONT.
    when it didnt work out...then tried followin function module
      CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
        EXPORTING
          IN_XSTRING        = ITEM_FILE "xsrting
       IMPORTING
         OUT_STRING          = S_CONT
    TYPES: BEGIN OF TY_TAB,
           NAME_CHAR TYPE  STRING,
           DESCR_CHAR TYPE  STRING,
           NUMBER_DIGITS TYPE  STRING,
           END OF TY_TAB.
    DATA: FIELDS TYPE STRING_TABLE.
    DATA: LV_FIELD TYPE STRING.
    DATA: S_TABLE TYPE STRING_TABLE.
    DATA: ITAB TYPE TABLE OF TY_TAB.
    DATA: STR_ITAB TYPE TY_TAB.
    *splits string based on new line
    SPLIT S_CONT AT CL_ABAP_CHAR_UTILITIES=>CR_LF INTO TABLE S_TABLE.
    FIELD-SYMBOLS: <WA_TABLE> LIKE LINE OF S_TABLE.
    LOOP AT S_TABLE ASSIGNING <WA_TABLE>.
    splits string on basis of tabs
      SPLIT <WA_TABLE> AT ',' INTO
                      STR_ITAB-NAME_CHAR
                      STR_ITAB-DESCR_CHAR
                      STR_ITAB-NUMBER_DIGITS.
      APPEND STR_ITAB TO ITAB.
    ENDLOOP.
    I am able to do the uploading if the file is in .CSV format and not .XLS format....
    there are lots of forums on SDN for the same....but at the end there is no solution provided.....
    experts kindly solve it this time...thanks in advance

    Hi,
    It is not possible to upload an xls file because it will be having some binary characters. better to go with .csv file format.
    Refer this [link too|Re: Excel File Uplaod] it will explain you clearly.
    Regards
    Arun.P

  • Calling URL when click on buttons using web dynpro - ABAP

    Hi All,
    I am new to web dynpro application development and i am facing issue when i try to test my application.
    simple require when i click on button i should direct the to one of url say 'http://www.google.co.in/' my application is activate with no error but when i test the application i am getting below error , can someone please provide me the solution or way out.
    The URL http://ides47:8062/sap/bc/webdynpro/sap/zwa_calling_url/ was not called due to an error.
    Note
    The following error text was processed in the system N6Q : Access via 'NULL' object reference not possible.
    The error occurred on the application server IDES47_N6Q_62 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: IF_WDR_CONTEXT_MENU_HANDLER~CONTEXT_MENU_CALLED of program CL_WDR_INTERNAL_WINDOW_ADAPTERCP
    Method: IF_WDR_CONTEXT_MENU_HANDLER~CONTEXT_MENU_CALLED of program CL_WDR_INTERNAL_WINDOW_ADAPTERCP
    Method: IF_WDR_ADAPTER_EVENT_HANDLER~HANDLE_EVENT of program CL_WDR_CONTEXT_MENU_HANDLER===CP
    Method: IF_WDR_CLIENT~GET_CLIENT_UPDATES of program CL_WDR_CLIENT_SSR=============CP
    Method: EXECUTE of program CL_WDR_MAIN_TASK==============CP
    Method: IF_HTTP_EXTENSION~HANDLE_REQUEST of program CL_WDR_MAIN_TASK==============CP
    Method: EXECUTE_REQUEST_FROM_MEMORY of program CL_HTTP_SERVER================CP
    Function: HTTP_DISPATCH_REQUEST of program SAPLHTTP_RUNTIME
    Module: %_HTTP_START of program SAPMHTTP
    HTTP 500 - Internal Server Error
    Thanks,
    Parab

    Hi ,
    It seesms something you are missing. It would be easy for us if you could paste your code which you have written in the Action of Button.
    Sample code for your reference :
    METHOD onactionget_url .
    data lo_window_manager type ref to if_wd_window_manager.
    data lo_api_component  type ref to if_wd_component.
    data lo_window         type ref to if_wd_window.
    lo_api_component  = wd_comp_controller->wd_get_api( ).
    lo_window_manager = lo_api_component->get_window_manager( ).
    CALL METHOD lo_window_manager->CREATE_EXTERNAL_WINDOW
      EXPORTING
        URL            = 'http://www.google.co.in/'
        MODAL          = ABAP_FALSE
        HAS_MENUBAR    = ABAP_TRUE
        IS_RESIZABLE   = ABAP_TRUE
        HAS_SCROLLBARS = ABAP_TRUE
        HAS_STATUSBAR  = ABAP_TRUE
        HAS_TOOLBAR    = ABAP_TRUE
        HAS_LOCATION   = ABAP_TRUE
      RECEIVING
        WINDOW         = lo_window.lo_window->open( ).
    ENDMETHOD.

Maybe you are looking for

  • How to get rid of the loading bar in the start

    Hello I have a macbook pro retina 13" my system is : yosemite 10.10.2 when I start my laptop there is a loading bar ? how can I get rid of it ?? I want to go into the desktop straight away ?? Thanks

  • RFC destination getting created

    Hi All, I am creating scripts using SAPGUI command in the target system. The source system is WAS6.20 and the target system is 6.40. Whenever i create a recording using SAPGUI, an extra RFC destination is created with following naming convention: ECA

  • Get mountain lion on my other computers?

    I just got a new MBP with Mt. Lion installed.  Am I now entitled to copies of it on the other macs on my account?

  • Help with syncing blackberry pearl to Mac

    Hi there, hopefully a simple question. I have Pearl 8100 and can't figure out what to chose on the drop down menu when looking for syncing software for Mac.  There is a blackberry 8120 option but that doesn't seem right.  Can anyone advise? Thanks

  • My sound on my computer sounds like Mickey's mouse

    MY SOUND SOUNDS LIKE IM DOWN IN A WELL