BDC problem in Open Excel

Hi,
We are facing the problem to run the BDC.
Actually problem is that we are using the UBUNTU instead of Window XP / Server and Open Office instead of Microsoft Office..
File extension of Open Excel is .ODS & Microsoft Excel extension is .XLS. Also our BDC is supporting the .XLS extension files.
Is there any way to use the .ODS extension file in my BDC. Is it possible that if i change the code somewhere and use .ODS file, my BDC should run..
How to upload my .ODS file in BDC?? or any other way to make my BDC successful??
Thanks...
Edited by: @ABAP@ on Oct 10, 2009 5:57 PM

Hi,
There are few things that I need you to check:
1.Make sure your file is not open while executing the eport
2.Declare internal table with all fields as Char type haning the length same as defined in the backend.
3.You can either upload the XLs file using the direct FM TEXT_convert_xls_to_sap
or save the xls file as the tabdeliminator file and use the Fm GUI_UPLOAD.
4.FM GUI_DOWNLOAD is used to download any fiel data to the presentaion server.
Hope now your problem will be solved.
Pooja

Similar Messages

  • Problem in opening excel file in different window

    hi
    i want to open excel file in different window it open in same window properly on the bases of condition but when i try to open in different with window.open( )
    it give error that file has already used or path not exist OR requisted site either unavailable
    how can i rectified

    Hi.
    I am too facing the same problem. I am using Jakarta Poi to display my resultset in an excel sheet directly(and not into a jsp)
    The browser opens a window showing Open Save Cancel. If i click and save the excel sheet and then open, it opens. But clicking on Open directly doesnt open the excel sheet. Rather it gives the same error
    The file name or path name does not exist.
    The file you are trying to open is being used by another progrtam . close the document in other program and try again
    The name of the work book your tring to save is the same as name of another document that is readonly .try saving workbook with different name
    Can somebody please help me fix this problem, since its an urgent requirement. Mail me at [email protected]
    Thanks
    Hitesh

  • Problem when opening excel sheet in jsp

    Hi friends
    When i try to open excel sheet from my program I am getting two problems
    1. first row of excel sheet is empty
    2. while opening I am getting error message of "the file is not in a recognizable format"
    Please help me..It is an urgent work
    my code
    <%@page language="java" import="java.io.*,java.text.*,java.sql.*,java.util.*"%>
    <%
    Class.forName("org.gjt.mm.mysql.Driver");
    Connection conn = DriverManager.getConnection("jdbc:mysql://256.136.119.86/mydb","zzz","zzz");
    Statement st = conn.createStatement();
    StringBuffer sb = new StringBuffer();
    sb.append("SAP#" + "\t");
    sb.append("x-plant status" + "\t");
    sb.append("Total Amount" +"\t");
    sb.append(">90 days" + "\t");
    sb.append("\n");
    try
    String query="select * from temp_Xplant";
    ResultSet rs = st.executeQuery(query);
    while(rs.next()){
    sb.append(rs.getString("sapNo") + "\t");
    sb.append(rs.getString("status")+ "\t");
    sb.append(rs.getString("amt") + "\t");
    sb.append(rs.getString("days") + "\t");
    sb.append("\n");
    conn.close();
    st.close();
    catch (Exception e)
    out.println("error");
    conn.close();
    st.close();
    response.setContentType("application/vnd.ms-excel");
    // response.setHeader("Content-Disposition", "attachment; filename=\"test.xls\"");
    String testt = "tests.xls";
    response.setHeader("Content-Disposition", "attachment; filename="+testt);
    out.println(sb.toString());
    out.close();
    %>
    thanks in advance

    The problem here is, you have setted the content type as excel sheet and you are writing some String content into the output stream. when excel tries to read the String content it will surely throw some error. Lot of excel APIs are available in the market to generate excel sheets.
    you can find one in the below URL.
    http://www.teamdev.com/downloads/jexcel/docs/JExcel-PGuide.html

  • Problem while opening Excel through OLE

    Hi Friends
    I am facing a problem while opening an excel file through OLE. it is working fine in SAP ECC 5.0, but the problem is in ECC 6.0.
    I am adjusting the cells for auto fit. I have written the code like below.
    CALL METHOD OF e_appl 'CELLS' = e_cell.
      CALL METHOD OF e_cell 'EntireColumn' = ole_columns .
      CALL METHOD OF ole_columns 'AutoFit'.
      set property of e_appl 'VISIBLE' = 1.
    if I take out the adjustment part it is working fine for this program, rest other programs even if I have this code, they working fine.
    When I am executing the statement set property of e_appl 'VISIBLE' = 1. the return code is coming as 2.
    Could anybody please help me to overcome this problem.
    Thanks
    Praveen

    In ECC 6.0, if the worksheet is portedcted SAP unable to open that sheet, now we have taken out this option so it is working.

  • Installing Control Panel 2/3 causes problems in opening Excel sheets

    After installing the control panel 3.0, I can't open Excel sheets properly anymore. A message says that the Excel sheet contains corrupted data and Excel can try to restore them. After confirming this, the excel sheet shows opened but all formating is gone.
    I had this issue yet with Control Panel 2.0. After some research on the web I found out that the problem is caused by the CP for Windows. I then switched back to CP V 1.1.4 and the excel sheets opened properly again.
    Thanks for any advise. I'm using Windows 7 and Excel/Outlook 2007.

    You are downloading software illegally. ShapeShifter is shareware so unless you indicate that you paid for it I don't feel it is appropriate to post your issue in this forum setting.

  • Problem in Opening Excel file

    Hi......
    I've written a logic for sending mail through FM SO_DOCUMENT_SEND_API1 every thing works fine a get a attachment of the  excel file with all the data but when i open the file i get a pop message saying Worksheet setting problem.....and the file does'nt gets open........i'm just wondering what might be the problem.......it was working on well yesterday and now i get this....strange......what might be going wrong........Let me know and correct answers would be surely awarded.........
    I use to get a same message for other program's excel file and it still opens the file......but this current excel file seems to be not opening.......

    Hi,
    Better use 'SO_OBJECT_SEND'  FM .
    Sample code:
    Declaration
      DATA:    lwa_hd_change TYPE sood1,
               lt_objcont    TYPE STANDARD TABLE OF soli,
               lwa_objcont   TYPE soli,
               lt_receivers  TYPE STANDARD TABLE OF soos1,
               lwa_receivers TYPE soos1 ,
               lt_att_cont   TYPE STANDARD TABLE OF soli,
               lwa_att_cont  TYPE soli,
               lt_packing    TYPE STANDARD TABLE OF soxpl,
               lwa_packing   TYPE soxpl,
               lf_sent       TYPE sonv-flag,
               lf_size       TYPE i.
      CONSTANTS: lc_obj(11)  TYPE c VALUE 'BOMSouthco',
                 lc_desc(20) TYPE c VALUE 'BOM Download',
                 lc_lang(1)  TYPE c VALUE 'E',
                 lc_raw(3)   TYPE c VALUE 'RAW',
                 lc_net(1)   TYPE c VALUE 'U',
                 lc_mail(4)  TYPE c VALUE 'MAIL',
                 lc_xls(3)   TYPE c VALUE 'XLS',
                 lc_ext(3)   TYPE c VALUE 'EXT'.
    Passing values to the strutures used in SO_OBJECT_SEND function module
      lwa_hd_change-objla      = lc_lang.
      lwa_hd_change-objnam     = lc_obj.
      lwa_hd_change-objdes     = lc_desc.
      lwa_hd_change-objlen     = 255.
      lwa_objcont-line = text-t29.
      APPEND lwa_objcont TO lt_objcont.
      CLEAR lwa_objcont.
      lwa_receivers-recextnam  = text-t31.
      lwa_receivers-recesc     = lc_net.
      lwa_receivers-sndart     = lc_mail.
      lwa_receivers-sndex      = 'X'.
      lwa_receivers-sndpri     = 1.
      lwa_receivers-mailstatus = 'E'.
      APPEND lwa_receivers TO lt_receivers.
      CLEAR lwa_receivers.
      lwa_receivers-recextnam  = text-t30.
      lwa_receivers-recesc     = lc_net.
      lwa_receivers-sndart     = lc_mail.
      lwa_receivers-sndex      = 'X'.
      lwa_receivers-sndpri     = 1.
      lwa_receivers-mailstatus = 'E'.
      APPEND lwa_receivers TO lt_receivers.
      CLEAR lwa_receivers.
    Passing values for the attachment file
      LOOP AT gt_output INTO gwa_output.
        CONCATENATE gf_lf  gwa_output-matnr  gf_etb  gwa_output-idnrk  gf_etb
                    gwa_output-type   gf_etb  gwa_output-menge   gf_etb
                    gwa_output-meins  gf_etb  gwa_output-comp    gf_etb
          INTO lwa_att_cont-line.
        APPEND lwa_att_cont TO lt_att_cont.
        CLEAR lwa_att_cont.
      ENDLOOP.
      CHECK lt_att_cont IS NOT INITIAL.
      DESCRIBE TABLE lt_att_cont LINES lf_size.
      lwa_packing-transf_bin = ' '.
      lwa_packing-head_start = 1.
      lwa_packing-head_num   = 0.
      lwa_packing-body_start = 1.
      lwa_packing-body_num   = lf_size.
      lwa_packing-file_ext   = lc_xls.
      lwa_packing-objlen     = lf_size * 255.
      lwa_packing-objtp      = lc_ext.
      lwa_packing-objdes     = lc_desc.
      lwa_packing-objnam     = lc_obj.
      APPEND lwa_packing TO lt_packing.
      CLEAR lwa_packing.
      CHECK gf_error IS NOT INITIAL. "Check if unix file is written
    FM to send email to the intended recipients
      CALL FUNCTION 'SO_OBJECT_SEND'
        EXPORTING
          object_hd_change           = lwa_hd_change
          object_type                = lc_raw
        IMPORTING
          sent_to_all                = lf_sent
        TABLES
          objcont                    = lt_objcont
          receivers                  = lt_receivers
          packing_list               = lt_packing
          att_cont                   = lt_att_cont
        EXCEPTIONS
          active_user_not_exist      = 1
          communication_failure      = 2
          component_not_available    = 3
          folder_not_exist           = 4
          folder_no_authorization    = 5
          forwarder_not_exist        = 6
          note_not_exist             = 7
          object_not_exist           = 8
          object_not_sent            = 9
          object_no_authorization    = 10
          object_type_not_exist      = 11
          operation_no_authorization = 12
          owner_not_exist            = 13
          parameter_error            = 14
          substitute_not_active      = 15
          substitute_not_defined     = 16
          system_failure             = 17
          too_much_receivers         = 18
          user_not_exist             = 19
          originator_not_exist       = 20
          x_error                    = 21
          OTHERS                     = 22.
      IF sy-subrc = 0.
        MESSAGE s004 WITH text-t34.
      ENDIF.
      COMMIT WORK.
    Reward if helpful.
    Regards,
    Ramya

  • Problem while opening excel files in office 365

    Hi, Facing issue in office 365. Suppose one excel file is already opened and if we tried to open another one it just is looks like opening file and if check after sometime it shows excel blank window to open new file.
    Please help

    Hi,
    Thanks for your post.
    Based on my experience, if you've ticked the option of "Ignore other applications that use Dynamic Data Exchange (DDE)“
    under FILE>Options>Advanced, you will probably have this kind of issue.
    Please try to turn off that option and see if it works.
    Regards,
    Ethan Hua
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Problem in Microsoft Excel 2007 when opening XLS from content library

    Hi gurus,
    I'm facing the following problem. When we try to open an Excel template that we have in our content library a message appears. The message is: The file you are trying to open " showfile.aspx" is in a different format than specified by the file extension...
    it doesn't happen if you open with Microsof Excel 2003. Any idea to solve the problem?
    Thanks in advice
    Gorka Ibor Ureñ

    Hi,
    Please follow below steps to remove Excel Add-in from Excel 2007: -
    1- Open Excel 2007 and click on icon placed at top left corner and select option 'Excel Options'.
    3- Now select option 'Add-In' from left window menu and then click on button 'Go' appears on the bottom of right window. It will open a new window.
    4- Please de-select option 'Hyperion Essbase OLAP server DLL' in new window.
    It will disable Excel Add-in.
    Hope it will help you.
    Atul K,

  • Problem opening excel application, it opens all the workbooks at the at once!

    Why everytime I open or start excel application, it opens and open many excel books at the same time! Is this an excel configuration problem? How can I just open excel and start a new excel book, without opening the rest of saved excelbooks?

    Thanks LousyFool. With the help of an Apple store expert finally resolved the problem by eliminating the excel hidden folder. It happens that the excel folder resides in the library folder, and after he deleted it and open excel app it then creates a brand new empty folder. By eliminating the old excel folder the excel files that were opened automatically it fixed the problem!
    Thank for your help

  • Problem in opening of word and excell files downloaded from email attachment in MS office professional 2013 paper licence

    Hi,
    I am facing the problem in opening the word and excel files received through email in my MS office professional 2013 paper licence, Microsoft Windows 8.1 enviornment. please help in this matter
    regards
    Rajeev Bhagwat
    Administrative Officer-I
    Purchase and Store Section
    UGC-DAE Consortium for Scientific Research,
    University Campus, Khandwa Road, Indore (M.P.), India.
    Telefax-+917312361546

    I should further say the files I sent are .xlsx and .docx files.  They look fine my end and I send such files all the time without problems.
    However, I did try to cheat by going in via the Safari onto my 'live' online email account and the Safari automatically transfers them to winmail.dat files with the same result.
    Ahh - have just been on using my PC this time and you are right, it seems that the service provider does the transfer and then when my outlook opens the file (on the PC), it must reconvert to .xlsx etc again.
    Very strange.
    Ergo, I guess the question should be how I open wimail.dat files ??

  • Problem opening excel files exported from Discoverer Plus 10.1.2.48.18

    I can't open excel files (xls) exported from Discoverer Plus 10.1.2.48.18 when I enable macros. The application (Excel) hangs up.
    Someone have any idea about this?
    Thanks,
    Diego

    Hi Meifang
    I did some more research and found a document on MetaLink 250820.1 that talks about Discoverer not being able to call Excel if Discoverer is running via an IP address instead of a qualified domain name.
    The article talks about making Discoverer a trusted site in the Internet Options of IE. Here's the relevant info from the posting:
    Workaround for MS IE (if necessary):
    1. Open a new MS IE browser
    2. Navigate to: Tools | Internet Options Security where you will see the Trusted Sites icon (green icon with a check mark)
    3. Click the Sites button
    4. Add the following: http://IP:port/
    (where IP, port are the location of where Discoverer server is running)
    5. Click the OK button
    6. Click the OK button again
    On my own PC, I was having a similar problem and I was unable to get Excel to launch. In the end I did this:
    1. Open a new MS IE browser
    2. Navigate to: Tools | Internet Options | Security where you will see the Local Intranet icon (computer icon against a globe)
    3. Click the Local Intranet button
    4. Click the Sites button
    5. Click the Advanced button
    6. Add the following: http://IP/ or http://website
    (where IP or website are the location of where Discoverer server is running)
    7. Click the Add button
    8. Click the OK button
    9. Click the OK button again
    10. Click the OK button a third time
    With this done, I made sure that my Explorer settings were correct by doing the following to ensure that a couple of settings for the .xls & .html file types are unchecked:
    1. Open Windows Explorer
    2. Navigate to: Tools | Folder Options | File Types tab
    3. Highlight the Extension XLS (or HTML)
    4. Click the Advanced button
    5. At the botton of the screen are three settings that use checkboxes. If either of the following two are checked, un-check them:
    Confirm Open after Download and Browse in same window
    6. Click the OK button
    7. Click the Apply button
    8. Re-boot the PC
    After I did this I was successfully able to get Excel to open from within Discoverer.
    Best wishes
    Michael

  • Problem opening excel

    Hi,
    When I try to open excel after export of report from BW I get a request to enter userID and password to access the server.
    How can I remove this message.
    thanks

    Hi,
    thanks for your response.
    In query properties in BEX query designer these are the tabs showing
    - generic
    - display and
    - extended
    where can I see the tab you are talking about

  • Problem in Open dataset in background

    Hi All,
    Iam facing the problem in Open dataset in background. It is working fine in foreground.
    Iam able to read only one line from the application server file in background.
    Please find below the code.
      IF sy-batch = wl_x.
        OPEN DATASET pa_sfile FOR INPUT IN TEXT MODE encoding default. "    
       IF sy-subrc = 0.
          DO.
            READ DATASET pa_sfile INTO wf_string.
            IF sy-subrc <> 0.
              EXIT.
            ELSE.
              SPLIT wf_string AT cl_abap_char_utilities=>horizontal_tab INTO wa_upload-
                       field1 wa_upload-field2 wa_upload-field3
              wa_upload-field4 wa_upload-field5 wa_upload-field6 wa_upload-field7
             wa_upload-field8   wa_upload-field9 wa_upload-field10 wa_upload-field11 wa_upload-field12 wa_upload-field13 wa_upload-field14 wa_upload-field15 wa_upload-field16 wa_upload-field17 wa_upload-field18  wa_upload-field19 wa_upload-field20 wa_upload-field21 wa_upload-field22 wa_upload-field23
              wa_upload-field24 wa_upload-field25 wa_upload-field26 wa_upload-field27 wa_upload-field28  wa_upload-field29 wa_upload-field30 wa_upload-field31 wa_upload-field32 wa_upload-field33  wa_upload-field34 wa_upload-field35 wa_upload-field36 .
              APPEND wa_upload TO int_upload.
              CLEAR wa_upload.
            ENDIF.
          ENDDO.
          CLOSE DATASET pa_sfile.
    Thanks in advance.
    Quick suggestions are highly appreciated.
    Best Regards,
    Brahma Reddy

    Thanks for the reply.
    Here is the whole code.
    Here iam submitting one job to the backgrond. But if iam executing it in debugging mode by changing the values of sy-batch( without submitting to background ) at run time, my program is working fine.
    REPORT zvtraffic_carrier_upload
           NO STANDARD PAGE HEADING LINE-SIZE 255
                  MESSAGE-ID zmmx.
    *Data Declarations                                                     *
    TABLES: vtrkh,
            vekp,
            zvship_non_pkgs.
    declaration of data
    DATA:
       wf_filename         LIKE ibipparms-path,  "file with path
       wf_file             LIKE ibipparms-path,        "file
       wf_extsn(3)         TYPE c ,              "file extension
       wf_recnt            TYPE i,
       wf_recok            TYPE i,
    *+001 Begin
       wf_string           TYPE string,
       wf_mess             TYPE string,
       wf_field1       TYPE string,
       wf_field2(30)       TYPE c,
       wf_sum_source_file  TYPE rlgrap-filename ,
       wf_sum_dest_file    TYPE rlgrap-filename ,
      wf_path         LIKE   rlgrap-filename,
       wf_path TYPE salfile-longname
                        VALUE '/usr/sap/nfs/erp/UTL/',
    *+001 End
       wf_complete_file    LIKE pcfile-path.     "total file path
    declaration of counters
    DATA:
       wc_rec(6)          TYPE c,                "total record counter
       wc_success_rec(6)  TYPE c,                "no of rec.having no errors
       wc_error_rec(6)    TYPE c,                "no of rec. having errors
       wc_rec_tot(6)      TYPE c.                "total records
    Constants declarations
    CONSTANTS:
       wl_x(1)         TYPE c VALUE 'X',          "X
       wl_1            TYPE i           VALUE '1',         "Integer value
       wl_e(1)         TYPE c           VALUE 'E',         "Char    value
       wl_mode         TYPE c           VALUE 'N',
       wl_update       TYPE c           VALUE 'S',
       wl_trackno(13)  TYPE c           VALUE 'Tracking No. ',
       wl_tcode(14)    TYPE c           VALUE 'ZVTRAFFICINPUT',
    *+001 Begin:
       wl_id(11)       TYPE c           VALUE 'CARRIERFILE',
       wl_adm(100)     TYPE c           VALUE '[email protected]',
       wl_u(1)         TYPE c VALUE 'U',       " Email through Internet
       wl_int(3)       TYPE c VALUE 'INT',     " Communication method
       wl_urgent(6)    TYPE c VALUE 'Urgent',
       wl_raw(3)       TYPE c VALUE 'RAW',
       wl_descr(48)    TYPE c VALUE 'SAP Alert: Carrier upload',
       wl_file(128)    TYPE c VALUE '/usr/sap/nfs/erp/UTL/carrier.xls',
       wl_jobname LIKE tbtcjob-jobname VALUE 'ZVTRAFFIC_UP',
       wl_variant LIKE raldb-variant VALUE 'VMM01_ZVTRFFIC',
       wl_action  TYPE  zaction VALUE 'MOV', "For moving file to other dir
       wl_i       TYPE  c VALUE 'I',
       wl_cmd(50) TYPE c VALUE '/usr/sap/nfs/erp/UTL/',
       wl_57           TYPE i      VALUE 57,
       wl_m1(2)         TYPE c VALUE 'M1',                      "value M1
       wl_m2(2)         TYPE c VALUE 'M2',                      "value M1
    *+001 End:
       wl_xls(3)       TYPE c           VALUE 'xls',       "Char value
       wl_value(1)     TYPE c           VALUE ','.         "Char value
    *Internal Tables Declarations                                          *
    internal table for holding data from excel file
    *+001 begin
    TYPES : BEGIN OF ty_dir,
             dir(132)  TYPE  c,
            END   OF ty_dir.
    *internal table to get the files in the direactory
    DATA : int_dir      TYPE ty_dir OCCURS 0 WITH HEADER LINE .
    *work area for int_dir
    DATA : wa_int_dir      LIKE LINE OF int_dir.
    DATA: ifiles TYPE TABLE OF  salfldir WITH HEADER LINE.
    *+001 end
    TYPES: BEGIN OF int_upload,
             field1(30)   TYPE c,       "
             field2(30)   TYPE c,       "
             field3(30)   TYPE c,       "
             field4(30)   TYPE c,       "
             field5(30)   TYPE c,       "
             field6(30)   TYPE c,       "
             field7(30)   TYPE c,       "
             field8(30)   TYPE c,       "
             field9(30)   TYPE c,       "
             field10(30)  TYPE c,       "
             field11(30)  TYPE c,       "
             field12(30)  TYPE c,       "
             field13(30)  TYPE c,       "
             field14(30)  TYPE c,       "
             field15(30)  TYPE c,       "
             field16(30)  TYPE c,       "
             field17(30)  TYPE c,       "
             field18(30)  TYPE c,       "
             field19(30)  TYPE c,       "
             field20(30)  TYPE c,       "
             field21(30)  TYPE c,       "
             field22(30)  TYPE c,       "
             field23(30)  TYPE c,       "
             field24(30)  TYPE c,       "
             field25(30)  TYPE c,       "
             field26(30)  TYPE c,       "
             field27(30)  TYPE c,       "
             field28(30)  TYPE c,       "
             field29(30)  TYPE c,       "
             field30(30)  TYPE c,       "
             field31(30)  TYPE c,       "
             field32(30)  TYPE c,       "
             field33(30)  TYPE c,       "
             field34(30)  TYPE c,       "
             field35(30)  TYPE c,       "
             field36(30)  TYPE c,       "
            END OF int_upload.
    DATA: int_upload   TYPE STANDARD TABLE OF int_upload.
    declaring bdc table
    DATA: int_bdcdata LIKE STANDARD TABLE OF bdcdata
          INITIAL SIZE 0 WITH HEADER LINE.
    DATA:   wa_bdcdata LIKE bdcdata.
    DATA:int_messages TYPE
         STANDARD TABLE OF bdcmsgcoll INITIAL SIZE 0.
    TYPES: BEGIN OF ty_error_data,
           errtext(500) TYPE c,
           END OF ty_error_data.
    DATA: wa_messages LIKE LINE OF
          int_messages.
    DATA: wa_error_data TYPE
          ty_error_data .
    DATA: int_error_data TYPE
          STANDARD TABLE OF ty_error_data INITIAL SIZE 0.
    *Work Area declarations
    Work area
    DATA:
    wa_upload    LIKE LINE OF int_upload.      "work area for int_upload
    Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : pa_foreg RADIOBUTTON GROUP g1 USER-COMMAND rad DEFAULT 'X', " user command rad,
                 pa_backg RADIOBUTTON GROUP g1 .
    SELECTION-SCREEN: SKIP.
    Input File Location Specification
    SELECTION-SCREEN BEGIN OF BLOCK b11 WITH FRAME TITLE text-002.
    PARAMETERS pa_file LIKE rlgrap-filename
               MODIF ID m1. "OBLIGATORY.     "Input File -001
    SELECTION-SCREEN END OF BLOCK b11.
    *+001 Begin
    SELECTION-SCREEN BEGIN OF BLOCK b12 WITH FRAME TITLE text-006.
    PARAMETERS pa_sfile LIKE rlgrap-filename DEFAULT '/usr/sap/nfs/erp/UTL/carrier2'
               LOWER CASE MODIF ID m2. " server filename
    *PARAMETERS pa_batch AS CHECKBOX DEFAULT ' ' MODIF ID m2.    "Background job
    *+001 End
    SELECTION-SCREEN END OF BLOCK b12.
    SELECTION-SCREEN END OF BLOCK b1.
    Event: INITIALIZATION
    INITIALIZATION.
    clear variables
    refresh internal tables
      REFRESH:int_upload.
    clear Work areas
      CLEAR:  wa_upload.
    A T  S E L E C T I O N - S C R E E N
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_file.           "-001
    subroutine to display the batch data input file location
      PERFORM f_get_filename.
    *+001 Begin:
    AT SELECTION-SCREEN OUTPUT.
      IF pa_backg = wl_x.
        LOOP AT SCREEN.
          IF screen-group1 = wl_m2.
            screen-invisible = space.
            screen-active = '1'.
            MODIFY SCREEN.
          ELSE.
            IF screen-group1 = wl_m1.
              screen-input = '0'.
              MODIFY SCREEN.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          IF screen-group1 = wl_m2.
            screen-input = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_sfile.
    subroutine to display list of files in application server
      PERFORM f_get_server_file.
    *+001 End:
    At Selection-Screen Event: validations check                        *
    AT SELECTION-SCREEN .
    validates the Selection Screen input
      PERFORM f_check_input.
    Event TOP-OF-PAGE
    TOP-OF-PAGE.
    Event: START-OF-SELECTION
    START-OF-SELECTION.
    *+001 Begin :
    get the path for all files from the directory
    PERFORM f_get_path.
    set up background job
      PERFORM f_background_job.
    *+001 End:
    *-001
      CHECK pa_backg EQ ' '.
    *-001
    LOOP AT ifiles.
    clear itab. refresh itab.
       CONCATENATE wf_path ifiles-name INTO pa_sfile.
    upload PC file to internal table int_UPLOAD
      PERFORM f_upload_excel_file.
    reformat data
      PERFORM f_format_data.
    upload formatted data into SAP system
      break breddy.
      PERFORM f_upload_data.
    Event: END-OF-SELECTION
    *END-OF-SELECTION.
    display summary report
      PERFORM f_display_report.
    *+001 Begin
      IF sy-batch = wl_x.
      CONCATENATE '/usr/sap/trans/carrier2' '_'
                  sy-datum '_' sy-uzeit
                  INTO wf_sum_dest_file.
        wf_sum_source_file = '/usr/sap/nfs/erp/UTL/carrier2'.
       wf_sum_dest_file = '/usr/sap/trans/carrier2'.
    ELSE.
       wf_sum_source_file = pa_file.
       wf_sum_dest_file = '/usr/sap/trans/carrier2'.
    To move the processed file to Completed directory
      PERFORM f_move_file_to_other_dir USING
                   wf_sum_source_file
                   wf_sum_dest_file.
      ENDIF.
    *+001 End
      wait up to 60 seconds.
    *&      Form  f_get_filename
          Display the File Location
          Called by:  Main Program (AT SELECTION-SCREEN on VALUE-REQUEST)
          Calls:
    FORM f_get_filename.
      CLEAR wf_filename.
      CALL FUNCTION 'F4_FILENAME'
           EXPORTING
                program_name  = syst-cprog
                dynpro_number = syst-dynnr
               field_name    = wf_fieldname
           IMPORTING
                file_name     = wf_filename.
    If the user press cancel button without selecting file name
    then the file name will be initial and raise the error message
      IF wf_filename IS INITIAL.
        MESSAGE i000 WITH 'No File selected'(012).
        LEAVE LIST-PROCESSING.
      ENDIF.
      pa_file = wf_filename.
    ENDFORM.                    " f_get_filename
    Form: F_CHECK_INPUT                                                **
    Description:
    This subroutine is used to validate the Selection Screen inputs.
    Called By:  ZMISOPPLAN01                                            *
    Calls:      None                                                    *
    FORM f_check_input.
      if pa_foreg eq wl_X.
        if sy-batch ne wl_X.  " IF pa_foreg EQ wl_x.                                      " +001
    check file type
        IF pa_file NS '.xls'.
          MESSAGE e106.
        ENDIF.
      ENDIF.              "+001
      endif.
    *+001 Begin:
    wf_file = pa_sfile.
    EXPORT wf_file TO MEMORY ID wl_id.
    ENDIF.  " Commented by Br
    *+001 Begin
      IF pa_backg EQ wl_x.
        pa_sfile = '/usr/sap/nfs/erp/UTL/carrier2'.
        OPEN DATASET pa_sfile FOR INPUT IN TEXT MODE ENCODING  DEFAULT MESSAGE wf_mess.
        IF sy-subrc NE 0.
          MESSAGE e000(zmmx) WITH 'File not present in path /usr/sap/nfs/erp/UTL'.
          LEAVE LIST-PROCESSING.
          STOP.
        ELSE.
          CLOSE DATASET pa_sfile.
        ENDIF.
    ELSE.
       OPEN DATASET pa_sfile FOR INPUT IN TEXT MODE ENCODING  DEFAULT MESSAGE wf_mess.
       IF sy-subrc NE 0.
         MESSAGE e000(zmmx) WITH 'File not found:' pa_sfile.
         LEAVE LIST-PROCESSING.
         STOP.
       ELSE.
         CLOSE DATASET pa_sfile.
       ENDIF.
      ENDIF.
    *+001 End:
    ENDFORM.                                            "f_check_input
    *&   Form  f_upload_excel_file
       Uploads an excel file from the workstation. The file is loaded  *
       into the internal table specified by int_out_tab.               *
    -->  PA_FILE       The name and path of the excel file to upload  *
    <--  int_UPLOAD    Internal table that that will contain the data *
                        loaded from the excel file.                    *
    FORM f_upload_excel_file.
    *-001
      TYPES truxs_t_text_data(4096) TYPE c OCCURS 0.
      DATA: int_tab_input_data TYPE truxs_t_text_data.
    *+001
      IF sy-batch IS INITIAL.
    *+001
    uploading data into internal table int_upload from excel file
        CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
          EXPORTING
            i_tab_raw_data       = int_tab_input_data[]
            i_filename           = pa_file                      "-001
          TABLES
            i_tab_converted_data = int_upload
          EXCEPTIONS
            conversion_failed    = 1
            OTHERS               = 2.
    problems occur in file uploading
        IF int_upload[] IS INITIAL.
          MESSAGE i000 WITH 'No data uploaded from input file'(005).
          LEAVE LIST-PROCESSING.
        ENDIF.
    *+001
      ENDIF.
    *+001
      IF sy-batch = wl_x.
        OPEN DATASET pa_sfile FOR INPUT IN TEXT MODE encoding default. " ENCODING  DEFAULT MESSAGE wf_mess.
        IF sy-subrc = 0.
          DO.
            READ DATASET pa_sfile INTO wf_string.
            IF sy-subrc <> 0.
              EXIT.
            ELSE.
              SPLIT wf_string AT cl_abap_char_utilities=>horizontal_tab INTO wa_upload-field1 wa_upload-field2 wa_upload-field3
              wa_upload-field4 wa_upload-field5 wa_upload-field6 wa_upload-field7 wa_upload-field8
              wa_upload-field9 wa_upload-field10 wa_upload-field11 wa_upload-field12 wa_upload-field13
              wa_upload-field14 wa_upload-field15 wa_upload-field16 wa_upload-field17 wa_upload-field18
              wa_upload-field19 wa_upload-field20 wa_upload-field21 wa_upload-field22 wa_upload-field23
              wa_upload-field24 wa_upload-field25 wa_upload-field26 wa_upload-field27 wa_upload-field28
              wa_upload-field29 wa_upload-field30 wa_upload-field31 wa_upload-field32 wa_upload-field33
              wa_upload-field34 wa_upload-field35 wa_upload-field36 .
              APPEND wa_upload TO int_upload.
              CLEAR wa_upload.
            ENDIF.
          ENDDO.
          CLOSE DATASET pa_sfile.
        ELSE.
          MESSAGE i000(zmmx) WITH 'File not found'.
          LEAVE LIST-PROCESSING.
          STOP.
        ENDIF.
      ENDIF.
    +001
    ENDFORM.                                  "f_upload_excel_file
    *&      Form  f_format_data
          format the data to be uploaded
          Called by:  ZMISOPPLAN01
          Calls: N/A
    FORM f_format_data.
    delete the header lines
      DELETE int_upload WHERE
      field1 CS 'SCAC' OR field1 CS 'Scac' OR field1 CS 'Carrier'.
    delete lines with no carrier info
      DELETE int_upload WHERE
      field1 IS INITIAL OR field2 IS INITIAL.
      SORT int_upload BY field2.
    ENDFORM.                    " f_format_data
    *&      Form  f_upload_data
          Description:upload the data
    FORM f_upload_data.
      DATA: loc_priceperlb LIKE zvship_trk_data-act_per_lb,
            loc_charprice(10) TYPE n,
            loc_size TYPE i,
            loc_pickupdate(10) TYPE c,
            loc_totalwt    LIKE zvship_trk_data-pkg_wgt.
      CHECK NOT int_upload[] IS INITIAL.
      DESCRIBE TABLE int_upload LINES wf_recnt.
      LOOP AT int_upload INTO wa_upload.
        SELECT COUNT(*) FROM zvship_trk_data WHERE trackn = wa_upload-field2.
        IF sy-subrc = 0.
    tracking no. exists in carrier database
          CONCATENATE wl_trackno wa_upload-field2
          ' already exists in carrier tracking database'  INTO
          wa_error_data-errtext. "Error text of int_error_data
          APPEND wa_error_data TO int_error_data.
        ELSE.
          SELECT SINGLE * FROM vtrkh WHERE trackn = wa_upload-field2.
          IF sy-subrc <> 0.
    tracking no. not in tracking database
            CONCATENATE wl_trackno wa_upload-field2
            ' not found in tracking database'  INTO
            wa_error_data-errtext. "Error text of int_error_data
            APPEND wa_error_data TO int_error_data.
          ELSE.
    must have freight charge
            IF wa_upload-field20 IS INITIAL.
              CONCATENATE wl_trackno wa_upload-field2
              ' has no total net charges'  INTO
              wa_error_data-errtext. "Error text of int_error_data
              APPEND wa_error_data TO int_error_data.
              CONTINUE.
            ENDIF.
    must have final delv. date
            IF wa_upload-field25 IS INITIAL.
              CONCATENATE wl_trackno wa_upload-field2
              ' has no final delivery date'  INTO
              wa_error_data-errtext. "Error text of int_error_data
              APPEND wa_error_data TO int_error_data.
              CONTINUE.
            ENDIF.
    all checks ok, build BDC for ZVTRAFFICINPUT
    get total weight and compute price/lb
            IF vtrkh-uevbtyp EQ wl_x.
              SELECT SINGLE  brgew INTO loc_totalwt
              FROM zvship_non_pkgs
                WHERE venum = vtrkh-vbeln.
            ELSE.
              SELECT SINGLE brgew INTO loc_totalwt
              FROM vekp WHERE venum = vtrkh-vbeln.
            ENDIF.
            IF sy-subrc NE 0.
              CONCATENATE wl_trackno wa_upload-field2
              ' has no total weight'  INTO
              wa_error_data-errtext. "Error text of int_error_data
              APPEND wa_error_data TO int_error_data.
              CONTINUE.
            ENDIF.
    price/lb = total net charges / total wt
            loc_priceperlb = wa_upload-field20 / loc_totalwt.
            WRITE loc_priceperlb TO loc_charprice LEFT-JUSTIFIED.
    if no pickup date from VTRKH, use date from file
            IF vtrkh-routeldat IS INITIAL.
              loc_pickupdate = wa_upload-field23.
            ELSE.
              CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
                EXPORTING
                  input  = vtrkh-routeldat
                IMPORTING
                  output = loc_pickupdate.
            ENDIF.
            PERFORM f_set_bdc_val
            USING :
            '1' 'SAPLZVSHIP_TRAK' '0001',
            ' ' 'BDC_CURSOR' 'VIM_POSITION_INFO',
            ' ' 'BDC_OKCODE' '=AEND'.
            PERFORM f_set_bdc_val
            USING :
            '1' 'SAPLZVSHIP_TRAK' '0001',
            ' ' 'BDC_CURSOR' 'ZVSHIP_TRK_DATA-EOD_DATE(01)',
            ' ' 'BDC_OKCODE' '=NEWL'.
            PERFORM f_set_bdc_val
            USING :
            '1' 'SAPLZVSHIP_TRAK' '0002',
            ' ' 'BDC_CURSOR' 'ZVSHIP_TRK_DATA-TRACKN',
            ' ' 'ZVSHIP_TRK_DATA-TRACKN' wa_upload-field2,
            ' ' 'BDC_OKCODE' '/00'.
            PERFORM f_set_bdc_val
            USING :
            '1' 'SAPLZVSHIP_TRAK' '0002',
            ' ' 'ZVSHIP_TRK_DATA-EOD_DATE' loc_pickupdate,
            ' ' 'ZVSHIP_TRK_DATA-ACT_DATE' wa_upload-field25.
       IF NOT wa_upload-field15 IS INITIAL.
         PERFORM F_SET_BDC_VAL
         USING :
         ' '  'ZVSHIP_TRK_DATA-PKG_WGT' wa_upload-field15.  "Total Wt.
       ENDIF.
            PERFORM f_set_bdc_val
            USING :
            ' ' 'ZVSHIP_TRK_DATA-ACT_FRT' wa_upload-field20,"Total Net charges
            ' ' 'ZVSHIP_TRK_DATA-ACT_SURCH' wa_upload-field18,"Fuel surcharge
            ' ' 'ZVSHIP_TRK_DATA-ACT_ACC' wa_upload-field19,  "Accessorial ch.
            ' ' 'ZVSHIP_TRK_DATA-ACT_TOTAL' wa_upload-field16,"Gross Charges
            ' ' 'ZVSHIP_TRK_DATA-ACT_PER_LB' loc_charprice.  "Price/LB
       IF NOT wa_upload-field13 IS INITIAL.
         PERFORM F_SET_BDC_VAL
         USING :
         ' ' 'ZVSHIP_TRK_DATA-PKG_PAL' wa_upload-field13.  "Pallet count
       ENDIF.
       IF NOT wa_upload-field14 IS INITIAL.
         PERFORM F_SET_BDC_VAL
         USING :
         ' ' 'ZVSHIP_TRK_DATA-PKG_PCS' wa_upload-field14.  "Case count
       ENDIF.
            PERFORM f_set_bdc_val
            USING :
            ' ' 'BDC_OKCODE' '=SAVE'.
            PERFORM f_set_bdc_val
            USING :
            '1' 'SAPLZVSHIP_TRAK' '0002',
            ' ' 'BDC_OKCODE' '=UEBE'.
            PERFORM f_set_bdc_val
            USING :
            '1' 'SAPLZVSHIP_TRAK' '0001',
            ' ' 'BDC_OKCODE' '=BACK'.
    call transaction ZVTRAFFICINPUT
            PERFORM f_call_zvtrafficinput.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " f_upload_data
          FORM F_SET_BDC_VAL                                            *
    -->  WG_DYNBEGIN                                                   *
    -->  WF_FIELDNAME                                                  *
    -->  WF_FIELDVAL                                                   *
    FORM f_set_bdc_val  USING
          locf_dynbegin
          locf_fieldname
          locf_fieldval.
      CLEAR wa_bdcdata.
      IF locf_dynbegin = wl_1.                                  "'1'.
        wa_bdcdata-program = locf_fieldname.
        wa_bdcdata-dynpro = locf_fieldval.
        wa_bdcdata-dynbegin = wl_x. "'X'.
      ELSE.
        wa_bdcdata-fnam = locf_fieldname.
        wa_bdcdata-fval = locf_fieldval.
      ENDIF.
      APPEND wa_bdcdata TO int_bdcdata.
    ENDFORM.                    "F_SET_BDC_VAL
    *&      Form  F_CALL_ZVTRAFFICINPUT
          text
    -->  p1        text
    <--  p2        text
    FORM f_call_zvtrafficinput .
      DATA: locf_last_rec TYPE sy-index,
            wf_msgstring(128)                TYPE c.
      DATA: loc_mode TYPE c.
      loc_mode = 'N'.      "+001 needs to be changed
      CALL TRANSACTION wl_tcode
        USING int_bdcdata
        MODE 'A'
        MODE wl_mode  "In Backgrnd(N)
          MODE loc_mode
        UPDATE wl_update              "(S)ynchr mode "+001
        MESSAGES INTO int_messages.
    In case there are errors in call transaction
      IF sy-subrc <> 0.
        DESCRIBE TABLE int_messages LINES locf_last_rec.
        READ TABLE int_messages INTO wa_messages
              INDEX locf_last_rec.
        PERFORM f_fill_bdc_error USING wa_upload-field2 wf_msgstring.
      ELSE.
    Keep count of successfully process records
        wf_recok = wf_recok + 1.
        PERFORM f_fill_bdc_success USING wa_upload-field2.
      ENDIF.
      REFRESH: int_bdcdata, int_messages.
    ENDFORM.                    " F_CALL_ZVTRAFFICINPUT
    *&      Form  f_fill_bdc_success
          text
         -->P_WA_UPLOAD_FIELD2  text
    FORM f_fill_bdc_success  USING    p_wa_upload_field2.
      CONCATENATE wl_trackno p_wa_upload_field2 '- Entry added'
      INTO
      wa_error_data-errtext. "Success message
      APPEND wa_error_data TO int_error_data.
    ENDFORM.                    " f_fill_bdc_success
    *&      Form  f_fill_bdc_error
          text
         -->P_WA_UPLOAD_FIELD2  text
         -->P_WF_MSGSTRING  text
    FORM f_fill_bdc_error  USING    p_wa_upload_field2
                                    p_wf_msgstring.
      CONCATENATE wl_trackno p_wa_upload_field2
      '- Error : ' p_wf_msgstring
      INTO
      wa_error_data-errtext. "Error text of int_error_data
      APPEND wa_error_data TO int_error_data.
    ENDFORM.                    " f_fill_bdc_error
    *&      Form  f_display_report
          text
    FORM f_display_report.
    *+001 Begin:
      DATA: reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
            doc_chng LIKE sodocchgi1,
            objcont LIKE solisti1 OCCURS 0 WITH HEADER LINE.
      DATA: loc_recnt(4) TYPE c,
            loc_recok(4) TYPE c.
    *+001 End:
        if sy-batch ne wl_x.  "+001
        ULINE /1(175).
        WRITE:/ 'Date/Time: '(006) COLOR COL_HEADING,
                sy-datum DD/MM/YYYY, '/',sy-uzeit,
                40 'Uploading of Carrier Information to ZVTRAFFIC'.
        ULINE /1(175).
        SKIP.
        WRITE:/ 'Following File Has Been Processed'.
             / pa_file.    "-001
        SKIP.
        WRITE:/ 'Number of records read:', wf_recnt.
        WRITE:/ 'Number of records processed successfully:', wf_recok.
        SKIP.
        LOOP AT int_error_data INTO wa_error_data.
          WRITE :/ wa_error_data-errtext.
        ENDLOOP.
    *+001 Begin:
      ELSE.
       IMPORT wf_file FROM MEMORY ID wl_id.
        reclist-receiver = wl_adm.
        reclist-rec_type = wl_u.
        reclist-com_type = wl_int.
        APPEND reclist.
        doc_chng-obj_name = wl_urgent.
        doc_chng-obj_descr = wl_descr.
        CONCATENATE 'Date/Time: ' sy-datum '/' sy-uzeit
                'Uploading of Carrier Information to ZVTRAFFIC'
                INTO objcont SEPARATED BY space.
        APPEND objcont.
    *-001
       CONCATENATE 'Following File Has Been Processed' pa_file
                 INTO objcont SEPARATED BY space.
       APPEND objcont.
    *-001
        loc_recnt = wf_recnt.
        CONCATENATE 'Number of records read:' loc_recnt
          INTO objcont SEPARATED BY space.
        APPEND objcont.
        loc_recok = wf_recok.
        CONCATENATE 'Number of records processed successfully:' loc_recok
          INTO objcont SEPARATED BY space.
        APPEND objcont.
        LOOP AT int_error_data INTO wa_error_data.
          MOVE wa_error_data-errtext TO objcont.
          APPEND objcont.
        ENDLOOP.
        CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
          EXPORTING
            document_type              = wl_raw
            document_data              = doc_chng
            put_in_outbox              = wl_x
            commit_work                = wl_x
          TABLES
            object_content             = objcont
            receivers                  = reclist
          EXCEPTIONS
            too_many_receivers         = 1
            document_not_sent          = 2
            operation_no_authorization = 4
            OTHERS                     = 99.
        IF sy-subrc EQ 0.
          MESSAGE s205. "email sent
        ELSE.
          MESSAGE i206. "email not sent
        ENDIF.
      ENDIF.
    *+001 End:
    ENDFORM.                    " f_display_report
    *&      Form  f_background_job
          text
    -->  p1        text
    <--  p2        text
    FORM f_background_job .
      DATA: loc_jobcount LIKE btch1150-jobcount.
      IF pa_backg = wl_x.
        CALL FUNCTION 'JOB_OPEN'
          EXPORTING
            jobname          = wl_jobname
            jobclass         = 'A'
          IMPORTING
            jobcount         = loc_jobcount
          EXCEPTIONS
            cant_create_job  = 1
            invalid_job_data = 2
            jobname_missing  = 3
            OTHERS           = 4.
        IF sy-subrc <> 0.
          MESSAGE i000(zmmx) WITH 'JOB_OPEN failed.' 'sy-subrc =' sy-subrc.
          LEAVE LIST-PROCESSING.
        ENDIF.
        CALL FUNCTION 'JOB_SUBMIT'
             EXPORTING
               extpgm_param            = pa_file
                  authcknam               = sy-uname
                  jobcount                = loc_jobcount
                  jobname                 = wl_jobname
                  report                  = sy-repid
                  variant                 = wl_variant
             EXCEPTIONS
                  bad_priparams           = 1
                  bad_xpgflags            = 2
                  invalid_jobdata         = 3
                  jobname_missing         = 4
                  job_notex               = 5
                  job_submit_failed       = 6
                  lock_failed             = 7
                  program_missing         = 8
                  prog_abap_and_extpg_set = 9
                  OTHERS                  = 10.
        IF sy-subrc <> 0.
          MESSAGE i000(zmmx) WITH 'JOB_SUMBMIT failed.' 'sy-subrc =' sy-subrc.
          LEAVE LIST-PROCESSING.
        ENDIF.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            jobcount             = loc_jobcount
            jobname              = wl_jobname
            strtimmed            = 'X'
          EXCEPTIONS
            cant_start_immediate = 1
            invalid_startdate    = 2
            jobname_missing      = 3
            job_close_failed     = 4
            job_nosteps          = 5
            job_notex            = 6
            lock_failed          = 7
            OTHERS               = 8.
        IF sy-subrc <> 0.
          MESSAGE i000(zmmx) WITH 'JOB_CLOSE failed.' 'sy-subrc =' sy-subrc.
          LEAVE LIST-PROCESSING.
        ELSE.
          MESSAGE i000(zmmx) DISPLAY LIKE wl_i WITH 'Background job submitted'.
          LEAVE LIST-PROCESSING.
          wait up to 60 seconds.
          STOP.
        ENDIF.
      ENDIF.
    ENDFORM.                    " f_background_job
    *&      Form  f_get_server_file
          text
    -->  p1        text
    <--  p2        text
    FORM f_get_server_file .
      CLEAR: wf_filename.
    following function module display the list of application file and
    directories in a pop up window
      CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
        IMPORTING
          serverfile       = wf_filename
        EXCEPTIONS
          canceled_by_user = 1
          OTHERS           = 2.
    If the user press cancel button without selecting file name
    then the file name will be initial and raise the error message
      IF wf_filename IS INITIAL.
        MESSAGE i000 WITH 'No File selected'(012).
        LEAVE LIST-PROCESSING.
      ENDIF.
      pa_sfile = wf_filename.
    ENDFORM.                    " f_get_server_file
    *&      Form  f_move_file_to_other_dir
          To move the
    FORM f_move_file_to_other_dir  USING   locf_source_file
                                           locf_dest_file.
      CALL FUNCTION 'Z_FILE_HANDLING_UTILITY'
        EXPORTING
          action                    = wl_action  "VALUE 'mov'
          source_physical_file_name = locf_source_file
          dest_physical_file_name   = locf_dest_file
        EXCEPTIONS
          invalid_action            = 1
          invalid_file_type         = 2
          file_type_missing         = 3
          file_type_not_required    = 4
          source_file_missing       = 5
          source_filename_error     = 6
          destination_not_required  = 7
          destination_missing       = 8
          multiple_file_names       = 9
          file_deletion_error       = 10
          invalid_source_file       = 11
          file_read_error           = 12
          file_write_error          = 13
          file_rename_error         = 14
          file_move_error           = 15
          destination_file_exists   = 16
          OTHERS                    = 17.
      IF sy-subrc <> 0.
        MESSAGE i000(zmmx) WITH 'Error in Moving Process directory to completed Directory'(004).
       LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " f_move_file_to_other_dir
    *&      Form  f_get_path
          text
    -->  p1        text
    <--  p2        text
    FORM f_get_path .
      CALL FUNCTION 'RZL_READ_DIR_LOCAL'
        EXPORTING
          name           = wf_path
        TABLES
          file_tbl       = ifiles
        EXCEPTIONS
          argument_error = 1
          not_found      = 2
          OTHERS         = 3.
      DELETE ifiles WHERE name+0(1) = '.'.
      DELETE ifiles WHERE name+0(1) NE 'w'.
    ENDFORM.                    " f_get_path
    Regards,
    Brahma Reddy

  • I am using report generation toolkit 1.1 with Labview 7.0 and Office 2003 profession​al. The create new report VI opens Excel but throws error (-21471672​62- from automation open VI) when I try to open MS word. please help...

    I am using report generation toolkit 1.1 with Labview 7.0 and Office 2003 professional. The create new report VI opens Excel but throws error (-2147167262- from automation open VI) when I try to open MS word. please help...

    Hi Leo22,
    Does this error occur if you use any of the example programs that come shipped with LabVIEW? I would try opening one of the examples that write data to Word and see if those give you an error. Also, have you tried just putting down a New Report.VI and change the report type to Word? If this simple vi (that's all you need to open Word) breaks, I would check to see if there are any instances of Word still open. Check the task manager to see if any word processes are still open. There should not be a problem accessing Word 2003 from LabVIEW 7.0. If neither of these solutions work, please give some more detail about your application and we can research further. Thanks!
    Jeremy L.
    National Instruments
    Jeremy L.
    National Instruments

  • "An error occurred sending the command to the application" When trying to open excel document from outlook 2007

    Error message "An error occurred sending the command to the application" When trying to open excel document from outlook 2007.
    OS: Windows Server 2008 R2
    If I save the document then it opens fine, messing with default file associations does not resolve this problem, I've googled for ir it and some suggest unticking compatibility mode or "run as admin" for excel application, neither is selected in my case.
    Outlook is configured to run as remote application from remoteApp server, this error is only occurring for one user, for others excel documents open just fine.

    Hi
    Thank you for using
    Microsoft Office for IT Professionals Forums.
    From your description, we can Create a trusted location follow these steps
    Click the Microsoft Office Button , and then click Excel Options.
    Click Trust Center, click Trust Center Settings, and then click
    Trusted Locations.
    If you want to create a trusted location that is not local to your computer, select the Allow trusted locations on my network (not recommended) check
    box.
    Click Add new location.
     IMPORTANT   We recommended that you don't make your entire
    Documents or My Documents folder a trusted location. Doing so creates a larger target for a hacker to potentially exploit and increases your security risk. Create a subfolder within Documents or My Documents, and make only that folder a trusted location.
    In the Path box, type the name of the folder that you want to use as a trusted location, or click Browse to
    locate the folder.
    If you want to include subfolders as trusted locations, select the
    Subfolders of this location are also trusted check box.
    In the Description box, type what you want to describe the purpose of the trusted location.
    Click OK.
    More detailed information you can refer to this link:
    http://office.microsoft.com/en-us/word-help/create-remove-or-change-a-trusted-location-for-your-files-HA010031999.aspx?CTT=1#BM12
    Please take your time to try the suggestions and let me know the results at your earliest convenience. If anything is unclear or if there is anything
    I can do for you, please feel free to let me know.
    Hope that helps.
    Sincerely
    William Zhou CHN
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Maybe you are looking for