Problem attach document with the FileUpload UI.

I am trying to attach a document to a CRM Notification from application Web Dynpro for ABAP, I have build a FM that includes the method
cl_crm_documents=>create_with_file
When I test the FM from SE37 transaction, I am able to attach a file from a local disk succesfully. But If I call this FM from Web Dynpro, trying to do the same operation, document cannot attach to notification and Method returns the following error: “Error loading file ” (Class of message CRM_DOCUMENTS and number 100).
Thanks in advance.
FUNCTION z_crm_anexar_docs_inc.
""Interfase local
*"  IMPORTING
*"     VALUE(GUID) TYPE  CRMT_OBJECT_GUID
*"     VALUE(FILENAME) TYPE  SDOK_FILNM
*"     VALUE(PATH) TYPE  SDOK_CHTRD OPTIONAL
*"     VALUE(DESCRIPTION) TYPE  STRING
  DATA: ls_bor   TYPE sibflporb,
        lv_loio  TYPE skwf_io,
        lv_phio  TYPE skwf_io,
        lv_error TYPE skwf_error.
MOVE: 'BUS2000116' TO ls_bor-typeid, "aqui le pasamos el tipo de objeto que estemos tratando
        'BO'         TO ls_bor-catid,
        guid         TO ls_bor-instid.
  DATA: wa_result_tab TYPE string.
  DATA: result_tab TYPE STANDARD TABLE OF string.
  DATA: lin TYPE i.
  DATA: long_nombre TYPE i.
  DATA: long_total TYPE i.
  DATA: desplazamiento TYPE i.
  DATA: filename_aux TYPE skwf_descr.
  SPLIT filename AT '' INTO TABLE result_tab.
  DESCRIBE TABLE result_tab LINES lin.
  READ TABLE result_tab INDEX lin INTO wa_result_tab.
  IF sy-subrc EQ 0.
    long_total = STRLEN( filename ).
    long_nombre = STRLEN( wa_result_tab ).
    desplazamiento = long_total - long_nombre.
    path = filename(desplazamiento).
    filename = wa_result_tab.
    filename_aux = wa_result_tab.
  ENDIF.
aqui le pasamos el guid del documento sap crm que estemos tratando
  CALL METHOD cl_crm_documents=>create_with_file
    EXPORTING
    aqui le pasamos el nombre del fichero que queremos anexar
      file_name       = filename
    'c:' "aqui le pasamos la ruta del fichero que queremos anexar
      directory       = path
      business_object = ls_bor
    IMPORTING
      loio            = lv_loio
      phio            = lv_phio
      error           = lv_error.
aqui llamamos a este método porque de lo contrario el sistema crea el anexo con el nombre que
le da la gana y no con el que hemos indicado en el punto anterior. por eso renombramos el fichero
  CALL METHOD cl_crm_documents=>rename_object
    EXPORTING
      is_io   = lv_loio
      iv_name = filename_aux.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait = 'X'.
  IMPORTING
    RETURN        =
ENDFUNCTION.
Call from WDA.
  CALL FUNCTION 'Z_CRM_ANEXAR_DOCS_INC'
    EXPORTING
      guid              = guid_jarcode
    guid              = stru_importing-guid
      filename          = stru_importing-filename
    PATH              =
      description       = stru_importing-description.
ENDMETHOD.
Thanks in advance.

Hi,
you can use below steps,
1. Create attribute file_content of type xstring and bind it to data attribute of FileUpload UI .
2.Put the button Upload next to your FileUpload UI element and write action upload.
3. in action, read the attribute file_content and pass it to below code
Convert XString to String
  CALL METHOD cl_abap_conv_in_ce=>create
    EXPORTING
      input       = file_content
      encoding    = 'UTF-8'
      replacement = '?'
      ignore_cerr = abap_true
    RECEIVING
      conv        = loc_conv.
*Read the file contents
  TRY.
      CALL METHOD loc_conv->read
        IMPORTING
          data = file_content_string
    CATCH cx_sy_conversion_codepage.
*-- Should ignore errors in code conversions
    CATCH cx_sy_codepage_converter_init.
*-- Should ignore errors in code conversions
    CATCH cx_parameter_invalid_type.
    CATCH cx_parameter_invalid_range.
  ENDTRY.
4. After that u may want to put the contents into internal table so use
  SPLIT file_content string AT crlf INTO TABLE itstring_tab.
5. At last, fill the internal table
loop AT it_string_tab INTO wa_string.
    CHECK sy-tabix GT 1 .    "skip the first line
    SPLIT wa_string AT ',' INTO .....
endloop.
here in my code i have splitted the contents at comma as i had .csv file . so based on file type u can split it and fill internal table.
hope this will help you.
Regards,
Chandra
(Award points if Helpful)

Similar Messages

  • I have a Word doc with lots of Excel/Pdf attached doc inside. Can I convert this word doc in PDF keeping the attached documents inside the PDF? or do I have to attach all af them again? thank in advance

    I have a Word doc with lots of Excel/Pdf attached doc inside. Can I convert this word doc in PDF keeping the attached documents inside the PDF? or do I have to attach all af them again? thank in advance

    Attach all of them again.
    Be well...

  • WORKAROUND: "A document with the name 'vnd.ms-excel' is already open"

    I'm posting this in the hope that it might help someone else (or that someone else might suggest a better solution)...
    I'm using the technique described in the Integrating Oracle Reports in Oracle Forms Services Applications white paper. Basically, this means using RUN_REPORT_OBJECT to generate a report, and then navigating to a URL of the form...
    http://<host>/reports/rwservlet/getjobid<n>?server=<name>...to show it.
    I had the requirement that some reports (with DESFORMAT=DELIMITEDDATA) needed to open in Excel, so for these reports I added the MIMETYPE command to the URL, so that it was of the form:
    http://<host>/reports/rwservlet/getjobid<n>?server=<name>&mimetype=application/vnd.ms-excelThis appeared to work, but only for one report at a time. I could generate one report this way, and when I navigated to its URL, the report would be displayed by Microsoft Excel within a new browser window as expected. However, if I left the browser window open, then generated a second report and navigated to its URL, a new, empty browser window was displayed, but a "Microsoft Excel" message box appeared with the following message:
    A document with the name 'vnd.ms-excel' is already open. You cannot open two documents with the same name, even if the documents are in different folders.
    To open the second document, either close the document that's currently open, or rename one of the documents.
    When I chose OK (the only button), the message box closed, but the new browser window remained empty.
    If Excel was already running to begin with, the message box was obscured behind other windows, and the new browser window remained empty and appeared to never finish loading (because it was waiting for a response from the message box). The message box only appeared if I explicitly navigated to Excel (for example, using the taskbar). When I chose OK, a "File Download" dialog appeared, followed by a message box that reported the following:
    Microsoft Excel for Windows has encountered a problem and needs to close. We are sorry for the inconvenience.
    When I closed this message box, Excel shut down.
    I could not find this documented anywhere, but it appears as if Excel interprets the text after the last "/" in the URL as the file name. In my case, this was the same text every time (specifically "vnd.ms-excel"), which caused problems because Excel does not allow you to open two files with the same name.
    My workaround was simply to add the "JOBNAME=/<n>" command (where <n> is the job ID) to make the text after the last "/" unique (at least in my case). In other words, by using a URL of the form...
    http://<host>/reports/rwservlet/getjobid<n>?server=<name>&mimetype=application/vnd.ms-excel&jobname=/<n>...I was able to avoid the problem. For example, for job ID 123, the URL would be...
    http://<host>/reports/rwservlet/getjobid123?server=<name>&mimetype=application/vnd.ms-excel&jobname=/123...and Excel would interpret the file name as "123".
    Hope this helps.

    Thanks for posting, this solution worked!

  • Problem in query with the u0091Document numberu0092

    Hi,
    I got problem in query with the ‘Document number’
    There are three columns in the cube 1) Document number 2) Country 3) Count
    In the cube there are multiple entries for same document number as below.
          Document number            country          Count
         10000               US          1
         10001               US          1
         10002               US          1
         10002               US          1
         10002               US          1
         10003               UK          1
         10004               IN          1
         10004               IN          1
    When I ran the query on this cube for country US it shows count as 5 but I want count as 3 (i.e. it has to take count only once for the same document no’s)
    Similarly for country IN I want count as 1

    Hi,
    You have to create a counter based on the document number (exception aggregation). There is a How-to paper available for this. It is called: How-to...count the occurences of a characteristic.
    Regards,
    P.

  • Why can't I open a document with the password

    why can't I open a document with the said right password!!!! !

    Hi Anthony,
    What problem are you facing in opening the document? Is there any error message?
    I would recommend you to try again and as passwords are case sensitive so please make sure that you type the password in exactly same case sequence as you did when you set the password.
    Regards,
    Rahul

  • PA30, attaching documents through the employee personal master dat

    Dear freinds,
    We are attaching documents through the employee personal master data
    PA30, Our client wants to know where exactly these attachments are
    getting saved; Our SAP environment is ECC6.0 on AIX 5.3. so i exactly would like to know what is the exact path where these documents are getting saved on AIX machine.
    I would appreciate if you can tell us where exactly these documents are
    getting saved at OS level, any particular file system you think,
    because I probed in but couldnu2019t find where exactly there are on the
    OS..
    Regards
    ayush

    hello,
    SAP generally recommends that you store employee documents with a bar code. You can find the documentation to 'Storage Within Personnel Administration' using the following path:
    => Help => SAP Library => Human Resources => Personnel Management (PA)=> Personnel Administration (PA-PA) => Storage Within Personnel Administration (PA-PA)
    In the SAP Standard it is not possible to tie original documents to specific personnel numbers in the PA30 transaction. The only exceptions are two specific scenarios where you can tie original documents in the PA30 transaction:
    1. late storing with bar code
    2. late storing without bar code
    During both scenarios you start out in the Trx PA30. If the bar code entry is deactivated the actual key data will have to be transferred to the document in any case, otherwise you will be asked to enter a barcode again. Therefore the document would be transferred to the scanning location and then assigned to a specific business object.
    Unfortunately it is NOT possible to upload a document directly into archive in the PA30 any other way.
    Let me emphasize once more that PA30 can not be used for storing infotype specific documents. Via the special scenarios mentioned already by my colleague you are able to assign documents to the specific infotypes but the storing has to be completed outside of PA30.
    Using the option Extras -> Assign facsimile in PA30 will be interpreted by the system as start for late scanning with barcode thus the error message.
    Hope this help
    Sarah

  • I am having a problem opening pdf files.  I get an error message saying   a problem has occurred with the licensing of this product. Restart your computer and re-launch your product. If this problem still occurs after restarting ... error code:213:19  Can

    I am having a problem opening pdf files.  I get an error message saying
    a problem has occurred with the licensing of this product. Restart your computer and re-launch your product. If this problem still occurs after restarting ... error code:213:19

    Hi AdobeFiles,
    I'm sorry to hear that you're unable to open PDF files. Please see this Help document: Error 213:19 | Problem has occurred with the licensing of this product | Acrobat X and XI for solutions.
    Let us know how it goes!
    Best,
    Sara

  • I have an alert message in disc utility. Error: storage system verify or repair failed. Problems were found with the partitian map which might prevent booting.

    While running verify disc in disc utility on 251 GB SSD SM256c Media I came up with this message: Alert system verify or repair failed. In the descriptions box of history it said, problems were found with the partitions map which might prevent booting. This is followed by a message in red reading, Error: Storage system verify or repair failed. At the time I was down loading raw pictures off my camera through a card reader across my computer to a relatively new 2TB Western Digital portable hard drive. after about 13 to 15 pictures downloaded that drive faileded. My Mac Book Air works fine, but i get this message now everytime I run disc verify on this disc. The Macintosh HD checks out fine.

    While running verify disc in disc utility on 251 GB SSD SM256c Media I came up with this message: Alert system verify or repair failed. In the descriptions box of history it said, problems were found with the partitions map which might prevent booting. This is followed by a message in red reading, Error: Storage system verify or repair failed. At the time I was down loading raw pictures off my camera through a card reader across my computer to a relatively new 2TB Western Digital portable hard drive. after about 13 to 15 pictures downloaded that drive faileded. My Mac Book Air works fine, but i get this message now everytime I run disc verify on this disc. The Macintosh HD checks out fine.

  • Hi! I can't upgrade my iTunes 10.3.1.55 on my Windows XP 2002 SP3 to the latest version of iTunes. Got the message: "A problem has occured with the Windows Installer-package. A program needed for this installation could not be run." What to do?

    Hi! I can't upgrade my iTunes 10.3.1.55 on my Windows XP 2002 SP3 to the latest version of iTunes. Got the message: "A problem has occured with the Windows Installer-package. A program needed for this installation could not be run." What to do?

    Perhaps let's first try updating your Apple Software Update.
    Launch Apple Software Update ("Start > All Programs > Apple Software Update"). Does it launch and offer you a newer version of Apple Software Update? If so, choose to install just that update to Apple Software Update. (Deselect any other software offered at the same time.)
    If the ASU update goes through okay, try another iTunes install. Does it go through without the errors this time?

  • Issue in printing the batch document with the T-code COPI

    Issue in printing the batch document with the T-code COPI.
    So Batch document is not printing not printing.
    Kindly help.

    I would suggest to read this blog as a starting point: Asking Good Questions in the SCN Discussion Spaces will help you get Good Answers
    then rephrase and enhance your question with some facts because in the moment it is not at all sufficient enough for anybody to help you further on your particular issue.
    I am even in doubt that you posted this issue in the right forum, has this PP transaction really something to do with ABAP Connectivity. Check the space overview page of ABAP Connectivity , under the picture you can read what this space is about.

  • I am trying to save a document with the new pages and it will only save as a zip file any ideas on how to change this?

    I am trying to save a document with the new Pages and it is only saving as a ZIP file anyone know how to fix this or choose a different file type?

    Take a look at the FileSelector
    First make sure the FileSelector is expanded so you can see the directory and sidebar. That's what the little disclosure triangle up by the filename is for. Once the FS has been expanded to look like the above picture, look to see what subdirectory has been selected. Use the SideBar to select an appropriate one.

  • Why does my iPhone 4 not charge correctly?  Problem is definitely with the phone and not charges or chords.  Phone will charge but very slowly and no icon comes on.  Computer and iTunes doesn't recognize it a being connected.

    My iPhone 4 quit charging correctly.  It does charge but very slowly and icon doesn't indicate it as charging.  I've checked cables and charges and the problem is definetily with the phone.  My car stereo no longer recognizes it as a device.  Neither does the computer.  The real strange thing to me is that when I plug it into my old klispch speaker dock it will play songs.  My battery life is good when it is charged so I don't think its the battery. I've tried resetting the phone and cleaning the charging port.  I'm out of warranty.
    Would disconnecting the battery possibly reset it from some glitch or is the charging port got some bad contacts?

    I checked with the Genius Bar.  It was a new dilema to the lady that was helping me.  She took it to a back room and worked on it but it came out the same.  She gave me some options for repair or credit for replacement.
    I just kept the phone and put up with slowly charging it by plugging it in and then turning it off.
    I couldn't transfer anything from itunes.
    I finally got fed up and bought a new charging port for $10. and a toolkit for $3.  I looked up a video on youTube for the replacement and did it.
    That solved all the problems, it was the charging port, must have been some bad pins or something because it patially worked.

  • Having installed an upgrade for Photoshop Elements 13, I cannot open the application. I get an error message saying "Adobe Photoshop Elements Editor cannot be opened because of a problem. Check with the developer to make sure Adobe Photoshop Elements Edit

    Having installed an upgrade for Photoshop Elements 13, I cannot open the application. I get an error message saying "Adobe Photoshop Elements Editor cannot be opened because of a problem. Check with the developer to make sure Adobe Photoshop Elements Editor works with this version of OS X. You may need to reinstall the application. Be sure to install any available updates for the application and OS X".
    I have since uninstalled and reinstalled the app, but get the same error message.

    Which version of OS X do you have? It's not clear from your post whether "installed an upgrade" means you just installed PSE 13 as an upgrade or you installed an update to PSE 13, like ACR 9 or 13.1. Please clarify.

  • How to map the elements in Indesign document with the PDF elements

    I wanted to know any way of mapping elements in the InDesign document with the elements in the exported PDF document from the same InDesign document.
    E.g If I have an Image X in InDesign document, Can I point out the same element in exported PDF using some mapping?
    Thanks in advance
    -Sandeep

    What is meant by me is, if there is a Text element in InDesign document, I should able to point out the respective PDF object.
    I am looking for some way to mark a specific InDesign element and once we export the document to PDF, I want to point out to the same element in some way so that I can process it.
    Requirement is simple, one user will mark some elements in the InDesign document and export it to PDF and send it to the other user. Other user will parse the PDF and extract the same element back or process it and use it.

  • Hi there, I cannot open bridge and I get this warning, "Adobe Bridge Cannot be Opened because of a problem. Check with the developer to make sure Adobe Bridge CC works with this version of Mac OS X. You may need to reinstall any updates for this applicati

    Hi there, I cannot open bridge and I get this warning, "Adobe Bridge Cannot be Opened because of a problem. Check with the developer to make sure Adobe Bridge CC works with this version of Mac OS X. You may need to reinstall any updates for this application and Mac OS X" although bridge has been running on my Mac for over a yera. I have installed all current updates for Mac and reinstalled Bridge again from CC and still get the same issue? Any advice?

    Would you please provide details about your setup?
    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    etc.,
    someone may be able to help you (not necessarily this poster).
    a screen shot of your settings or of the image could be very helpful too.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

Maybe you are looking for

  • Firefox 19 crashes (shuts down) for no apparent reason (3 windows & multiple tabs open, too many?) never was a problem before

    4 gb ram, using up to date Win 7 and Norton . Notice no pattern but perhaps it could be Adobe related (also up to date) since I have had Adobe PDF's open and/or downloading.

  • Values to IDoc fields

    Hi all, I am doing a JDBC to IDoc scenario. In my message mapping, IDoc is the target message. This IDoc has many nodes named <b>SEGMENT</b>. In the occurences column, these <b>SEGMENT</b> nodes have the value "<b>required</b>". But i am not knowing

  • Passing BPM presentation object global activity

    Hello, I would like to pass a BPM presentation object from a JSP page to global actiivity using openGlobal() method. Do you know if this is possible? Any examples available you know? Thanks & Regards.

  • Read Statement antwork

    Hi All, I am having one record in it_vbrk table and in it_vbrp table i am having three records with same vbeln with three items. Loop at it_vbrk into wa_vbrk. Move: XXXX to XXXX Read table it_vbrp into wa_vbrp with key vbeln = wa_vbrk-vbeln. if sy-su

  • Trying to draw a diamond shape from a shape - Please help !!!

    Hi, I am trying to draw a diamond shape from a custom shapes library but having a hard time getting it to shape accurately, the shape I am trying to draw should look like this : If someone can teach me some photoshop techniques as to how to get all t