Travel Expense Form attachment in decision workitem

Hi all,
I have converted travel expense report to pdf file format. I used the following logic to attach the pdf file to attachment object container in the workflow
When i run the workflow attachment is there in decision workitem when i open that it is giving error that 'There was an error opening this document. The file is damaged and colud not be repaired'. Please help me
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = mi_rqident
no_dialog = space
dst_device = mstr_print_parms-pdest
importing
pdf_bytecount = mi_bytecount
tables
pdf = mtab_pdf
exceptions
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
others = 12.
DATA: office_object TYPE swc_object.
DATA: BEGIN OF SOFM_KEY,
         FolderType LIKE SOFM-FOLTP,
         FolderYear LIKE SOFM-FOLYR,
         FolderNumber LIKE SOFM-FOLNO,
         Type LIKE SOFM-DOCTP,
         Year LIKE SOFM-DOCYR,
         Number LIKE SOFM-DOCNO,
         ForwarderName LIKE SOUB-USRNAM,
       END OF SOFM_KEY.
  DATA: REGION LIKE SOFD-FOLRG.
  DATA: FOLDER_ID LIKE SOODK.
  DATA: L_FOLDER_ID LIKE SOOBJINFI1-OBJECT_ID.
  DATA: DOCUMENT_DATA LIKE SODOCCHGI1.
  DATA: DOCUMENT_INFO LIKE SOFOLENTI1.
  DATA: OBJECT_CONTENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
  DATA: OBJECT_CONTENT_HEX LIKE SOLIX OCCURS 0 WITH HEADER LINE.
  DATA: LINES LIKE SY-TABIX, DOCUMENT_TYPE LIKE SOODK-OBJTP.
*- set default
  IF DOCUMENT_TYPE IS INITIAL.
    DOCUMENT_TYPE = 'PDF'.
  ENDIF.
*- create office object
*-- get dark folder
  REGION = 'B'.
  CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
       EXPORTING
            REGION                = REGION
       IMPORTING
            FOLDER_ID             = FOLDER_ID
       EXCEPTIONS
            COMMUNICATION_FAILURE = 1
            OWNER_NOT_EXIST       = 2
            SYSTEM_FAILURE        = 3
            X_ERROR               = 4
            OTHERS                = 5.
  IF SY-SUBRC NE 0.
   MESSAGE E696
           RAISING ERROR_SOFM_CREATION.
  ENDIF.
*-- create office document
  DOCUMENT_DATA-OBJ_NAME = 'ATTACHMENT'.
  DOCUMENT_DATA-OBJ_DESCR = 'Travel Expense Form'
  DOCUMENT_DATA-OBJ_LANGU = SY-LANGU.
  OBJECT_CONTENT[] = mtab_pdf[].  "NOTE_TEXT[].
object_content_hex[] = IT_SIMULATION_DATA[].
  DESCRIBE TABLE OBJECT_CONTENT LINES LINES.
DOCUMENT_DATA-DOC_SIZE = ( LINES - 1 ) * 255 + STRLEN( OBJECT_CONTENT ).
  L_FOLDER_ID = FOLDER_ID.
  if object_content[] is initial.                    
    describe table object_content_hex lines lines.   
    document_data-doc_size = lines * 255.            
  endif.
  call function 'SO_DOCUMENT_INSERT_API1'
    exporting
      folder_id                  = l_folder_id
      document_data              = document_data
      document_type              = document_type
    importing
      document_info              = document_info
    tables
      object_content             = object_content
      contents_hex               = object_content_hex 
    exceptions
      folder_not_exist           = 1
      document_type_not_exist    = 2
      operation_no_authorization = 3
      parameter_error            = 4
      x_error                    = 5
      enqueue_error              = 6
      others                     = 7.
  if sy-subrc ne 0.
message e696(wl)                             
           raising error_sofm_creation.
  endif.
*- set export parameter
  SOFM_KEY = DOCUMENT_INFO-DOC_ID.
  swc_set_element CONTAINER 'ATTACH' office_object.

adobe reader verson 8 only but still I am getting the same error.
I am trying to pass the pdf tabel data to contents_hex to the FM SO_DOCUMENT_INSERT_API1 but both are having different sturctures. How can sove this problem. I download the pdf table data to pdf file in the pc and again uploaded the pdf file into contents_hex table structure and called the FM SO_DOCUMENT_INSERT_API1, But the work item step in backgroup process download and upload are not working out.
Please help me out

Similar Messages

  • Displaying Travel Expense form as attachment to UWL workitem

    Hi experts,
    We have customized the travel expense workflow that is WS20000040.
    When the requestor raises a travel expense request it goes to the manager for approval in his UWL.
    There by default, according to the standard functionality, when approver clicks the particular work item, he can see an attachment attached to the work item, which on clicking, leads to transaction PR05.
    Within that transaction when he clicks 'Travel Details' only then he can see the PDF for travel expense form.
    Our requirement is, instead of opening the transaction, the PDF should open directly as soon as the approver clicks the link.
    Please help.
    Regards,
    Pranita

    Dear Pranita
    I hope you are well and many thanks for using the SAP Discussion Forums .
    In relation to the scenario that you have described you mentioned the following:
    You have customized the travel expense workflow that is WS20000040.
    When the requestor raises a travel expense request it goes to the manager for approval in his UWL.
    Your requirement is, instead of opening the transaction, the PDF should open directly as soon as the approver clicks the link.
    Ok firstly a point to highlight here is have you attempted to reproduce this issue in more than one browser type? Also is compability mode currently enabled on the web browser platform that you are utlizing.
    Ok in terms of background functionality and the underlying operations of this scenario the predefined actions which occurs once a workitem is clicked in the UWL depends on XML configuration or via the SWFVISU transaction.  By default, the item type configuration for the corresponding work items is set to launch the expense report form.
    If you analyze the UWL configuration file and the travel expense XML e.g. com.sap.pct.erp.ESS/MSS - from UWL administration page, you should be presented with the following:
    ** SAMPLE **
    WS20000040
    <ItemType name="uwl.task.webflow.decision.TS20000131.ECCCLNT100" connector="WebFlowConnector" defaultView="com.sap.pct.erp.mss.tra.view.TripApprovalView" defaultAction="com.sap.pct.erp.mss.tra.action.DisplayExpenseForm" executionMode="default">
    <ItemTypeCriteria systemId="ECTCLNT140" externalType="TS20000131" connector="WebFlowConnector"/> <CustomAttributes>
    You should be able to set the predefined open action here.
    Also there are two key points to remember when you are working with XML files.
    XML files and the UWL follow the notion of precedence. Therefore once you make a change in the UWL XML the file needs to be reuploaded with a new priority of high in order for changes to come into effect and the UWL Cache needs to be cleared.
    XML files should be backed up and copied so changes can be reverted easily if required.
    Kindly update me as per your findings.
    Kind Regards & All The Best
    Troy Cronin - Enteprise Portal Support Engineer

  • FI-TV: Printing travel expenses form

    Dear experts,
    If I try to print the travel expenses form (SAP ECC 6.0), the windows printers are displayed instead of SAP printers. How can I correct this?
    Thank you in advance,
    Vana Sounta

    Hi,
    Check in user settings- which default printer is set. ADjust as required.
    Regards
    Hein

  • Error initiating travel expense form

    Dear Guru's,
    We have an issue displaying the Travel Expense form in ESS. We are not using the PDF forms but the HTML , no ADS has been set up and followed the exact steps mentioned in SAP Note 1032311. So we deleted the URL parameter in the URL parameter from the resource and set the PDC path as a non-static URL to the tripform. We deleted also the Iview property ....UsePDF=true.
    Next we changed the setting in the Travel Management Expert View refering to Adobe Forms from 0 into 1, and we modified feature TRVFE using the SAP form PTRV_EXPENSE_FORM .
    We tested the forms in trx TRIP, PR05 and PR_WEB_1200 and all results were positive since the form is displayed. However using the Iview create travel expenses the ' Error intiating trip forms' remains. The Iview My trips and expenses gives the same negative result trying to display/print the form. However the Iview display trip form seems to do something and is only given the error that the trip parameter for the pernr is missing while previewing it, which is clear since no trip has been selected.
    Help needed.
    Kind regards.

    Please check you have the correct roles assigned for the URL in PCD path as this is a common cause of this type of error
    As per the note..it needs to be;
    ROLES://portal_content/com.sap.pct/every_user/com.sap.pct.erp.ess.bp_fol
    der/com.sap.pct.erp.ess.roles/com.sap.pct.erp.ess.employee_self_service/
    com.sap.pct.erp.ess.employee_self_service/com.sap.pct.erp.ess.area_trave
    l_expenses/com.sap.pct.erp.ess.tripform
    Can you open it from portal in administrator mode?
    Also check note 944221 to check the ADS config.

  • Problem in opening Travel expense form

    Hi All,
    We are using standard workflow (task ID : TS20000118 )for Approve Trip,Approve Travel Request and
    Approve Travel Expense.
    User (Manager) get all the task related to travel request and travel expense in MSS through work flow.
    When user click on Travel request task, the travel request PDF form is open correctly, but when user click on travel expense task , the travel expense PDF form have to open but here also travel request PDF form is open.
    How can i open the Travel expense PDF form when user click on travel expense task.
    can anyone help...?
    Regards,
    Priya.

    Hi,
    Did you get solution for this problem? I am facing same problem.
    Regards,
    Amit

  • Travel Expense Form -- How to identify which form it is using

    Hello,
    In PR05(Travel Expense Manager), there is a simulate button which will generate standard expense form with expense details.
    I ran into scenario where one user group expenseform is little different from another group employees expense form. i am guessing that user group form is customized. how to identify what is behind scene form which is used.
    Thanks

    Thanks for your response. It seems I identified that it is using ABAP LIST forms.
    I confirming that position 24 for other settlement under TRAVEL EXPENSES CONTROL (EXPERT VIEW )
    Now we have issue identifying which underlying ABAP LIST Form used.
    If any body has any information on this how to identify, please provide information.

  • Extract interactive form attachment from workflow workitem

    Hi Friends,
    I created a Webdynpro Java application which has an interactive form.
    The user fills out the form, and submits.
    The submission action triggers a simple workflow and adds the interactive form as an attachment to the workitem. (Using SAP_WAPI_START_WORKFLOW and SAP_WAPI_ATTACHMENT_ADD)
    The new task shows up in UWL with the attached pdf form.
    When user clicks the on the task in UWL, I want to launch another web dynpro application which will read the workitem id and get and display the interactive form in the web dynpro java application.
    How do I extract the interactive pdf form from workflow in binary format?
    so that I can display the form in my Web dynpro java application and bind it to the pdfSource context??

    I thought I could just call the  SAP_WAPI_GET_ATTACHMENTS, however this only returns some docId information for example:
    OBJECT_ID                                                                                DESCRIPT             SHORTTEXT
    SOFM      FOL18          4 EXT34000000000023                                     Office Document      Office Document
    I need to get the binary for this pdf interactive form.
    Edited by: K Ferguson on Jan 16, 2009 5:54 PM

  • Travel Expense Form error

    Hi
    When am creating travel expenses and trying to simulate results its giving following error
    Error while initiating form
    Messege No. 56568
    Thanks
    Neha

    Wel thanks for ur patience n replies.
    I think i need to talk to Basis people for the same. its some form error as in PDF settings.
    i jus noticed one thing noe in TRIP if i right click on the trip in th overview are n select display its opening that form in simulation. but when i click on result button its givin that error while initiating th form. So i think its PDF form error settings.
    Thanks
    Neha

  • Travel Schema is Not Appearing in ABAP WebDynp Travel Expense Form

    Hi Experts,
    We are using FIN_TRAVEL_1 business function for travel management in EHP2.
    We are implementing ESS/MSS services for Travel management and corresponding workflows are working perfect.
    Problem is:
    Travel Req. and its Approval are working perfect but when we create Travel Expenses for the corresponding Approved
    Req. - Travel Schema is Not Appearing in the ABAP webdynpro screen in ESS.
    We have already activated integration of Travel Requets with Expenses in the customizing and changed the corresponding
    settings in the schema also.
    ABAP WebDyn in ESS is working perfect if we direct create a Stand alone Travel Expense Report. We are using only Travel Req.
    and Expenses with Miles/KM cumulation. We are Not going for Travel Planning.
    Pls. let me know - If any Settings are missings in "Expert View" of Travel Control or any Customizing setting is missing.
    Do we have to apply some note or any BADI is there ??
    Very Thanks in Advance...
    Kind Regards,
    Edwin

    Hi there
    You need to make sure that you have a trip schema that does not allow overlapping when creating expense report from approved travel request, also check the bindings for your trip schema.
    I think I may have addressed this in  an OSS to you earlier but also check you are using correct resource for WDABAP as delivered with 1076144 
    I think is why it previously worked in your java landscape if you had the trip schemas with bindings defined in the homepage framework

  • Travle Mgmt : Table used:  travel request & travel expenses form input !!!

    HI
    what are all the tables used to store the travel request details of a particular trip & advance amt  / estimated cost details.
    and also explain : bapi_trip_create_data_from  - how we can include the advance amount  when executing the bapi.
    regards
    Giri

    Travel Request data is stored in tables FTPT_REQ* - look at:
    FTPT_REQ_HEAD
    FTPT_REQUEST
    FTPT_REQ_ADVANCE
    FTPT_REQ_ACCOUNT
    FTPT_REQ_REASON
    Travel Expense data is stored in tables PTRV_* and in the PCL1/TE clusters - look at:
    PTRV_HEAD
    PTRV_PERIO
    PTRV_KMSUM
    PTRV_SADD
    PTRV_SCOS
    PTRV_SHDR
    PTRV_SREC

  • Travel Expense (Portal) - Adobe Form

    Hi:
    We recently implemented Adobe Forms for travel expense booking via portal. For that the necessary ADS configuration and other development changes were made. It is working fine except one issue. When we display/print an existing expense report on portal, it opens in pdf form with ides logo and other standard wording on it. How can we modify that print form to match our template? Where exactly that print form is assigned so that we can customize it?
    Please advise.
    Thanks.
    RG

    Upload your custom form via SFP.. and you can copy the standard travel expense form PTRV_EXPENSE_FORM which I think you already did (check the 2nd and also note 944221 if you have any problems with initiating the travel form)
    http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=233410928
    http://wiki.sdn.sap.com/wiki/display/ERPHCM/CustomizingTravelExpenseforms%28SFP%29
    These wiki links may help
    Edited by: Sally Redmond on Jun 2, 2011 9:23 PM

  • Travel Expense Error in UWL of Manager

    Hi,
    We are using ECC 6.0, Portal 7.0 and the webdynpro versions of ESS and MSS.  We are using the Travel expense and related workflows. When the employee creates a Travel request, an work item for the same is sent to the manager UWL as per the workflow. When we click open the workitem in UWL, it displays a blank screen.
    No error is displayed. Can some one guide as to what is missing.
    Regards
    Jayesh

    Hi All,
    I am getting the below error when i am clicking on the "Display/Print" button on Travel expense form in All my expense iview/ UWL .
    "Error in initiating Travel Expense form"
    All the settings seem to be completed in R3.
    Appreciate if some one can throw light.
    Regards
    Jayesh
    Message was edited by:
            Jayesh Ghodge

  • Travel Expense Amount as default

    Hi,
    I have configured 2 Travel expenses on the receipt basis and set the amount in them as default value. When selecting those 2 expenses while filling the Travel Expense Form the value is coming up but it is editable means the user can change the value set as default in them. Client wants that user should not be able to change that default value.
    How can this be done. Please let me Know.
    Thanks & Regards
    Ritu Goyal
    +91 9891389306

    Hi,
    While you assign default value/maximum amount in the table, assign it twice. For first time assign amount type as "Default Value" and for second one assign amount type "Error Message for Exceeding".
    For Eg: Travel exp type PDTA - Partday travel allowance.
    Default value should be $20
    1) assign as PDTA - Dafault value                             $20
    2) assign as PDTA - Error Message for Exceeding"    $20
    I hope this would help.
    cheers
    Samir

  • Adding customized fields for Travel Expenses

    Hi,
    I would like to add some customized fields for user input during the creation of travel expense form.  Is this possible?  If yes, any advise on the steps to create customized fields for data entry of travel expense form?
    Thanks.

    Hi Yvonne ,
    Thank you for the tip , it was helpfull.
    We are using field BUS_REASON "Business Partners", We changed label for data element but is not showed in TRIP transaction we can see it in PR05 transaction.
    How can I change labels for TRIP transacction?
    We did the change in CMOD transaction
    Thanks.

  • Travel expense approval worklfow

    Hi,
    i have used standard workflow : WS20000040 for travel expenses, i can able to trigger the event when travel expense form created and also i can approve the trip,but i want to know whether it's really got approved or not,please let me know how to check it, whether it is getting updated in any table after approving ..
    Thanks in advance.
    ram

    Hi,
    Please check in the Table  PTRV_PERIO .
    It has all the trip status updation and one of the important table for  all travel related standard reports.
    The fields are  :
    ANTRG     ANTRG     CHAR     1     0     Travel Request or Trip Approved (Indicator)  Travel Request status
    ABREC     ABREC     CHAR     1     0     Open / To be Settled / Settled (Indicator) Travel settlement status.
    Regards,
    Sabari Prabhu.

Maybe you are looking for