Download Excel file through Web dynpro with no windows open?

Can we have a web dynpro application that just returns an Excel file in the response with no open windows? Similar to a java servlet that is used to download a Excel file?
This basically means that I cannot use wdComponentAPI.getWindowManager().createNonModalExternalWindow()
Java Servlet Code
HttpSession session = request.getSession();      // get a handle on the session id
response.setContentType("application/download");
response.setHeader("Content-Disposition", "filename=RTIS_Report.xls");
PrintWriter out = null;
out = response.getWriter();
String report = request.getParameter("REPORT");
JCO.Table lines = download(request, session, report);
for (int i = 0; i < lines.getNumRows(); i++) {
     lines.setRow(i);
     String content = lines.getString("LINES") + "\n";
     out.write(content);
     out.flush();
out.flush();
out.close();

Hi,
I think you can use IWD Cached Web Resource to achieve this..
See the below code FYI..
public void downloadToExcel( )
    String fileName = "Customer" + ".xls";
     IWDCachedWebResource cachedExcelResource = null;
     try
          File f = new File("Customer.xls");
          WritableWorkbook workbook =   Workbook.createWorkbook(f);
          WritableFont black = new WritableFont(WritableFont.createFont("Trebuchet MS"),WritableFont.DEFAULT_POINT_SIZE,WritableFont.BOLD,false,UnderlineStyle.SINGLE,Colour.BLACK);
          WritableCellFormat blackFormat = new WritableCellFormat(black);
          WritableFont blue = new WritableFont(WritableFont.createFont("Trebuchet MS"),WritableFont.DEFAULT_POINT_SIZE,WritableFont.NO_BOLD,false,UnderlineStyle.NO_UNDERLINE,Colour.BLUE);
          WritableCellFormat blueFormat = new WritableCellFormat(blue);
          WritableSheet sheet = workbook.createSheet("Customer", 0);
               Label label;
               String[] header={"Corporate Code","Batch ID"};
               for (int i=0;i<2;i++)
                    label = new Label(i,0,header<i>.toString(),blackFormat);
                    sheet.addCell(label);
               WritableCellFormat integerFormat = new WritableCellFormat(NumberFormats.INTEGER);
               jxl.write.Number number;
               // Reading the contents
               for(int i=0;i<wdContext.nodeVn_DownloadToExcel().size();i++)
                    String strCorpName = wdContext.currentContextElement().getVa_CorpCode();
                    String strBatchID =     wdContext.nodeVn_DownloadToExcel().getVn_DownloadToExcelElementAt(i).getVa_BatchID();
                    label = new Label(0,i+1,strCorpName,blueFormat);
                    sheet.addCell(label);
                    label = new Label(1,i+1,strBatchID,blueFormat);
                    sheet.addCell(label);
               workbook.setColourRGB(Colour.LIME, 0xff, 0, 0);
               workbook.write();
               FileInputStream excelCSVFile = new FileInputStream(f);
               IWDCachedWebResource cachedWebResource = null;
               if (excelCSVFile!= null)
                    cachedWebResource = WDWebResource.getWebResource(excelCSVFile, WDWebResourceType.getWebResourceType("xls","application/ms-excel"));
               cachedWebResource.setResourceName(fileName);
          cachedExcelResource = cachedWebResource;
          wdContext.currentContextElement().setVa_DownloadToExcel(cachedExcelResource.getURL());
          workbook.close();
     catch (Exception ex)
          wdComponentAPI.getMessageManager().reportException("Error in Excel Download"+ex.getMessage(),false);
Regards,
Vijay

Similar Messages

  • Error While uplaoding a EXCEL file in Web dynpro - HR_KR_XSTRING_TO_STRING

    Hi,
        I am getting an error while uploading an excel file in web Dynpro application. i am using the HR_KR_XSTRING_TO_STRING this function. I am getting the following error message 'Unable to interpret    as a number'.

    First of all, are you sure you know what you are working with here.  If this is standard Excel file in the Microsoft binary/propriatery format there is not function module or class in ABAP that can magically just transform this to a character string.  You should search the forums as this has been discussed extensively.  On that topic, please also do not post duplicate threads.  I have already locked your other thread with the same basic question.
    Instead of the binary/propriatery format of Excel, the file should be saved on the client as a text based format - like XML or Text Tab Delimited. You can then use several different options on the server to convert the XSTRING to STRING and process the content (becuase it was text based to begin with).  You could use CL_BCS_CONVERT, the function modules in the function group SCMS_CONV, or the class CL_ABAP_CONV_IN_CE.

  • Upload and Reading Excel File in Web Dynpro

    Hi all,
    I have a requirement in my application( in 04s), where in, i need to upload an excel from a client through a web dynpro application(using fileupload UI) and read each and every the content of that excel file in web dynpro and process the data accordingly.
    The format of the excel is fixed and pre-defined.
    I went through a lot of blogs, but could not find a direct and exact solution to this requirement.
    Please help me.
    Looking forward to your contribution
    Thank you,
    Gita KC.

    Reading Excel Sheet from Java without using any Framework
    Enhanced File Upload - Uploading and Processing Excel Sheets
    Reading Multiple Sheets of Excel Sheet from Java
    nikhil

  • How do we scan for viruses of uploaded excel file in Web Dynpro for JAVA

    Hi All,
    Please let me know "How do we scan for viruses of uploaded excel file in Web Dynpro for JAVA"
    Regards,
    Ganga.

    Hi ,
    pl go through this note "Integrating a virus scan into SAP applications 817623 "
    SAP Virus Scan Interface
    http://help.sap.com/saphelp_nw2004s/helpdata/en/30/42c13a38b44d5e8d1b140794e8e850/frameset.htm
    Sample Application
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6e1c4221-0901-0010-63ba-b1f9459d6e74
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f2681486-0a01-0010-8497-c778eac80da5
    Regards
    Ayyappparaj

  • Uploading excel file in Web Dynpro for ABAP

    Hello Gurus,
                       I need to upload a excel file in my Web Dynpro (ABAP) program. Can anyone please tell me how do i do this. Kindly help.
    Regards,
    Aditya.

    Hi Aditya,
    Please search the forum...
    Please check this link
    Uploading Data from Excel File To Dynpro
    Excel Upload via Web dynpro ABAP
    Upload and Reading Excel File in Web Dynpro
    Best regards,
    raam

  • Download files through web Dynpro

    Hai All,
      Now i am working in web Dynpro2.0.9. "IWDResource" property is used to download and upload files in web Dynpro. "IWDResource" is not supported by web Dynpro2.0.9.what is the alternative way for to download files other than using "IWDResource" property.If you have sample codings send it.
    Thanks in Advance,
    s.v.selva Bala.

    Hallo Anilkumar,
    read my tutorial on Uploading/Downloading Files in Web Dynpro NW04:
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d2201c20-0801-0010-49b3-94fca8f590d5">Uploading and Downloading Files (39)</a>
    You are right, that the new on-demand-stream concept based on the IWDResource-API (Resource Simple Type) is not applicable in NW04.
    Regards, Bertram

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

  • Regarding Copying of Data From Excel file to Web Dynpro Java Table

    Hi
    Can any body give Suggestions that is how to copy or import Row and Column Values in the Excel file to the Java Web Dynpro Table
    Regards
    Chandran S

    Hi,
    First u should include jxl.jar API in ur classpath.
    ind a Resource variable to FileUpload UI. Then from the Fileupload UI, u can get the Sheet variable as
    InputStream fis=wdContext.currentFileUploadElement().getResource().read(true);
    Workbook wb=Workbook.getWorkbook(fis);
    Sheet sh=wb.getSheet(0);
    This can be easily read to a table by
    for(int i=14;i<34;i++)
         String bId=sh.getCell(2,i).getContents();
         String cId=sh.getCell(3,i).getContents();
         String subj=sh.getCell(4,i).getContents();
                    IPrivate<View>.I<Table>Element el=wdContext.node<Table>().create<Table>Element();
                    wdContext.node<Table>().addElement(el);
                    el.setBID(bid);
                    el.setCID(cid);
                    el.setSUB(subj);
    This example reads the excel from row 13 to 32 and column 3 to 5 and uploaded to a table
    Regards
    Fahad Hamsa

  • Error While uploading a EXCEL file in Web dynpro - HR_KR_XSTRING_TO_STRING

    Hi,
       I am getting an error while trying to upload a excel file.  I am using the function HR_KR_XSTRING_TO_STRING for conversion. The error message is  "Unable to interpret    as a number"

    First of all, are you sure you know what you are working with here.  If this is standard Excel file in the Microsoft binary/propriatery format there is not function module or class in ABAP that can magically just transform this to a character string.  You should search the forums as this has been discussed extensively.  On that topic, please also do not post duplicate threads.  I have already locked your other thread with the same basic question.
    Instead of the binary/propriatery format of Excel, the file should be saved on the client as a text based format - like XML or Text Tab Delimited. You can then use several different options on the server to convert the XSTRING to STRING and process the content (becuase it was text based to begin with).  You could use CL_BCS_CONVERT, the function modules in the function group SCMS_CONV, or the class CL_ABAP_CONV_IN_CE.

  • Creating dynamic file through web Dynpro

    Hai All,
         Please tell information about my question.
        HOW TO FETCH CLLIENT MACHINE ADDRESS IN WEB DYNPRO.
    Best Regards,
    S.V.Selva Bala.

    Hi Saravanan,
       Go through Re: IP problem in UME this thread. It might help you.
    Regards,
    Satyajit.
    Message was edited by: Satyajit Chakraborty
    Message was edited by: Satyajit Chakraborty

  • File upload and download in server through web Dynpro

    Hai all,
             i want to store one document in SQL Server 2000 through Webdyn pro. I inserted
    one document through java into SQL Server 2000 using the following method which name is
    insertFile(...).
    void insertFile(FileDBTransfer fdb, Connection cn, String FileName)throws IOException, FileNotFoundException, SQLException
              int FileLength;
              FileInputStream fis;
              PreparedStatement pstmt;
              int last=FileName.lastIndexOf("/");
              String docname=FileName.substring(last+1,FileName.length());
              fis = fdb.getFileInputStream(FileName);
              FileLength= fdb.getFileLength(FileName);
              pstmt = cn.prepareStatement("insert into ReportArchive values(?,?)");
              pstmt.setString(1,docname);
              pstmt.setBinaryStream(2, fis, FileLength); //method to insert a stream of bytes
              pstmt.executeUpdate();
         }// end insertZipFile
         Here i have given file name like "c:\test\test.pdf" it's work fine.
         My J2EE server is running different machine and my Netweaver is another machine.
    If both server and IDE in same machine it's work fine. But both are in different machine,
    i have some problems.
         If i try like this server always go and check his own path, not client machine
    so it will error like "given source not found". So if i get client machine's path
    then i will store easily into SQL Server 2000.
         Whenever i run, it should check the client machine path instead of server path. 
    Thanks in advance,
    K.Saravanan.

    Hi Saravan,
    Data
    Determines the data drain, that is, the location of the data, of the file to be uploaded in the context. The system can only read this data value.
    fileName
    Gives exact filename
    Refer IWDFileUpload also
    http://help.sap.com/saphelp_nw04/helpdata/en/5a/90ff4cd0c8cd48a69b836e5e550880/content.htm
                          Regards
                            Kisgor Gopinathan
    Message was edited by: Kishor Gopinathan
    Message was edited by: Kishor Gopinathan

  • 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

  • Excel Upload via Web dynpro ABAP

    Hi All,
    Could any one please explain how to upload MS Excel file in Web Dynpro ABAP?
    Regards,
    Surya

    Hi Surya,
    Ya Excel upload is not supported some times.
    You can save your excel sheet as "Tab Limited" file. Then you can easily upload the file contents to your WebDynpro.
    Thanks.

  • Import data from excel/csv file in web dynpro

    Hi All,
    I need to populate a WD table by first importing a excel/CSV file thru web dynpro screen and then reading thru the file.Am using FileUpload element from NW04s.
    How can I read/import data from excel / csv file in web dynpro table context?
    Any help is appreciated.
    Thanks a lot
    Aakash

    Hi,
    Here are the basic steps needed to read data from excel spreadsheet using the Java Excel API(jExcel API).
    jExcel API can read a spreadsheet from a file stored on the local file system or from some input stream, ideally the following should be the steps while reading:
    Create a workbook from a file on the local file system, as illustrated in the following code fragment:
              import java.io.File;
              import java.util.Date;
              import jxl.*;
             Workbook workbook = Workbook.getWorkbook(new File("test.xls"));
    On getting access to the worksheet, once can use the following code piece to access  individual sheets. These are zero indexed - the first sheet being 0, the  second sheet being 1, and so on. (You can also use the API to retrieve a sheet by name).
              Sheet sheet = workbook.getSheet(0);
    After getting the sheet, you can retrieve the cell's contents as a string by using the convenience method getContents(). In the example code below, A1 is a text cell, B2 is numerical value and C2 is a date. The contents of these cells may be accessed as follows
    Cell a1 = sheet.getCell(0,0);
    Cell b2 = sheet.getCell(1,1);
    Cell c2 = sheet.getCell(2,1);
    String a1 = a1.getContents();
    String b2 = b2.getContents();
    String c2 = c2.getContents();
    // perform operations on strings
    However in case we need to access the cell's contents as the exact data type ie. as a numerical value or as a date, then the retrieved Cell must be cast to the correct type and the appropriate methods called. The code piece given below illustrates how JExcelApi may be used to retrieve a genuine java double and java.util.Date object from an Excel spreadsheet. For completeness the label is also cast to it's correct type. The code snippet also illustrates how to verify that cell is of the expected type - this can be useful when performing validations on the spreadsheet for presence of correct datatypes in the spreadsheet.
      String a1 = null;
      Double b2 = 0;
      Date c2 = null;
                        Cell a1 = sheet.getCell(0,0);
                        Cell b2 = sheet.getCell(1,1);
                        Cell c2 = sheet.getCell(2,1);
                        if (a1.getType() == CellType.LABEL)
                           LabelCell lc = (LabelCell) a1;
                           stringa1 = lc.getString();
                         if (b2.getType() == CellType.NUMBER)
                           NumberCell nc = (NumberCell) b2;
                           numberb2 = nc.getValue();
                          if (c2.getType() == CellType.DATE)
                            DateCell dc = (DateCell) c2;
                            datec2 = dc.getDate();
                           // operate on dates and doubles
    It is recommended to, use the close()  method (as in the code piece below)   when you are done with processing all the cells.This frees up any allocated memory used when reading spreadsheets and is particularly important when reading large spreadsheets.              
              // Finished - close the workbook and free up memory
              workbook.close();
    The API class files are availble in the 'jxl.jar', which is available for download.
    Regards
    Raghu

  • Upload and Attach file to Service Notificacion through Web Dynpro

    Hi,
    I need to upload and attach a file (Word, PDF, TXT ...) to Service Notificacion (TX - IW53) through Web Dynpro.
    I have used the integration component "File Upload" to obtain the "fileName" atribute. Also, I have used the functions SO_OBJECT_UPLOAD, SO_INSERT_OBJECT and BINARY_RELATION_CREATE_COMMIT.
    But have a problem, because the function SO_OBJECT_UPLOAD use the class "cl _ gui _ frontend _ services" and that clash with Web Dynpro.
    My question is: how could I resolve that problem?
    I look forward to your response.
    Thanks

    IV_NAME     Importing     Type     STRING
    IV_CONTENT     Importing     Type     STRING
    IV_CONTENT_HEX     Importing     Type     XSTRING
    IS_LPORB     Importing     Type     SIBFLPORB
    IV_OBJTP     Importing     Type     SO_OBJ_TP
    RT_MESSAGES     Returning     Type     BAPIRETTAB
    method save.
      data ls_message type bapiret2.
      data:
        filename     type string,
        filefullname type string,
        mime_type    type string,
        size         type i,
        offset type i,
        offset_old type i,
        temp_len type i,
        objname type string,
        l_obj_type type so_obj_tp,
        hex_null type x length 1 value '20',
        l_document_title type so_text255,
        file_ext type string,
        lt_objcont type standard table of  solisti1 initial size 6,
        objcont like line of lt_objcont,
        lt_ls_doc_change type standard table of sodocchgi1,
        ls_doc_change like line of lt_ls_doc_change,
        lt_data type soli_tab,
        ls_data type soli,
        lt_xdata type solix_tab,
        ls_xdata type solix,
        l_folder_id type sofdk,
        ls_object_id type soodk,
        l_object_id_fol type so_obj_id,
        l_object_id type so_obj_id,
       l_doc_info TYPE sofolenti1,
        l_object_hd_change type sood1,
        l_tab_size type int4,
        l_retype type breltyp-reltype,
        lt_urltab  type standard table of sood-objdes.
    get foler
    l_folder_id = 'FOL29000000000004'.
      call function 'SO_FOLDER_ROOT_ID_GET'
        exporting
         owner                            = sy-uname
          region                           = 'B'
        importing
          folder_id                        = l_folder_id
       tables
         path_table                       =
      if iv_objtp = gc_type_file.
        size = xstrlen( iv_content_hex ).
    get file name and extension
        call method split_path
          exporting
            iv_path           = iv_name
          importing
         E_PATH           =
           ev_filename       = filename
         E_PSERVER        =
        call method split_file_extension
          exporting
            iv_filename_with_ext = filename
          importing
            ev_filename          = objname
            ev_extension         = file_ext.
        ls_doc_change-obj_name = objname.
        ls_doc_change-obj_descr = objname.
        ls_doc_change-obj_langu = sy-langu.
        ls_doc_change-sensitivty = 'F'.
        ls_doc_change-doc_size = size.
        offset = 0.
        while offset <= size.
          offset_old = offset.
          offset = offset + 255.
          if offset > size.
            temp_len = xstrlen( iv_content_hex+offset_old ).
            clear ls_xdata-line with hex_null in byte mode.
            ls_xdata-line = iv_content_hex+offset_old(temp_len).
          else.
            ls_xdata-line = iv_content_hex+offset_old(255).
          endif.
          append ls_xdata to lt_xdata.
        endwhile.
    set object type relation type and other header info
        l_retype = 'ATTA'.
        l_obj_type = 'EXT'.
        l_object_hd_change-objnam = ls_doc_change-obj_name.
        l_object_hd_change-objdes = ls_doc_change-obj_descr.
        l_object_hd_change-objsns = ls_doc_change-sensitivty.
        l_object_hd_change-objla  = ls_doc_change-obj_langu.
        l_object_hd_change-objlen = ls_doc_change-doc_size.
        l_object_hd_change-file_ext = file_ext.
      prepare header
        data lt_obj_header type standard table of solisti1.
        data ls_header type solisti1.
        concatenate '&SO_FILENAME=' filename into ls_header.
        append ls_header to lt_obj_header.
        clear ls_header.
        ls_header = '&SO_FORMAT=BIN'.
        append ls_header to lt_obj_header.
    change hex data to text data
        call function 'SO_SOLIXTAB_TO_SOLITAB'
          exporting
            ip_solixtab = lt_xdata
          importing
            ep_solitab  = lt_data.
      else.
    for note
        size = strlen( iv_content ).
        objname = iv_name.
        ls_doc_change-obj_descr = objname.
        ls_doc_change-sensitivty = 'O'.
        ls_doc_change-obj_langu  = sy-langu.
    put content into table
        offset = 0.
        if iv_objtp = gc_type_note.
    it's a note
          l_retype = 'NOTE'.
          l_obj_type = 'RAW'.
          l_object_hd_change-file_ext = 'TXT'.
    read note content into table
          while offset <= size.
            offset_old = offset.
            offset = offset + 255.
            if offset > size.
              temp_len = strlen( iv_content+offset_old ).
              clear ls_data-line.
              ls_data-line = iv_content+offset_old(temp_len).
            else.
              ls_data-line = iv_content+offset_old(255).
            endif.
            append ls_data to lt_data.
          endwhile.
    get title from content , if it's initial
          if objname is initial.
            read table lt_data index 1 into l_document_title.
            while l_document_title+49 <> ' '.
              shift l_document_title right.
            endwhile.
            shift l_document_title left deleting leading ' '.
            ls_doc_change-obj_descr = l_document_title.
          endif.
        else.
    it's url (not note)
          l_retype = 'URL'.
          l_obj_type = 'URL'.
          if objname is initial.
            split iv_content at '/' into table lt_urltab.
            describe table lt_urltab lines l_tab_size.
            read table lt_urltab index l_tab_size into ls_doc_change-obj_descr.
          endif.
          while offset <= size.
            offset_old = offset.
            offset = offset + 250.
            if offset > size.
              temp_len = strlen( iv_content+offset_old ).
              clear ls_data-line.
              ls_data-line = iv_content+offset_old(temp_len).
            else.
              ls_data-line = iv_content+offset_old(250).
            endif.
            concatenate '&KEY&' ls_data-line into ls_data-line.
            append ls_data to lt_data.
          endwhile.
        endif.
        ls_doc_change-doc_size = size.
       l_object_hd_change-objnam = ls_doc_change-obj_name.
        l_object_hd_change-objdes = ls_doc_change-obj_descr.
        l_object_hd_change-objsns = ls_doc_change-sensitivty.
        l_object_hd_change-objla  = ls_doc_change-obj_langu.
        l_object_hd_change-objlen = ls_doc_change-doc_size.
      endif.
    save object
      call function 'SO_OBJECT_INSERT'
           exporting
                folder_id                  = l_folder_id
               OBJECT_FL_CHANGE           = OBJECT_FL_CHANGE
                object_hd_change           = l_object_hd_change
                object_type                = l_obj_type
               ORIGINATOR_ID              = OWNER_ID
              OWNER                      = USER-USRNAM
           importing
               OBJECT_FL_DISPLAY          = OBJECT_FL_DISPLAY
               OBJECT_HD_DISPLAY          = OBJECT_HD_DISPLAY
                object_id                  = ls_object_id   "l_doc_info-object_id
           tables
                objcont                    = lt_data
                objhead                    = lt_obj_header
               OBJPARA                    = OBJECT_PARA
               OBJPARB                    = OBJECT_PARB
           exceptions
                component_not_available    = 01
                folder_not_exist           = 06
                folder_no_authorization    = 05
                object_type_not_exist      = 17
                operation_no_authorization = 21
                parameter_error            = 23
                others                     = 1000.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 into ls_message-message.
        ls_message-type = sy-msgty.
        ls_message-id = sy-msgid.
        ls_message-number = sy-msgno.
        ls_message-message_v1 = sy-msgv1.
        ls_message-message_v2 = sy-msgv2.
        ls_message-message_v3 = sy-msgv3.
        ls_message-message_v4 = sy-msgv4.
        append ls_message to rt_messages.
        return.
      endif.
    create relation
      data l_obj_rolea type borident.
      data l_obj_roleb type borident.
    MOVE-CORRESPONDING wd_this->ms_lporb to l_obj_rolea.
      l_obj_rolea-objkey = is_lporb-instid.
      l_obj_rolea-objtype = is_lporb-typeid.
      l_obj_rolea-logsys = is_lporb-catid.
      l_object_id_fol  = l_folder_id.
      l_object_id = ls_object_id.
      concatenate l_object_id_fol l_object_id into l_obj_roleb-objkey respecting blanks.
      l_obj_roleb-objtype = 'MESSAGE'.
      clear l_obj_roleb-logsys.
      call function 'BINARY_RELATION_CREATE'
        exporting
          obj_rolea    = l_obj_rolea
          obj_roleb    = l_obj_roleb
          relationtype = l_retype
        exceptions
          others       = 1.
      if sy-subrc = 0.
        commit work and wait.
       wd_this->MV_UPDATE_FLAG = 'X'.
      else.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 into ls_message-message.
        ls_message-type = sy-msgty.
        ls_message-id = sy-msgid.
        ls_message-number = sy-msgno.
        ls_message-message_v1 = sy-msgv1.
        ls_message-message_v2 = sy-msgv2.
        ls_message-message_v3 = sy-msgv3.
        ls_message-message_v4 = sy-msgv4.
        append ls_message to rt_messages.
        return.
      endif.
    endmethod.
    Edited by: Reyleene Hunt on May 26, 2009 10:05 AM

Maybe you are looking for

  • What do i have to do to avoid "loading flash" when embedding video in pdf?

    I can embed h.264 video in pdf via acrobat pro or inDesign. However, there's always a moment of waiting, Acrobat Background color flashes up, before the movie is finally loaded and played back. I have seen Tutorials where this doesn't occur, but no d

  • Still getting "Software Update Failed" when attempting to download iOS 7 on iPhone 4S.

    I've tried countless times now to download iOS 7 on my 4S which is currently running iOS 6.1.3. It downloads completely then in the "Preparing Update..." stage it gives me an error box saying "Software Update Failed. An error occurred downloading iOS

  • How to enforce always sorting on a column in a TableView?

    Hello, I have a requirement to always sort on a column in a TableView. So basically, I need a TableColumn's SortType go from Ascending to Descending and back to Ascedning when user clicks on a column header repeatedly. I guess that means making sure

  • Payment amount for invoice .......

    Hi gurus, I have problem when caculate paid amount for the invoice, which be paid partial. I don't know fields save that amount.I see fileld NEBTR, but sometime it's valid, sometime no.  Please help me !!! Tks a lot !!!

  • Routing change idoc in SAP  LOIROU01/02

    Hi All, Has anyone used routing idoc LOIROU01/02 for change routing and allocate operations for BOM in SAP using we19 test tool. If so, please give me the minimum fields need to pass in we19 for LOIROU01/02 idoc to allocate an operation to a BOM comp