cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Payload as input to a PDF document

Former Member
0 Kudos

Hi,

I am reading the payload using function module SXMB_GET_MESSAGE_PAYLOAD and I want to use the Payload to fill my ADOBE form. I thought that it would be sufficient to pass to the pdf the payload but my PDF does not get populated and no error is returned.

I created my form interface with a XSD file of the same format as the payload. I use this interface in my form and I set a data connection with a WSDL file of the same format as the Payload.

Is there a step that I am missing? Can we pass in parameter the payload or we need to do an extra step?

Here the code I am using to call my PDF

  • Get XML output data for Message Id

CALL FUNCTION 'SXMB_GET_MESSAGE_PAYLOAD'

EXPORTING

im_msgkey = l_msgkey

IMPORTING

ex_msg_bytes = l_xstring

EXCEPTIONS

not_authorized

no_message

internal_error

no_payload.

  • Create PDF

CALL FUNCTION l_funcname

EXPORTING

/1bcdwb/docparams = ls_docparams

/1bcdwb/docxml = l_xstring.

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

D037255
Advisor
Advisor
0 Kudos

Hi Steve,

if your Adobe form used an xml based interface, and your xml data are into an xstring variable, then you only need the FP_JOB_OPEN and FP_JOB_CLOSE function modules - please have a look at this example; its working fine:


DATA: gs_outputpara TYPE sfpoutputparams,
        gs_docpara    TYPE sfpdocparams,
        gs_return     TYPE fpformoutput,
        gs_result     TYPE sfpjoboutput,
        gv_form       TYPE fpwbformname VALUE 'Z_TRAVEL_REQUEST',
        gv_function   TYPE rs38l_fnam,
        gv_xml        TYPE xstring,
        gv_data_str   TYPE string.

* create xml data
  CONCATENATE
    `<?xml version="1.0" encoding="utf-8" ?>`
    `<REQUEST>`
    `<CUSTNAME>` gs_request-custname `</CUSTNAME>`
    `<DEPARTMENT>` gs_request-department `</DEPARTMENT>`
    `<KOSTL>` gs_request-kostl `</KOSTL>`
    `<DEPDATE>` gs_request-depdate `</DEPDATE>`
    `<ARRDATE>` gs_request-arrdate `</ARRDATE>`
    `<COUNTRYTO>` gs_request-countryto `</COUNTRYTO>`
    `<CITYTO>` gs_request-cityto `</CITYTO>`
    `<CAUSE>` gs_request-cause `</CAUSE>`
    `<VEHICLE>` gs_request-vehicle `</VEHICLE>`
    `<HOTEL>` gs_request-hotel `</HOTEL>`
    `</REQUEST>`
    INTO gv_data_str.

  CALL TRANSFORMATION id SOURCE XML gv_data_str
                         RESULT XML gv_xml.

* Get the name of the generated function module
  TRY.
      CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
        EXPORTING
          i_name           = gv_form
        IMPORTING
          e_funcname       = gv_function
*         E_INTERFACE_TYPE =
                .
    CATCH cx_root.
      RAISE no_active_form.
  ENDTRY.

* Set parameters
  gs_outputpara-nodialog   = 'X'.
  gs_outputpara-preview    = 'X'.
  gs_outputpara-getpdf     = 'X'.
  gs_outputpara-connection = cl_fp=>get_ads_connection( ).
  gs_docpara-langu         = 'DE'.
  gs_docpara-country       = 'DE'.
  gs_docpara-fillable      = 'X'.


* Open print job
  CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
      ie_outputparams = gs_outputpara
    EXCEPTIONS
      cancel          = 1
      usage_error     = 2
      system_error    = 3
      internal_error  = 4
      OTHERS          = 5.
  IF sy-subrc <> 0.
    RAISE job_open_error.
  ENDIF.

* Call the generated function module
  CALL FUNCTION gv_function
    EXPORTING
      /1bcdwb/docparams  = gs_docpara
      /1bcdwb/docxml     = gv_xml
    IMPORTING
      /1bcdwb/formoutput = gs_return
    EXCEPTIONS
      usage_error        = 1
      system_error       = 2
      internal_error     = 3
      OTHERS             = 4.
  IF sy-subrc <> 0.
    RAISE form_process_error.
  ENDIF.

* Close print job
  CALL FUNCTION 'FP_JOB_CLOSE'
    IMPORTING
      e_result       = gs_result
    EXCEPTIONS
      usage_error    = 1
      system_error   = 2
      internal_error = 3
      OTHERS         = 4.
  IF sy-subrc <> 0.
    RAISE job_close_error.
  ENDIF.

Edited by: Jens Haehnel on Sep 1, 2009 4:19 PM

Answers (0)