Excel upload in WD Abap

Hi Colleages,
Is it possible to upload an excel file through WD ABAP?
The file upload control gives the data in XSTRING format and probably would not be of much help. What I need is the excel data uploaded to my internal table.
Also I tried using the CL_GUI_FRONTEND_SERVICES inside my action but it does not work.
Suggest any way for this.

Hi Sagar,
  Yesterday I tried the same with GUI_UPLOAD. Here i am putting the code will help you about my logic.
Logic:
I create 2 internal table IT_OIR0DTFKGOILAMEX & IT_OIR0DTFKGOILAMEX1.
---> Population information into internal table IT_OIR0DTFKGOILAMEX  and download to file C:\TEST4.XLS.
---> Upload the same file into another internal table IT_OIR0DTFKGOILAMEX1.
---> you can check in the debug mode how the data is transferring
Here I am putting the code as follows:
DATA: IT_OIR0DTFKGOILAMEX TYPE TABLE OF alv_t_t2,      " OIR0DTFKGOILAMEX,
IT_OIR0DTFKGOILAMEX1 TYPE TABLE OF alv_t_t2. " OIR0DTFKGOILAMEX." OCCURS 0.
SELECT * FROM sflight INTO corresponding fields of table IT_OIR0DTFKGOILAMEX.
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    FILENAME                        = 'C:TEST4.xls'
    FILETYPE                        = 'ASC'
    WRITE_FIELD_SEPARATOR           = 'X'
  TABLES
    DATA_TAB                        = IT_OIR0DTFKGOILAMEX
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Refresh IT_OIR0DTFKGOILAMEX1[].
CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    FILENAME                      =  'C:TEST4.xls'
    FILETYPE                      = 'ASC'
    HAS_FIELD_SEPARATOR           = 'X'
   READ_BY_LINE                  = 'X'
  TABLES
    DATA_TAB                      = IT_OIR0DTFKGOILAMEX1
EXCEPTIONS
   FILE_OPEN_ERROR               = 1
   FILE_READ_ERROR               = 2
   NO_BATCH                      = 3
   GUI_REFUSE_FILETRANSFER       = 4
   INVALID_TYPE                  = 5
   NO_AUTHORITY                  = 6
   UNKNOWN_ERROR                 = 7
   BAD_DATA_FORMAT               = 8
   HEADER_NOT_ALLOWED            = 9
   SEPARATOR_NOT_ALLOWED         = 10
   HEADER_TOO_LONG               = 11
   UNKNOWN_DP_ERROR              = 12
   ACCESS_DENIED                 = 13
   DP_OUT_OF_MEMORY              = 14
   DISK_FULL                     = 15
   DP_TIMEOUT                    = 16
   OTHERS                        = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Warm Regards,
Vijay

Similar Messages

  • Problem in uploading an excel file in wd abap

    I am trying to upload an excel file in wd abap but on uploading it shows me the data in the form of some codes but when i try to do the same thing using text file it works well.Plese refer the code .
    METHOD onactionon_upload .
      TYPES : BEGIN OF itab_str1,
       name(10) TYPE c,
       age(10) TYPE c,
       END OF itab_str1.
      DATA : t_table1 TYPE STANDARD TABLE OF itab_str1,
            i_data TYPE STANDARD TABLE OF string,
            lo_nd_sflight TYPE REF TO if_wd_context_node,
            lo_el_sflight TYPE REF TO if_wd_context_element,
            l_string TYPE string,
            fs_table TYPE itab_str1,
            l_xstring TYPE xstring,
            fields TYPE string_table,
            lv_field TYPE string.
      DATA : t_table TYPE if_main=>elements_data_tab,
            data_table TYPE if_main=>elements_data_tab.
      wd_context->get_attribute(
      EXPORTING
        name = 'DATASOURCE'
        IMPORTING
          value = l_xstring
    CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
      EXPORTING
        in_xstring          = l_xstring
    IMPORTING
       out_string          = l_string.
    SPLIT l_string AT cl_abap_char_utilities=>newline  INTO TABLE i_data.
    LOOP AT i_data INTO l_string.
    SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
    READ TABLE fields INTO lv_field index 1.
    fs_table-name = lv_field.
    READ TABLE fields INTO lv_field index 2.
    fs_table-age = lv_field.
    APPEND fs_table TO t_table1.
    ENDLOOP.
    lo_nd_sflight = wd_context->get_child_node( 'DATA_TAB').
    lo_nd_sflight->bind_table( t_table1 ).
    ENDMETHOD.

    Problem is not with the file format  nor Upload element.
    problem is with conversion function module, still now for conversion of xcel data to string format we dont have perfect function module.
    CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
    EXPORTING
    in_xstring = l_xstring
    IMPORTING
    out_string = l_string.
    That's a bug with xcel conversion  As of now I dont find any fm which converts  xcel data to string without any problem.
    Regards
    Srinvivas
    Edited by: sanasrinivas on Dec 23, 2011 7:02 AM

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

  • How to read the excel file using webdynpro abap?

    Hi,
    how to read and modify excel file using webdynpro abap?
    Regards,
    Pavani

    For reading excel file follow the steps :
    1. Use a File upload UI element and bind it with xstring.
    2. Now your excel will be uploaded and stored in Xstring.
    3. Convert Xstring to String data using FM 'HR_KR_XSTRING_TO_STRING'.
    4. Now split the string at new line so as to make an internal table .
      Ex . SPLIT l_string  AT cl_abap_char_utilities=>newline INTO TABLE it_table.
      here it_table is type table of string.
    5.now loop at the internal table and separate the content of this table separated by tab.
      Ex. SPLIT wa_table AT cl_abap_char_utilities=>horizontal_tab INTO TABLE it_new.
    it_new type string_table.
    6. For more info , refer this thread :
    Re: How to upload excel file in Webdynpro application using ABAP

  • Excel upload with listener

    Hi,
    I have enabled excel upload with the listener, and it actually works fine. I get the data into a collection.
    Now what if I want to store the file in the database? It seems that the file is NOT inserted into wwv_flow_files. Also the item that contains the file has no value when the page is submitted with the XLS2COLLECTION button. (If I create another button that also submits the filename is there)..
    So it seems that when this feature is enabled the file is deleted from www_flow_files when page processing starts.

    Hi Martin,
    the feature is undocumented and not officially supported for 1.1, but known to work for Excel files up to the 2003 format. XLSX (2007 onwards) is not implemented.
    Perhaps going through the discussion and examples in {thread:id=2342792} helps you solve your issue.
    -Udo

  • ADFDi Excel upload failed in a new session

    ADFDi Excel upload failed when a change was made in a locally saved ADFDi Excel file.  This should be a very common disconnected scenario.  I must miss something.  Here are high-level steps that I have done.
    1. Open a ADFDi Excel from a ADF page.
    2. Download data to Excel
    3. Modify a row in ADF table component in the Excel, then save the Excel file locally.  (If I clicked the 'Save' button instead of saving the file locally, the change was uploaded to the server correctly).
    4. Open the locally saved Excel, and accept the option to connect to the server and login.  A new session should be created in the ADF web application.
    5. Click 'No' in the popup window of "Do you want to discard the pending change?"
    6. The 'changed' indicator is shown on the changed row in the Excel.  Click 'Save' button, which has two actions - Upsync and ADFTable.upload
    7. On the server, a 'Row not found' exception is thrown from DCJboDataControl.setCurrentRowInRSI().  In this method, it tries to find the row in the ViewObject instance using the uploaded row's key.  The code is rsi.findByKey(key, 1).  I checked the value of key.  It looks correct. But no row is return from findByKey() call.  Then 'No row found' exception is thrown.
    My JDev version 11.1.1.7
    Greatly appreciate any suggestion on what could be wrong?

    HI
    I am facing the same issue. Are you able to resolve this issue or any solution around ?
    Thanks

  • How to import 300 purchase order into SAP using excel upload

    Hi Everyone,
    I am trying to close all the existing purchase orders in the system (about 300) and create similarly 300 new ones under new accounts.
    My questions is can I do that using an excel upload, or it will have to be done manually? If I can, any help in that regard would be highly appreciated.
    Regards,
    Abubakr Asif

    Hi
    Welcome to SDN World!
    You can use LSMW to create 300 Purchase Orders.
    please check this link for guidance
    http://www.ficoexpertonline.com/downloads/0703.doc
    To close existig POs, you can use Mass update (Tr code MEMASSPO).
    hope it helps.
    regards
    Srinivas
    Reward if it helps

  • Access data in Excel placed in OFFICE_CONTROL ABAP WB

    We are using the Excel Office Control in ABAP WD. The Excel displays and I can get the excel binary data in a XString thru context binding.
    However, is there a chance to access single cells of the Excel. I do not really want to deal with all the technical details but simply get some cells of the filled in Excel.
    Any hints?

    Hi Frank,
    Thanks for the pointer. I managed to find this link by myself. I was wondering if there is any other sample application that demonstrates the features of this Office Control in WDA(Like the package SWDP_TEST has all sample applications).
    Anyways, thanks for the reply.
    Regards
    <i><b>Raja Sekhar</b></i>

  • Preceeding zeroes while excel upload and download

    Hi,
    I am uploading some data from excel into an internal table,processing it and then downloading it again in excel.
    For Excel Upload I am using CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    For Excel Download I am using GUI_DOWNLOAD.
    But the problems is when the data is like 01 it is downloading it as 1 in the excel.The user don't want to do any changes after downloading it to the excel and want the data 01 to be dowloaded as 01 itself and not as 1.
    We can format it in excel but the user is not willing for that.Any possibility that we can handle it in the program.
    Thanks,
    K.Kiran.

    You have to use OLE technique for the same....that will solve your case.
    supposae i want to make the 5th , 6th and 7th coloumn , as character format.
    The below scenario will help.
    collect the contents of the excel in  it[] ,
      DESCRIBE TABLE it[] LINES wf_it_line.
      wf_it_line = wf_it_line + 8.
      CLEAR : wf_cellx, wf_celly, wf_cellr.
      CALL METHOD OF wf_excel 'Cells' = wf_cellx
      EXPORTING
       #1 = 8
       #2 = 5.
      CALL METHOD OF wf_excel 'Cells' = wf_celly
      EXPORTING
       #1 = wf_it_line
       #2 = 7.
      CALL METHOD OF wf_excel 'Range' = wf_cellr
       EXPORTING
    #1 = wf_cellx
    #2 = wf_celly.
      SET PROPERTY OF wf_cellr 'NumberFormat' = '@' .
    this will change the format of the excel.
    then call the below method
      CALL METHOD cl_gui_frontend_services=>clipboard_export
          IMPORTING
            data                 = it[]
          CHANGING
            rc                   = l_rc
          EXCEPTIONS
            cntl_error           = 1
            error_no_gui         = 2
         not_supported_by_gui = 3
            OTHERS               = 4.
      CALL METHOD OF wf_excel 'Cells' = wf_cell1
        EXPORTING
         #1 = 1
         #2 = 1.
      CALL METHOD OF wf_excel 'Cells' = wf_cell2
        EXPORTING
         #1 = 1
         #2 = 1.
      CALL METHOD OF wf_excel 'Range' = wf_range
        EXPORTING
         #1 = wf_cell1
         #2 = wf_cell2.
      CALL METHOD OF wf_range 'Select'.
      CALL METHOD OF wf_worksheet 'Paste'.
    then call the method 'SAVEAS' to save the excel.
    Edited by: Rudra Prasanna Mohapatra on Jan 22, 2009 5:47 AM

  • Reg File Upload Object in abap Webdynpro

    Hi Friends,
    Would like to enquire one doubt in the file upload object in abap webdynpro.
    By default when we press the browse button, near to the file name there is a button which shows the the file types like:
    ., *.html, ,gif,.jpeg etc.
    Is there any way we can control that, as i have an requirement where in to upload only certain extension types.
    thankyou.

    HI,
    I would suggest you to follow this approach :
    1. Create a Table in your View in which FileUpload is there.
    2. Populate this value with valid file extension.
    3. Make it invisible by default.
    4. Now when you have entered value in Fileupload and click on Ok button.
    5. Check whether Mimetype matches any value in Table.
    6. If it is invalid, Throw an error message and mke Table of Valid extension Visible.
    Sample code to have Table with Valid entries.
    types : begin of str,
                 valid_ext type string,
             end of str.
    data : wa type str,
              itab type table of str.
    wa-valid_Ext = 'EXL'.
    append wa to itab.
    wa-valid_ext = 'DOC'.
    append wa to itab.
    lo_nd->bind_Table( itab ).
    here lo_nd is your ref to node of Table having valid extensions.
    7. Bind this Table's Visible property wiht wdui_visiblity .
    8. Set it Visible - 02 , Inviisible - 01.
    I hope it is clear.

  • DP- Excel Upload Issue

    Hi All,
    I am using SCM 5.0 DP module.
    I am facing some problem while uploading Historical Sales data from excel file  to Planning book.
    Steps
    1. I download the planning book data by clicking on "Save Locally" at that time I select "Prepare file for upload at later time" and select "Save Additionla information in file"
    Use comma as separator.
    file saved in desktop as csv file.
    2. I opend the saved file in notepad and modify the data.
    3. Go to Planning Book, click on "Upload data"
    Select file name and check it and then click on "Upload File".
    Upload is successful..but interestingly : System doesn't show modified data or even old data.
    All data are deleted and Planning book is blank.
    Any thought on this issue?
    Thanks,
    Vipul Shah

    Hi
    There is the same problem in SCM 5.1 and there is a note fix for it:
    [1131260 - Excel Upload not Working Properly|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1131260&nlang=EN&smpsrv=https%3a%2f%2fwebsmp103%2esap-ag%2ede]
    However this is down as relevant only for 5.1 but I am sure it will fix 5.0 as well. It may be worth opening an OSS Message on this point.
    Regards
    Ian

  • In KP26 excel uploading not happening with +new values+

    Kp26 the users  is doing thorugh EXCEL upload
    wants to update NEW activity  values even if Costs already posted ?
    But manually we are able to delete the values and update, but for large employee turnovers
    we cannt do it manually, so they are looking for update option which will
    erase the current data and update the fresh ones?
    the following error message appears when we try with delete button?
    The following is the error message
    Costs already posted under cost element SEC_ACT_CO. No deletion possible
    Message no. K8098
    Diagnosis
    You want to delete business process or cost center/activity type 5000010114/LE6047.
    However, you have already posted actual costs in version 0 in fiscal year 2011 under cost element SEC_ACT_CO.
    System Response
    The deletion may therefore not be executed.
    Procedure
    First reverse the posted record under cost element SEC_ACT_CO.
    Alternatively you can set all fields to zero in the plan record you have just selected. This corresponds to a deletion of the activity types/business process quantity planning on object 5000010114/LE6047.
    If the message appears several times in the error log, it could be that the actual records were posted under different transaction currencies. In this case, you must delete them all.
    Edited by: melgibson on Feb 1, 2012 4:08 PM

    thankx for the reply
    But in our case the while we checked periodwise values are not the difference which are getting posting
    rather 100 is getting multiplied with the old values.
    the Acvtivity price  was 10 for 01 to 12 periods we changed to 100
    New value     old value      posted amounts
    100     7.37     73.7
    100     7.36     73.6
    100     7.31     73.1
    100     9.5     95
    100     9.9     99
    100     11.23     112.3
    100     11.22     112.2
    100     11.22     112.2
    100     11.22     112.2
    100     11.23     112.3
    100     11.22     112.2
    100     11.22     112.2
    the user changes period values some times thats the reason above table shows different figlures
    But as per the delta logic it should be as follows
    New value     old value      User rquires
    100     7.37     100     
    100     7.31     100
    100     9.5     100
    100     9.9     100
    100     11.23     100
    100     11.22     100
    100     11.22     100
    100     11.22     100
    100     11.23     100
    100     11.78             100
    100     11.22      100
    But here the requirement is little peculiar,
    The user wants to update plan data , irrespective whether it is existing or not, with fresh
    figures which should equally distribute periodwise (not according to delta logic)  as shown above
    all should become 100?
    How that can be achieved?
    Edited by: melgibson on Feb 3, 2012 11:59 AM
    Edited by: melgibson on Feb 6, 2012 1:09 PM
    Edited by: melgibson on Feb 15, 2012 8:43 AM
    Edited by: melgibson on Feb 15, 2012 8:47 AM

  • Excel uploading does not open excel file

    Hi!
    On customer site users try to upload tables of docs and reports via standart MS Excel upload functionality, B1 saves data in txt file but does not open MS Excel with auto_open macro - what could be the reason?

    Dear ,
    For your issue, kindly check Note-542663 below:
    Symptom
    When exporting a file to Excel the program opens, but the exported file
    itself doesn't open automatically although an "AutoOpen" file exists.
    Other terms
    export, Excel, tools, options, auto open, file, document, office, macro,
    ignore, application, Office97, Office2000
    Reason and Prerequisites
    In Excel the options "Ignore Other Applications" and "Protection from
    Macro Viruses" are set.
    Solution
    To remedy this problem you should deselect the following :
    "Ignore Other Applications" and "Protection from Macro Viruses" options
    in the Excel program.
    For Microsoft Office 2000
    in order to de-select the tick-box "Ignore Other Application" :
    1.  On your desktop go To: "Start -> Programs -> Microsoft Office ->
         Microsof Excel
    2.  In Excel go to:"Tools->Options-> General" Tab.
    3.  De-select the tick-box "Ignore Other Applications"
    In order to de-select the "Portection from Macro Viruses"
    1.  In Excel go to:"Tools-> Macro->Security"
    2.  Set the security level to "Medium".
    For Microsoft Office97:
    1.  In Excel go to:"Tools->Options->General" tab.
    2.  De-select the tick-box "Protection from Macro Viruses".
    You could also refer to note  941266 &  540054 for reference.
    Wish the information above is helpful for you.
    Regard
    Apple

  • 7KEX Flexible Excel Upload

    I need to upload an Excel file with the transaction 7KEX, but i do not know how to do it. How to configure the input file.
    If you have ever come across with "flexible excel upload" transactions, could you please provide a sample code of the Z program which you have witten to interpret the values from excel and for posting those values?

    Hi!
    Here some more information about the report S_ALR_87013336
    . This report belongs to the group of drill-down/interactive reports.
    This means that those reports are always aggregating/cumulating account
    values in the following way:
    'From'-Period: 0  (this is hard-coded in the system and cannot be
                      influenced by the selection criteria in the field
                      'From period')
    'To'-  Period:    selected period in the selection criteria.
    This is because the drill-down reports like S_ALR_87013336 should
    provide the ability to show the stock values of the BALANCE SHEET
    accounts ands so it has to accumulate the values from period 0 to the
    selected period. Furthermore, report S_ALR_87013336 shows only values
    for balance sheet accounts.
    Please also consider the attached note 180906 which explains the
    different update logic for the periodic data transfer programs, namely,
    1KEH, 1KEK, 1KEI and 1KEJ. I am sure your postings you mentioned have
    been made by any of these periodical transfer programs.
    So please consider the described update logic of the tables GLPCA (line
    items) and GLPCT (totals table). So if you want to see the balance over
    the periods 1 - 12 in TN KE5Z you only have to inout in the period
    field in TN KE5Z 12 - 12 and NOT 0 - 12.
    BR
    Werner

  • Field merge via Excel upload?

    I decided to create a new string for this question, though I had found a related article where I initially made a posting (I can't now edit or delete my original posting - "actions" menu doesn't open for me, PC and Mac, Chrome and FF):
    Using Field Merge to Dynamically Display an Image
    The post above outlines pretty much exactly what I want to do, but I'm missing something -
    Here is what I'd like to do: I have some customer information that I want to merge to an email; the information is not something I want to necessarily retain with my contacts.
    We're using Excel to upload lists, as these are contacts not currently in our database. I created a new field merge, and inserted the merge into my email. Creating the field merge requires linking the merge to either Contacts, Accounts, Events/Event Sessions, or CDOs. My original assumption was that I'd need to create a CDO, which I did. So I created the field merge, tied it to my CDO, and inserted the field into the email.
    When I then go to test the email, I upload my test segment. In matching fields, I can't match the additional customer data fields from Excel to fields in Eloqua - I had thought maybe the CDO fields would appear as options for matching.
    So, my question is, how do I get the Excel data to match up to my merge field in Eloqua?
    Thanks for any help you can give!
    Colin

    Here was the outcome:
    You can't perform a merge via Excel upload (ie - trying to create a new segment via upload that contains data to be merged) - I was on the right track, that this needs to be done via CDO.
    1. Create your CDO, upload your Excel file, and map contacts to the data card
         - Create a new CDO, adding the extra fields you want to capture
         - Specify "Email Address" in the Display name, Unique ID and Email Address fields. I also set the Group By field to Email Address, and the Entity type as Contacts with field again set to Email Address.
         - When uploading your Excel file with the records you want to merge, make sure to map the uploaded contacts to the data card (Custom Object > Upload Custom Object Records). In the resulting wizard, in step 4 - Upload Actions, be sure that the Map data card checkbox is checked. Not real sure why you'd ever not want this - it seems to me you can't do much without it.
    2. Create your field merges Email Field Merges
         - map these to your CDO fields
    3. Insert the field merges into your email
    That's about it - if anyone has additional info or corrections on the above, let me know. Hope this helps -
    Colin

Maybe you are looking for

  • Remote Control and MediaSourc

    I hava an Audigy 2 ZS Platinum Pro. I formated my HD last night and reinstalled XP. I then installed the new drivers and Media Source 5 and new DTS Neo plugin. But when I tried to install the old Remote Control plugin, it didn't work, it said I don't

  • Statusformat=xml in Reports6i

    Reports9i servlet has a parameter statusformat=xml which allows you to get back jobid and some statusinformations after starting them over web. Are there any plans backport and incorporate this in a current Reports6i patch? This would help us a lot!

  • When I right-click on a link, can I have "open in new window" first, like it used to be?

    I prefer to open in new window when I right-click on a link. In this new version of firefox, open in tab is now on top. Can I have open in new window the first of the options?

  • How can I get IMAQ ReadFile to read a folder of images?

    Hi, So I did read a previous post on an error message of "IMAQ ReadFile access is denied." I think mine is the same one: Error -1074395992 occurred at IMAQ ReadFile   File access denied. Possible reason(s): IMAQ Vision:  (Hex 0xBFF604A8) File access

  • Asset transfer report - for-each-group

    - <FAS430> - <LIST_G_SETUP> - <G_SETUP> <COMPANY_NAME>ABCD</COMPANY_NAME> <LOCATION_FLEX_STRUCTURE>101</LOCATION_FLEX_STRUCTURE> - <LIST_G_ASSET_TRANS> - <G_ASSET_TRANS> <ASSET_NUMBER>1321780</ASSET_NUMBER> <ASSET_DESCRIPTION>CABLES & CONNECTORS</ASS