RFC to upload files

Hi all,
We have a webdynpro application with is creating a service notification using BAPI_SERVNOT_CREATE through RFC call.
Now we need to add to this webdynpro application the ability of creating an attachment, as the user can do using transaction IW52 (change service notification), on "service for object/create/create attachment".
We are searching for a RFC that could do that. Some of you has already tried to do something like that?  
Thanks.
roberti

.

Similar Messages

  • How to via JCO Call RFC upload file to the SAP DMS.

    HI ,ALL :
      NOW i want to upload file via JCO,but i upload in sap gui is success ,but jco call RFC is error ,this is my code:
    excute this  code is not error ,but the data not write to SAP,
            //连接SAP
              Client client = com.hipfung.jco.JCOFactory.getInstance().getClient();
              JCO.Repository repo = new JCO.Repository("ZOA01", client);
              //调用RFC函数
              IFunctionTemplate ft = repo.getFunctionTemplate("CVAPI_DOC_CHECKIN");
              JCO.Function f = ft.getFunction();
              IFunctionTemplate ft2 = repo.getFunctionTemplate("BAPI_TRANSACTION_COMMIT");
              JCO.Function commitFunction = ft2.getFunction();
              //设置传入参数值(注意类型)
              //1.传入参数为Field
                f.getImportParameterList().setValue("TXB",          "PF_DOKAR");  //
              f.getImportParameterList().setValue("0000010101010101020000000","PF_DOKNR");  //文档类型
              f.getImportParameterList().setValue("01","PF_DOKVR");                          //文档版本
              f.getImportParameterList().setValue("000","PF_DOKTL");     
              f.getImportParameterList().setValue("SAPFTPA","PF_FTP_DEST");     
              f.getImportParameterList().setValue("SAPHTTPA","PF_HTTP_DEST");     
              // Get content as table
              f.getImportParameterList().setValue("TBL", "PF_CONTENT_PROVIDE");
            //read file and trans to byte
                      byte b[]=null;
                        File inf = new File("d:
    test.jpg");
                        InputStream in;
                        try {
                             in = new FileInputStream(inf);
                              b =new byte[(int)inf.length()];     //创建合适文件大小的数组
                             in.read(b);                          //读取文件中的内容到b[]数组
                             in.close();
                        } catch (FileNotFoundException e1) {
                             // TODO Auto-generated catch block
                             e1.printStackTrace();
              //set byte to internal table     
             JCO.Table poItem = f.getTableParameterList().getTable("PT_CONTENT");        
             poItem.appendRow(); //增加空行
             poItem.setValue(b, "ORBLK");
             poItem.nextRow();
             //运行RFC函数
              try
                   client.execute(f);
                   client.execute(commitFunction);
              catch(JCO.AbapException ae)
                   System.err.println("JCO.AbapException: < DMS > " + ae);
                   ae.printStackTrace();
              catch(JCO.Exception e)
                   System.err.println("JCO.Exception: < DMS > " + e);
                   e.printStackTrace();
             //返回参数
              JCO.Structure struct = f.getExportParameterList().getStructure("PSX_MESSAGE");
              String te = struct.getString("MSG_TYPE");
              System.out.println("RFC Error Type is :"+te);
              String pr = struct.getString("MSG_TXT");
              System.out.println("RFC get Data is :"+pr);
              com.hipfung.jco.JCOFactory.getInstance().release(client);
    i  can get file via CVAPI_DOC_CHECKoutView
    Edited by: pan qiaoming on Mar 15, 2011 3:05 PM

    HI ,ALL :
      NOW i want to upload file via JCO,but i upload in sap gui is success ,but jco call RFC is error ,this is my code:
    excute this  code is not error ,but the data not write to SAP,
            //连接SAP
              Client client = com.hipfung.jco.JCOFactory.getInstance().getClient();
              JCO.Repository repo = new JCO.Repository("ZOA01", client);
              //调用RFC函数
              IFunctionTemplate ft = repo.getFunctionTemplate("CVAPI_DOC_CHECKIN");
              JCO.Function f = ft.getFunction();
              IFunctionTemplate ft2 = repo.getFunctionTemplate("BAPI_TRANSACTION_COMMIT");
              JCO.Function commitFunction = ft2.getFunction();
              //设置传入参数值(注意类型)
              //1.传入参数为Field
                f.getImportParameterList().setValue("TXB",          "PF_DOKAR");  //
              f.getImportParameterList().setValue("0000010101010101020000000","PF_DOKNR");  //文档类型
              f.getImportParameterList().setValue("01","PF_DOKVR");                          //文档版本
              f.getImportParameterList().setValue("000","PF_DOKTL");     
              f.getImportParameterList().setValue("SAPFTPA","PF_FTP_DEST");     
              f.getImportParameterList().setValue("SAPHTTPA","PF_HTTP_DEST");     
              // Get content as table
              f.getImportParameterList().setValue("TBL", "PF_CONTENT_PROVIDE");
            //read file and trans to byte
                      byte b[]=null;
                        File inf = new File("d:
    test.jpg");
                        InputStream in;
                        try {
                             in = new FileInputStream(inf);
                              b =new byte[(int)inf.length()];     //创建合适文件大小的数组
                             in.read(b);                          //读取文件中的内容到b[]数组
                             in.close();
                        } catch (FileNotFoundException e1) {
                             // TODO Auto-generated catch block
                             e1.printStackTrace();
              //set byte to internal table     
             JCO.Table poItem = f.getTableParameterList().getTable("PT_CONTENT");        
             poItem.appendRow(); //增加空行
             poItem.setValue(b, "ORBLK");
             poItem.nextRow();
             //运行RFC函数
              try
                   client.execute(f);
                   client.execute(commitFunction);
              catch(JCO.AbapException ae)
                   System.err.println("JCO.AbapException: < DMS > " + ae);
                   ae.printStackTrace();
              catch(JCO.Exception e)
                   System.err.println("JCO.Exception: < DMS > " + e);
                   e.printStackTrace();
             //返回参数
              JCO.Structure struct = f.getExportParameterList().getStructure("PSX_MESSAGE");
              String te = struct.getString("MSG_TYPE");
              System.out.println("RFC Error Type is :"+te);
              String pr = struct.getString("MSG_TXT");
              System.out.println("RFC get Data is :"+pr);
              com.hipfung.jco.JCOFactory.getInstance().release(client);
    i  can get file via CVAPI_DOC_CHECKoutView
    Edited by: pan qiaoming on Mar 15, 2011 3:05 PM

  • Uploading Files From VC (invoking RFC) into ECC

    Hi Experts,
    I have a requirement which consist of uploading files (from any PC) XML or PDF extension into ECC. I need to do this with a web UI. I got no experience with CE 7.1 (and above) and I just wonder if it is possible from CE 7.1 VC or CE 7.2 VC uploading files into ECC with an RFC development. Is there any uploading component available in VC 7.X which I am not aware of ???
    Regards
    David Cortes
    Edited by: David Cortes on Dec 12, 2011 8:27 PM

    Hi Nivas,
    Thank you for your response. What I really want to know is ..... if CE 7.1 VC or above has a component for uploading files. My scenario is  as follow.
    SAP NetWeaver  EP 7 (1 server)
    ECC SAP invoice manage (1 server)
    *Open Text - Invoice Content (1 server)
    My requirement is to built a Web User Interface Portal for uploading files (from any computer) and save it into ECC and OpenText Server. I would like to do this with VC but there is no any component for uploading files (not available in NetWeaver 7).
    I do not know if it is a component for uploading files available in CE 7.1 VC or higher and I really would like to know and request for this installation.
    Regards
    David Cortes

  • File uploading file through RFC

    Hi All ,
    I am trying to upload file using FM GUI_Upload ,its working fine when i run in sap , But throws a Dump if the  file path is passed from .net . The same file path when i pass it in sap directly it works fine .
    the error :
    OBJECTS_OBJREF_NOT_ASSIGNED in FM DP_CONTROL_ASSIGN_TABLE
    Any Help will be great .
    Thanks
    Vinay

    Hi use this
    reward if help
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    FILENAME = FILENAME
    FILETYPE = 'ASC'
    TABLES
    DATA_TAB = BUFFER
    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
    OTHERS = 22

  • Error while uploading file in BPS

    Hi all,
    I am getting an error while uploading file to BPS through web interface
    I get a red stop button with error message : error while calling up RFC.
    when i double click the red stop button, i get no long text but the error message I get is UPC 202
    please advice me to resolve this issue.
    many thanks in advance,
    Ravi

    The informations are really not much to have an idea about the problem.
    The problem can be located in the fm that calls the file because is trying to search the file on a system where there are some kind of problems in the communication between the systems involved to read and pass the file. Did u map the file name with logical filenames ? Very strange problem. Can you browse in the server where the file is located . Is it on your pc ?
    Or, there is some problem in the datas provided, but this problem should arise more when you save than when you just press to load.
    With this kind of imformations is very hard to have an idea. You need to debug to see what s going on
    Regards

  • Question about upload file to sever in jsp.

    i found some articles about upload file in jsp, and most of suggested that the third party classes will be used.
    but i want to know the basic technology behind them, for example what kind of class needed ( using java.io.* as usual)
    and what the process for writing a file to sever.
    any document or url link useful will be very welcomed.
    best regards

    Uploading a file is similar to sending any other kind of data, except that it must be encoded differently than a standard HTML form... Typically you will set up your form like this:
    <form action="/upload" enctype="multipart/form-data" method="POST">
    <input type="file" name="myFile">
    </form>
    The enctype declaration is necessary -- your file won't arrive intact any other way. However, the JSP/Servlet specs don't provide any code to deal with forms which are encoded this way, so things like request.getParameter() don't work. You will either have to roll your own code, or use a third party library.
    For more information, see RFC 1867, File upload in HTTP:
    http://www.faqs.org/rfcs/rfc1867.html

  • Upload File and Store it in R/3

    All,
    I want to upload the File from webdynpro to R/3. I want to store it in some Ztable. How can I do that. Can anyone help me. I already saw the upload/Download tutorial. Its not explaining how to read the uploaded file & stroe it in R/3.
    Pls help me..
    BM

    Hi Bharathi,
    You can find my code below. I can upload file to R/3.
           for (int k = 0; k <wdThis.wdGetContext().nodeRequisitionsTable().size(); k++)
                   IPublicNewPurchaseReqCust.IRequisitionsTableElement tn =wdThis.wdGetContext().nodeRequisitionsTable().getRequisitionsTableElementAt(k);
                   IPublicNewPurchaseReqCust.IFileUploadElement tableelement =wdThis.wdGetContext().nodeFileUpload().getFileUploadElementAt(k);
                   if(purgrptbl.getPurchaseGroup().equals(tableelement.getPurGroup()))
                   if (!(tn.getGr_Ind()))
                        if(tableelement.getFileSource()!=null)
                        IWDResource resource = tableelement.getFileSource();
                        Zbapi_Pr_Create_Attachment_Input inputattach = new Zbapi_Pr_Create_Attachment_Input();
                        wdContext.nodeZbapi_Pr_Create_Attachment_Input().bind(inputattach);
                        inputattach.setBanfn(wdContext.currentOutput_PRCreateElement().getNumber());
                   //file inputstream basla
                        Soli objhead1 = new Soli();     
                        objhead1.setLine("&SO_FILENAME="+resource.getResourceName());     
                        inputattach.addObjhead(objhead1);
                        Soli objhead2 = new Soli();
                        objhead2.setLine("&SO_FORMAT=BIN");     
                        inputattach.addObjhead(objhead2);
                        final int chunkSize = 255;
                        final byte[] chunk = new byte[chunkSize];     
                        try
                             final BufferedInputStream in
                               = new BufferedInputStream(tableelement.getFileSource().read(false));     
                             int size = this.getFileSize2(resource);
                             while((size=in.read(chunk, 0, chunkSize))> 0)
                        // If last chunk is partial, pad rest with zeros
                                  if ( size < chunkSize )
                                    Arrays.fill( chunk, size, chunkSize, (byte) 0);
                             //create new list object
                                  final Solix objbin = new Solix();
                             //write the byte array into the list
                                  objbin.setLine(chunk);
                             //add list to input node for RFC
                                  inputattach.addObjcont_Bin(objbin);
                          in.close();
                          catch (IOException e2)
                        e2.printStackTrace();
                   //file inputstream end
                        Sood1 headchange = new Sood1();
                        headchange.setObjla("TR");
                        headchange.setObjnam("Bildirim2");
                        int strleng=resource.getResourceName().length();
                        String Filename=resource.getResourceName().substring(0,strleng-4);
                        headchange.setObjdes(Filename);
                        headchange.setFile_Ext(resource.getResourceType().getFileExtension());     
                        headchange.setObjlen(Integer.toString(this.getFileSize2(resource)));
                        inputattach.setObject_Hd_Change(headchange);     
                   try
                        inputattach.execute();
                   } // END TRY
                   catch (WDDynamicRFCExecuteException ce)
                       IWDMessageManager manager = wdComponentAPI.getMessageManager();               
                         manager.reportException(ce.getMessage(), false);
                   } // END CATCH
                        }//if(tableelement.getFileSource()!=null)
                   }//!(tn.getGr_Ind()))           
              }//purgrptbl.getPurchaseGroup().equals(tableelement.getPurGroup())     

  • Dynamic file name from input payload (RFC 2 flat file)

    Hi,
    I have an RFC to flat file scenario. The output flat file has not an XML structure, it's just a plain text file generated with abap mapping.
    In my source interface (RFC), I have a field called <FILENAME>, I want to use the value of that field to create the target file using dynamic file name. But if  in variable substitution I use payload:ZRFC_NAME,1,FILENAME,1 It doesn't work because the dynamic variable substitution try to access to output payload, not the source one...
    What can I do?

    Hi Marshal,
           You can add a extra node to your target strucutre like
    FileName- Node
    --FileName - Element.
    do the mapping from the field filename of RFC to FileName field in u r target strucure. And use this  field path at Refrence in variable subtituion.
    In the Content converison add the Name & Values as below
    FileName.fileldNames -- FileName
    FileName.fieldFixedLengths -- 0
    FileName.fixedLengthTooShortHandling -- Cut
    So the extra field in u r target structure would not populate in u r target text file.
    Cheers
    Veera

  • Adobe Muse won't publish (Error uploading file)

    After making simple animations using Adobe Edge Animate it seems as though none of the assets will publish with my site after importing them into Muse.
    In Edge animate I saved for "web animation" and published. Then I went to muse and hit "place". I went to preview and everything works fine. When I go to publish there are always errors in uploading my assets with '.png' extensions.
    Any help is much appreciated. I have completely scrapped my website and created another, reinstalled Animate and have renamed all my files, I'm not sure whats wrong here.
    I got one animation working, and that can be seen here under the Photography section, but I have multiples that will be shown on my page at one time.
    http://chasebodydesign.businesscatalyst.com

    I get the error uploading file everytime I try publishing the animation.

  • Change upload file name with com.oreilly.servlet.MultipartRequest to handle the file upload

    1. when use com.oreilly.servlet.MultipartRequest to handle the file upload, can I change the upload file name .
    2. how com.oreilly.servlet.MultipartReques handle file upload? do it change to byte ?
    what  different?  if I use the following method?
       File uploadedFile = (File) mp.getFile("filename");
                   FileOutputStream fos = new FileOutputStream(filename);
                    byte[] uploadedFileBuf = new byte[(int) uploadedFile.length()];
                   fos.write(data);
                 fos.close();

    My questions are
    1) when use oreilly package to do file upload , it looks like i line of code is enough to store the upload file in the
    file direction.
    MultipartRequest multi =
            new MultipartRequest(request, dirName, 10*1024*1024); // 10MB
    why some example still use FileOutputStream?
    outs = new FileOutputStream(UPLOADDIR+fileName); 
        filePart.writeTo(outs); 
       outs.flush(); 
      outs.close();
    2) can I rename the file name when I use oreilly package?

  • Request.getParameter() when uploading files

    Hi, I need to upload files and do other works .. such that, in my html ..
    <form name="composer" method="post" ENCTYPE="multipart/form-data">
    <input type=hidden name="a" value="a">
    <input type=File name=inputfile>
    <inpu type=button name=Upload onClick='upload file'>
    <inpu type=button name=otherStuff onClick='do other stuff'>
    </form>
    In the jsp for 'do other stuff', I have the following statement to get the value of a
    String a = request.getParameter("a");
    However, it returns 'null', if I erase the 'ENCTYPE' part from the html file, it works. How can I get it right?

    If your ENCTYPE is multi-part/form-data, then there is another technichque to read the form parameters.
    request.getParameter() won't work.
    first u need to read the requenct explicitely and divide the contents into parameters, files etc. and then read the parameter values.
    you can get a lot of stuff regarding this on web, like 'uploading files using jsp'.
    have fun!!

  • Remove link for uploaded files in application

    Hi all,
    I've been following the tutorial on how to upload and download files in application at http://download-uk.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32469/up_dn_files.htm. I have now created my own table which stores the uploaded files and can download them successfully. I would now like to add the ability to delete these files within the application and was wondering what the best way of doing this was?
    I would like to add another column to the displayed report with a 'Remove file' link for each listed file, which when clicked would delete the file from the table. I've already tried using a similar method to the one used to upload the files (instead of uploading the file, the called procedure deletes it from the table using the specified ID), but this causes the application to display a blank page when the link is clicked, which I dont want (but does delete the file).
    I would appreciate any suggestions.
    Regards,
    Dave

    Dave,
    See the login page:
    http://htmldb.oracle.com/pls/otn/f?p=31517:101
    There are details on how to access the application builder, where you can see how the
    setup of that download, delete, upload application has been done.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Delete an uploaded file (in custom table) from a report

    Hi,
    I have a report of uploaded files (the files are saved in my own table, not in APEX_APPLICATION_FILES) - I'd like to add a delete link to each file in my report so that the user can delete a particular file.
    How do I go about doing this?
    Thanks.

    Melissa,
    It is now working. You missed couple of things:
    1. javascript in the header
    2. you were pointing to the page 1 and your process was on the page 2
    3. you passed the value to a non existing item on the page 3
    4. the request which would fire the delete process was triggered by a wrong request
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to upload file from a client machine to server machine

    hei evryone!
    can anyone pls help me on how i can upload file from a client machine to another machine (or server). using jsp.Then later on, i can also retrieve the names of these files to place it as values for option tag in an html form.I have a seperate screen for uploading the file and the screen for displaying all the files that were uploaded on the server...
    any sample code/ ideas would be much appreciated.Thx!!!!

    hei evryone!
    can anyone pls help me on how i can upload file from a client machine to another machine (or server). using jsp.Then later on, i can also retrieve the names of these files to place it as values for option tag in an html form.I have a seperate screen for uploading the file and the screen for displaying all the files that were uploaded on the server...
    any sample code/ ideas would be much appreciated.Thx!!!!

  • How to upload file from client to server

    Can someone please help.
    User needs to browse file on his desktop and upload file using browse button. This file should then be uploaded to the server. I am using javascript in the front end and servlet in the back.
    Any help will be highly appreciated.
    Thanks,
    Indrasish

    Jakarta Commons FileUpload is the standard way of doing the file uploading these days. You can find source, binaries and documentation at the Jakarta Site http://jakarta.apache.org/ . The Commons has a number of subprojects, so start with the Commons libraries, then find FileUpload.
    Brian

Maybe you are looking for

  • Cursor

    Hi I want to show the cursor on the XY graph,but I want the reading of the cursor can display on the graph or indicator also can.I do not want to show in the legend box.how to set another question is I just want horizontal cursor to display y-axis va

  • Transferring music from old computer to new

    I lost all of my music while trying to sync my Ipod touch to my new computer. However, I still have my Itunes library on my old computer, which is on its last leg. This includes many songs copied from CD's, which would take hours to duplicate. Is the

  • DVCPro HD transfer through FireWire 800

    Hi there, I'm planning on connecting an external DVCProHD tape deck to capture footage using Final Cut Pro through the 800 port, then chaining a LaCie drive via an adapter to catpure the footage on to this external drive. So essentially, a FireWire 8

  • Formbuilder where does it work for sure?

    I am finding that it is not true that formbuilder (11.1.1.4) is not compatible with 2008 r2 64 bits.... yet. I fear I will find out why it's not certified... sooner or later... But it is working with everything that should not work. 2008 r2 64 bits a

  • WLC - External WebAuth Documentation

    Hi All, I currently have a guest access WLAN setup on our WLC / WCS using the internal webauth functionality. I would like to set this up to use External webauth (we need an external server to host ~16 different custom pages which are all branded etc