File Visibility in uploading the file using web DynPro java

hello,
i have gone through the tutorial " uploading & downloading the file using web DynPro java".
the upload functionalty is working fine. but i need to know thw path where these files are getting uploaded ??
Waiting for the reply..
Regards,
Viren Gupta

Hi Viren,
Are you are refering to the below tutorial for upload and download:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0e10426-77ca-2910-7eb5-d7d8982cb83f?QuickLink=index&overridelayout=true
If yes, then answer is that the file is stored in the context of the application only as "com.sap.ide.webdynpro.uielement-definitions.Resource" object. Please read through the tutorial to understand the full process.
WD doesn't really upload to server automatically unless there is any explicit code written. All it does is to store the file in a temp context which you can access and write your own code to store it in a particular location.
Regards,
Mahesh

Similar Messages

  • 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

  • Reading contents of uploaded excel file in web dynpro java

    Hi All.
    I am aware how to provide facility to upload files in web dynpro java. But my requirement is that on uploading a particular file (for eg. an excel file having 10 columns), I need to read the contents of that file and store it in a table in R/3.Can anyone suggest a way how I can read the contents of the uploaded file?
    Thanks and Regards,
    Saurabh.

    Hi.
    I am having the following requirement : I have a FileUpload UI element where user clicks Browse button, selects a file from the local system and presses a Upload button. Upon pressing Upload, the name of the selected file and the contents of the file should be shown.
    In the View context, I have two value attributes: FileName of type String and FileResource of type binary.
    This is the code that I have in the Upload button action handler :
      public void onActionUpload(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload(ServerEvent)
        IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(
                 IPrivateReadExcelView.IContextElement.FILE_RESOURCE);
        IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType)attributeInfo.
                 getModifiableSimpleType();
        IPrivateReadExcelView.IContextElement element = wdContext.createContextElement();
        String fname = binaryType.getFileName();
        wdComponentAPI.getMessageManager().reportSuccess("File selected - "+fname);  //Statement 1
         try {
              wdComponentAPI.getMessageManager().reportSuccess("Successful");    // Statement 2
              InputStream in = new FileInputStream(fname);
              HSSFWorkbook wb = new HSSFWorkbook(in);
              wdComponentAPI.getMessageManager().reportSuccess("Successful");    //Statement 3
              int sheetsNo = wb.getNumberOfSheets();
              for (int i=0;i<sheetsNo;i++) {
                   HSSFSheet sheet = wb.getSheetAt(i);
                   Iterator rowsNo = sheet.rowIterator();
                   while(rowsNo.hasNext()) {
                        HSSFRow rows = (HSSFRow)rowsNo.next();
                        Iterator colsNo = rows.cellIterator();
                        while(colsNo.hasNext()) {
                             HSSFCell cell = (HSSFCell)colsNo.next();
                             wdComponentAPI.getMessageManager().reportSuccess("File uploaded" +
                                  "successfully");
                             if(cell.getCellType()==1) {
                                  wdComponentAPI.getMessageManager().reportSuccess("00000"+
                                       cell.getStringCellValue());
                             else if(cell.getCellType()==0) {
                                  String str=""+cell.getNumericCellValue();
                                  wdComponentAPI.getMessageManager().reportSuccess("11111"+str);
         catch(Exception e) { wdComponentAPI.getMessageManager().raisePendingException();
        //@@end
    On pressing Upload button, name of selected file is being shown(Statement 1). I am also getting Statement 2 in the output. However I am not getting Statement 3 onwards.
    Where am I going wrong? Can anyone shed some light on this?

  • How to browse local file using web dynpro

    hi everyone
    How can I browse local file using Web Dynpro?And read file names into Context or array. I have tried the following code but its not working
    String resourcePath = WDURLGenerator.getResourcePath();
    String depObjResourcePath = WDURLGenerator.getResourcePath(“Test”);
    WDDeployableObjectPart appPart = WDDeployableObject.getPart(“Test”, “TestApp”, WDDeployableObjectPart.APPLICATION);
    help required urgently
    Thanks & Regards
    Jaspreet Kaur

    Reply in
    how to browse local file using web dynpro
    Regards,
    Ashwani Kr Sharma

  • Problem in completing the TASK when using Web Dynpro Java and BPM

    Hi,
    I am using Web Dynpro Java and BPM.
    i see my Web Dynpro View when i run the process.
    Just that the task is not completing.
    when i click on the Web Dynpro button to signal the completion of the event, nothing happens.
    i have appropriately created events in both Component controller and Interface Controller and used the same in creating the Task.
    a method in Component controller fires the event and a button click in the view calls this method.
    i have successfully completed Donka Dimitrova's "SAP Netweaver Business Process Management-End-to-End Process Implementation Sample " but when i tried my own with slight modifications, it is not working !!!
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/d07f3e88-554f-2b10-3cbf-ab8afea51b9f
    regards,
    -Amol Gupta

    Hi Amol,
    The way you described the things, I dont see any problems. Just to make sure that you are triggering the right event that you mapped as completion event for the task, try to cross check once again and see if the correct event is getting triggered. Also try to put some messages for debugging to see till where the control goes.
    Regards,
    Arafat

  • How to set a variable in portal session using web dynpro java.

    Hi,
    I have created a web dynpro application, which is running inside portal. I have created a role called "R1". Inside role R1, i have created 3 workset W1, W2 and W3. and inside each workset i have some pages and iviews.
    My requirement is when user logins to the portal , and when he clicks on role R1 for the first time, a login page should come (so that we can do revalidation), and when he enters his password again in that login page , then only workset W1, W2 and W3 should be visible/accessible to him and after successful revalidation, if he clicks again on role R1, in that particular portal session, than that login page should not come.
    for this, i thought i will set a variable in portal session, whenever user successfully revalidated himself, and if after successful revalidation he clicks again on role R1, i will check in doinit method of webdynpro whether variable is set or not (which i already set on successful revalidation), and if it is set then i will do Donavigation else i will present login page to the user.
    Can anyone tells me how to set a variable in portal session using web dynpro java.
    thanks
    Arush

    Hi,
    Try this:
    WDScopeUtil.put(WDScopeType.CLIENTSESSION_SCOPE, key, value)
    WDScopeUtil.get(WDScopeType.CLIENTSESSION_SCOPE, key)
    Ex:
    WDScopeUtil.put(WDScopeType.CLIENTSESSION_SCOPE,"Key1","Value1");
    String value1=WDScopeUtil.get(WDScopeType.CLIENTSESSION_SCOPE,"Key1").toString();
    /people/william.cui/blog/2007/02/12/sharing-session-context-between-parent-and-external-windows-running-on-same-host
    Regards,
    Charan

  • Create  PCD folder using web dynpro Java

    Hi All ,
    I would like to create pcd folder structure using web dynpro java
    i.e. My folder at top level and under this there will be iviews , roles , worksets  etc.
    Is it possible using WDJ ?
    I have checked the below link , but for folders I did not get anything.
    http://help.sap.com/saphelp_nw04/helpdata/en/44/6aaf92f5a23672e10000000a114a6b/frameset.htm
    Can you please help me ?
    Thanks,
    Sandip

    Hi,
    Please refer to the following document
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/508baf88-9335-2d10-efa6-c6ad61e5fc4b?quicklink=index&overridelayout=true
    The same can be implemented in webdynpro also.
    Regards,
    Raju Bonagiri
    Edited by: Raju Bonagiri on Sep 3, 2010 8:36 AM

  • How to create a user in UME Database using web dynpro java custom application

    Hi,
    Can you please suggest me how to create a user in UME Database using web dynpro java custom application.
    My Requirement is user can register his/her user id in SAP Portal 7.3 UME database.
    Please suggest me.
    Thanks and Regards,
    Amit

    Hi Amit,
    Generated Documentation (Untitled)
    This is what you're looking for, there's no real cook-book -- though Amey mentioned there might be some material on SDN, perhaps some tutorials.
    You should be looking into com.sap.security.api.IUserFactory, methods newUser(String) which gives you and IUserMaint and commitUser(IUserMaint, IUserAccount) -- IUserAccount can be obtained using com.sap.security.api.IUserAccountFactory, method newUserAccount(String)
    Hope it helps,
    D.

  • How to implement Captcha using Web Dynpro Java

    Hi Experts,
    Can you please provide any information on CaptchaImplementation using Web Dynpro Java. We are using NWDS 7.01.
    Regards,
    Suvankar

    Hello Suvankar,
    maybe this blog will help. But haven't tryed it myself.
    http://scn.sap.com/blogs/balab/2006/09/25/bid-adieu-to-bots--using-captchas
    Regards,
    Tobi

  • Reusable objects using web dynpro java...any suggestions ?

    Hello All,
    I want to create few Reusable objects using web dynpro java. Please suggest some scenarios.
    regards
    Mrinalini.

    Hi,
    I can suggest especially this one:
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/30d56578-f7e5-2a10-5ab5-8afc55d2e0e8
    Some other hits you may find useful:
    This guide mentions some tutorials about reusability:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/ba2db0e5-0601-0010-9790-e271902f2c38?quicklink=index&overridelayout=true
    Here
    Web Dynpro Java [original link is broken]
    and here
    SAP NetWeaver Composition Environment Samples Center [original link is broken]
    you'll find other tutorials as well.
    Best Regards,
    Ervin

  • 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.

  • Creating sales order using web dynpro JAVA

    Hello everyone,
    i am new to web dynpro. Can any one tell me how to creating sales order by web dynpro JAVA using BAPI.
    Thanks.
    Vinita Sharma

    Hi...
    you can use Adaptive RFC methodology in web dynpro java to work with BAPIs..... these are standard bapi's provided
    Here are required Bapis... select which one you want....
    BAPISDORDER_GETDETAILEDLIST Sales Order: List of All Order Data
    BAPI_ORDER_CHANGE_STATUS_GET Change status for order
    BAPI_SALESDOCU_CREATEFROMDATA Creating a Sales Document
    BAPI_SALESORDER_CHANGE Sales Order: Change Sales Order
    BAPI_SALESORDER_CREATEFROMDAT1 Sales Order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDAT2 Sales Order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDATA Create sales order, no more maintenance
    BAPI_SALESORDER_GETLIST Sales order: List of all orders for customer
    BAPI_SALESORDER_GETSTATUS Sales order: Display status
    BAPI_SALESORDER_SIMULATE Sales Order: Simulate Sales Order
    check this thread SALES ORDER creation using BAPI
    sample java program which will call SAP bapi function sales order create
    PradeeP

  • How to use Web Dynpro Java isChanged and isChangedByClient

    Hello,
    I have read thorugh a lot of documentation, threads, ... --> but the picture is not geting clearer fro me.
    We have Web Dynpro Java Application (on Netweaver 7.0 SP12) running in Enterprise Portal. We need to tell the portal work protect mode, that we have unsaved changes (how to do this is clear).
    I am struggling with figuring out, that my Web Dynpro Context has unsaved changes. I found the two change-indicators isChanged() and isChangedByClient(), which already confuses me a little bit.
    Anyway, this is what I have figured out so far:
    I am calling wdContext.currentContextElement().isChangedByClient() to figure out changes and when a Save operation has been completed sucessfully, I call wdContext.currentContextElement().node().getContext().resetChangedByClient(). This works for some of the changes made by the user.
    I then tried calling wdContext.nodeABC().getElementAt(i).isChanged() for all nodes of my Web Dynpro Context, but this results in detecting changes before the user ha done any interaction.
    Implementing an own change tracking (i.e. by adding a changed-Attribute to each context node) does not seem a viable option for me.
    So these are my questions:
    - Does anyone now a working pattern relying on those chnage indicators ?
    - Does anyone now how to reset the isChanged indicator (or when it is resetted by the framework) ?
    Any help appreciated.
    Thank you,
    Stefan

    Hi
    Check this link
    Re: How to keep isChangedbyClient flag set between roundtrips?
    http://help.sap.com/javadocs/NW04/current/wd/com/sap/tc/webdynpro/progmodel/api/IWDNodeElement.html
    Thanks

  • Upload File in Web Dynpro Java CO and store it in the context

    Hi Guys!
    I have developed a web dynpro CO form, and I need to be able to upload a file in an action and then be able to download that file in further actions.. I have evaluated saving the file in the backend via RFC, in KM and also creating a CAF project.. but I think there must be a simpler way : saving it in the context of GP.
    Does someone knows if it is possible to do that?
    best regards,
    Marco.

    Hi Marco
    In webdynpro java, there are UI elements File Upload and File Download. You can use these UI's to upload and download attachments. From NetWeaver 7.0 onwards, you have IWDResource interface which can be used to upload attachments. But in GP if you want to pass attachment to another action you must use Binary as a data source. Bind the File upload UI element to Binary. In addition, you should define input and out parameters in getDescription method.
    Thanks
    Ghazanfar

  • Uploading & Downloading Files into DMS Server using Web Dynpro Java

    Hello Friends,
          I want to Upload a file from Portal to Document Management Server and to Download a file from Document Management Server to Portal,  In short, I want to give the user the facility to Upload a File into DMS Sever via Portal and also to download the file from DMS Sever via Portal.
      Can anybody give me a Input for the same from Both Java Development End as well as ABAP End, more inputs are required from ABAP end, since i have a very less ABAP Experience on working with DMS. Few Questions i have in my mind?
    1. How to actually access the file contents with the help of Document Number?
    2. With the help of Doc-Number we can extract the file from DMS sever but to provide a option for downloading in portal, the   RFC should convert the File Contents into X-String or is there some other way?
    +3. While Uploading the Data should be given in Which format to RFC? Are there any limitation with respect to size or formats. Is there any Standard RFC i can use directly in WD4 Java application to upload the file into DMS Server and which will return me the Document Number? +
    Please give me your valuable inputs.
    Thank You.
    Edited by: TusharShinde on Feb 21, 2011 11:13 AM
    Now, I am able to download the File in Portal via my WD4 Java Application from DMS Server by passing the Document Number, but I am facing the problem in downloading the PDF files, Its not working for PDF files. Please give me inputs for the same.
    Thank You.
    Edited by: TusharShinde on Feb 22, 2011 10:13 AM

    HI,
    Thanks for reply.
    I am able to download the file From DMS server but I am still not able to Upload the File to DMS Server via Portal. For Download also it is working for all file formats but not for PDF any specific reason for the same.
    function zhrf_rfc_dms_download_document.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(LV_DOCUMENT) TYPE  DOKNR
    *"  EXPORTING
    *"     VALUE(LV_FADA) TYPE  XSTRING
    *"  TABLES
    *"      LT_DOC STRUCTURE  BAPI_DOC_FILES2
    *"      LT_OUT STRUCTURE  ZST_DMS_FILE_XSTRING
    data: ls_docfiles type bapi_doc_files2,
             ls_dms type dms_doc_files,
             lt_docfiles type standard table of bapi_doc_files2.
    *      data: LT_OUT  type table of  ZST_DMS_FILE_XSTRING.
      data :wa_out like line of lt_out.
      select single * from dms_doc_files
        into ls_dms
        where doknr = lv_document."Retrieve file
      if sy-subrc = 0.
        ls_docfiles-documenttype = ls_dms-dokar.
        ls_docfiles-documentnumber = lv_document.
        ls_docfiles-documentpart = ls_dms-doktl.
        ls_docfiles-documentversion = ls_dms-dokvr.
    *    ls_docfiles-documenttype = '321'.
    *    ls_docfiles-documentnumber = LV_DOCUMENT.
    *    ls_docfiles-documentpart = '000'.
    *    ls_docfiles-documentversion = 'A0'.
      endif.
      call function 'BAPI_DOCUMENT_CHECKOUTVIEW2'
        exporting
          documenttype    = ls_docfiles-documenttype
          documentnumber  = ls_docfiles-documentnumber
          documentpart    = ls_docfiles-documentpart
          documentversion = ls_docfiles-documentversion
          documentfile    = ls_docfiles
          getstructure    = '1'
          getcomponents   = 'X'
          getheader       = 'X'
    *      pf_http_dest    = 'SAPHTTPA'
          pf_ftp_dest     = 'SAPFTPA'
        tables
          documentfiles   = lt_docfiles.
      data: i_bin type standard table of sdokcntbin,
            i_info type standard table of scms_acinf,
            v_info type scms_acinf,
            v_id type sdok_phid,
            v_cat type sdok_stcat.
      if sy-subrc = 0.
        loop at lt_docfiles into ls_docfiles.
          v_id = ls_docfiles-docfile.
          v_cat = ls_docfiles-storagecategory.
          call function 'SCMS_DOC_READ'
            exporting
              stor_cat              = v_cat
              doc_id                = v_id
              phio_id               = ls_docfiles-file_id
            tables
              access_info           = i_info
              content_bin           = i_bin
            exceptions
              bad_storage_type      = 1
              bad_request           = 2
              unauthorized          = 3
              comp_not_found        = 4
              not_found             = 5
              forbidden             = 6
              conflict              = 7
              internal_server_error = 8
              error_http            = 9
              error_signature       = 10
              error_config          = 11
              error_format          = 12
              error_parameter       = 13
              error                 = 14
              others                = 15.
        endloop.
        if sy-subrc <> 0.
        else.
          data: v_xstring type xstring.
          read table i_info into v_info index 1.
          call function 'SCMS_BINARY_TO_XSTRING'
            exporting
              input_length = v_info-comp_size
            importing
              buffer       = v_xstring
            tables
              binary_tab   = i_bin
            exceptions
              failed       = 1
              others       = 2.
          if sy-subrc <> 0.
          endif.
        endif.
        wa_out-file_name =  ls_docfiles-docfile.
        wa_out-binary = v_xstring.
        lv_fada = v_xstring.
        append wa_out to lt_out.
      endif.
    endfunction.
    The above is the RFC Code,  I am using in my WD4Java app for downloading the file From DMS Server, Is there any Improvement suggested for above RFC to make it work in more efficient way. Please give me input for my Upload RFC.
    Thank You.

Maybe you are looking for

  • Installing Windows 7 on mSSD directly from HDD recovery partion (no USB, no DVD)

    I bought a mSSD and plan to use two 500GB HDD I already have. I want to install my OS on the mSSD, preferably with the Lenovo Recovery Partition. In the F11@bootup recovery menu, I could only install a recovery or backup on the HDD, not on the mSSD.

  • Hard Drive Space Eaten, but where? - 10.6

    I can't figure out where 120 GB of Hard Drive Space has gone.  I've scoured other similar threads, but none like this: 1 - 451 GB are listed as being used (in Finder/About My Mac/Whatsize/Activity Monitor/etc) 2 - outside programs, including WhatSize

  • Why Cant I open NEF files In Photoshop CS3?

    I bought a Nikon D7000 and can not open the Raw files (NEF) I did not have this problem with my Pentax and DNG files. I can not seem to find Camera Raw either. Any help would be great!

  • How do I use Scout to monitor an Actionscript Worker?

    To capture data from an Actionscript Worker, do these 3 things  1. in Scout, go to Preferences > Beta Features, and make sure "Start sessions for Actionscript Workers" is enabled. 2. in Scout, go to Window > Sidebar, and make sure that "Actionscript

  • Purchase order does not update tax code in info recode ?

    Hi Expert, Please help me ........... I have 2 problems. 1. I created PO and tick Infoupdate at ME21N but tax code doesn't update to info record ? 2. How to tax code can be defaulted into PO line items by I don't want create info recode ? Thanks,