Skip to Content
avatar image
Former Member

"Usage error" in badi IF_EX_EXEC_METHODCALL_PPF~EXECUTE

Hi experts,

I have implemented this BAdi, and I use it in actions in order to print / mail / fax PDF forms.

Here is a code snipplet:

-


" calling PDF form

CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'

EXPORTING

i_name = ls_fp_name

IMPORTING

e_funcname = ls_fp_funcname

" E_INTERFACE_TYPE =

.

ls_fp_outputparams-nodialog = 'X'.

ls_fp_outputparams-getpdf = 'X'.

CALL FUNCTION 'FP_JOB_OPEN'

CHANGING

ie_outputparams = ls_fp_outputparams

EXCEPTIONS

cancel = 1

usage_error = 2

system_error = 3

internal_error = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ls_fp_docparams-langu = 'E'.

ls_fp_docparams-country = 'EN'.

CALL FUNCTION ls_fp_funcname

EXPORTING

/1bcdwb/docparams = ls_fp_docparams

output_options = ls_output_options

order_num = order_id

" description =

partner_1 = ls_partner_1_details

partner_2 = ls_partner_2_details

emp_resp_name = emp_resp_name

item = ls_item

veh_details = ls_veh_details

taxnumber = taxnumber

bank_account = bank_account

days_text = days_text

" IMPORTING

" /1BCDWB/FORMOUTPUT = ls_formoutput

EXCEPTIONS

usage_error = 1

system_error = 2

internal_error = 3.

IF sy-subrc <> 0.

CALL FUNCTION 'FP_GET_LAST_ADS_ERRSTR'

IMPORTING

e_adserrstr = last_ads_error_string.

rp_status = 2.

ELSE.

rp_status = 1.

ENDIF.

CALL FUNCTION 'FP_JOB_CLOSE'

" IMPORTING

" E_RESULT =

EXCEPTIONS

usage_error = 1

system_error = 2

internal_error = 3

OTHERS = 4

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Here if I debug the BAdI I always get "Usage error" exception at FM - CALL FUNCTION ls_fp_funcname.

If I remove FP_JOB_OPEN, everything is working fine, but I have to use FP_JOB_OPEN, because I would like to send the pdf form as email.

What could be the problem, do you have any idea?

Thanks!

Gabor

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jan 24, 2008 at 07:39 AM

    Hi Gabor,

    Can you check the program bcs_example_06.

    This is example program to send pdf as mail.

    pavan meda

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Dear Pavan!

      First of all, thank you very much of your kind help and support!

      I succeeded to get the PDF data, and I have found out what was the problem.

      1. I had to change the type of my form interface to ABAP dictionary based interface

      2. I had to re-activate the PDF form in SFP, so the system re-created the generated function module

      3. In my program, I called FP_JOB_OPEN with the same parameters like in BCS_EXAMPLE_6

      4. I called the generated function module, with the import parameter ls_formoutput

      5. then I called FP_JOB_CLOSE, there was no error 😊

      6. after that I have called BCS interface and everything is worked fine!

      Now I am happy 😊

      Thank you, Pavan, have a nice day!

      Gabor