ERPClimb logoERPClimb
Adobe Forms
ABAP Developmentintermediate 8 min read

Adobe Forms Part 8: Output Parameters, PDF Return and Spool Handling

Lessons are open to try during our launch period. Some advanced content may move to Pro later. AI practice limits apply separately.

Key takeaway

Control what happens with Adobe output: SFPOUTPUTPARAMS for print, preview, PDF return and archiving, reading FPFORMOUTPUT-PDF, emailing PDFs with CL BCS, downloading for tests, spool handling and FP JOB CLOSE results.

In this lessonShow sections

Visual overview

Adobe Forms Part 8: Output Parameters, PDF Return and Spool Handling — learning sheetFlow: Change your driver to GETPDF = 'X' and download the PDF → Email the PDF to yourself with the code example (test system with SCOT configured) → Check SOST for the sent message. Key ideas: KEY PARAMETERS; PDF RETURN; EMAIL WITH CL_BCS; TESTING. Watch out: Emails from CL_BCS are only sent after COMMIT WORK (and SOST/SCOT settings) — test in a system where mail sending is configured.ERPClimb.com / ABAP / LESSON 8/10 / LEARNING SHEETAdobe Forms Part 8: Output Parameters, PDF Return andSpool Handling1 · HOW IT FLOWS1Change your driver toGETPDF = 'X' and downloadthe PDF2Email the PDF to yourselfwith the code example(test system with SCOT…3Check SOST for the sentmessage2 · KEY IDEAS EXPLAINEDKey ParametersPrint: DEST, NODIALOG, REQIMM, REQNEW, COPIES.Preview: PREVIEW = 'X' (dialog only).PDF ReturnCall the FM with IMPORTING /1BCDWB/FORMOUTPUT =ls_result; ls_result-PDF contains the PDF.One PDF per call; for a combined PDF of severaldocuments use job-level options(release-dependent) or merge afterwards.Email With CL_BCScl_bcs=>create_persistent( ),cl_document_bcs=>create_document( ),add_attachment with SOLIX table…Monitor in SOST.TestingDownload the PDF to the PC (GUI_DOWNLOAD /cl_gui_frontend_services=>gui_download) tocompare versions.3 · REMEMBER · WATCH OUTRememberSFPOUTPUTPARAMS controls the job: DEST (printer), NODIALOG, PREVIEW,REQIMM (print immediately), REQNEW (new spool), GETPDF (return PDF)…With GETPDF = 'X' the generated FM returns FPFORMOUTPUT-PDF as XSTRING— ready for email, archive or download.Email with CL_BCS: create document, attach the PDF (converted to SOLIXwith CL_BCS_CONVERT), add recipient, send, COMMIT WORK.!Watch outEmails from CL_BCS are only sentafter COMMIT WORK (and SOST/SCOTsettings) — test in a system wheremail sending is configured.4 · IN A REAL PROJECTA company wanted invoices emailed to customers instead of printed. The first version generated PDFs correctly,but no emails arrived: the program never called COMMIT WORK after CL_BCS send, and SCOT had no SMTP node inQA. After adding the commit, configuring SCOT and monitoring SOST, emails were delivered. The team also stored…Original ERPClimb learning sheet • Verify against your SAP release and edition

Expert visual walkthrough

ABAP DEVELOPMENT ACADEMY · Integration pathERPClimb.com

Output Parameters, PDF Return and Spool Handling

Adobe Forms · Chapter-specific technical teaching map

Integration path

1Concept

Output parameters

2Concept

ADS call

3Concept

PDF return

4Concept

Spool request

Tutor's chapter takeaway

Control what happens with Adobe output: SFPOUTPUTPARAMS for print, preview, PDF return and archiving, reading FPFORMOUTPUT-PDF, emailing PDFs with CL_BCS, downloading for tests, spool handling and FP_JOB_CLOSE results.

In a real project

A company wanted invoices emailed to customers instead of printed. The first version generated PDFs correctly, but no emails arrived: the program never called COMMIT WORK after CL_BCS send, and SCOT had no SMTP node in QA…

Watch out for

• Missing COMMIT WORK after CL_BCS send. • GETPDF without NODIALOG in background. • Passing XSTRING directly as text attachment. • No SCOT/SOST configuration in test systems. • One job per document when only PDFs are needed.

Conceptual study map, not an SAP configuration screenshot or a guaranteed runtime sequence. Consult the lesson for implementation prerequisites and exceptions.

The situation: a real project scenario

A company wanted invoices emailed to customers instead of printed. The first version generated PDFs correctly, but no emails arrived: the program never called COMMIT WORK after CL_BCS send, and SCOT had no SMTP node in QA.
After adding the commit, configuring SCOT and monitoring SOST, emails were delivered. The team also stored each PDF in the archive (ArchiveLink) for audit.

Explanation

Part 5 printed form output directly to spool, but many processes need PDFs instead — for emailing to customers, for archiving, or for download from a portal.

The SFPOUTPUTPARAMS structure controls how a form job runs. DEST sets the printer, NODIALOG suppresses the print dialog, PREVIEW shows the form on screen only, REQIMM prints immediately, REQNEW forces a new spool request, GETPDF returns the generated PDF, COPIES sets the number of copies, and ARCMODE controls archiving. SFPOUTPUTPARAMS controls the job: DEST (printer), NODIALOG, PREVIEW, REQIMM (print immediately), REQNEW (new spool), GETPDF (return PDF), COPIES, ARCMODE (archiving).

Setting GETPDF = 'X' makes the generated function module return the PDF as XSTRING in FPFORMOUTPUT-PDF, ready to be emailed, archived or downloaded, by importing /1BCDWB/FORMOUTPUT = ls_result from the call and reading ls_result-PDF. Each call produces one PDF; combining several documents into a single PDF needs either job-level options, which vary by release, or merging the PDFs afterward. For archiving specifically, ARCMODE lets you choose 1 for print only, 2 for archive only, or 3 for both print and archive, together with the archive parameters set in output control.

Sending the PDF by email uses the CL_BCS class library: create a persistent send request with cl_bcs=>create_persistent( ), create the document with cl_document_bcs=>create_document( ), attach the PDF as a SOLIX table using cl_bcs_convert=>xstring_to_solix to convert it, set the sender and recipient using cl_cam_address_bcs=>create_internet_address, call send( ), and finish with COMMIT WORK.

Note that emails sent through CL_BCS are only actually dispatched after COMMIT WORK, and their delivery also depends on the SOST and SCOT configuration, so this is best tested in a system where mail sending is properly set up. You can monitor sent messages afterward in SOST.

For testing, downloading the PDF to your PC with GUI_DOWNLOAD, or the class method cl_gui_frontend_services=>gui_download, lets you compare different versions of the output directly.

On the job and spool side, FP_JOB_CLOSE can return job results — such as page counts and spool IDs — through the E_RESULT parameter of type SFPJOBOUTPUT. SP01 shows the spool requests themselves, and the device types configured in SPAD determine the printer language that ADS (Adobe Document Services) uses.

As an exercise, change your driver program to use GETPDF = 'X' and download the resulting PDF, then email that PDF to yourself using the code example on a test system where SCOT is configured, and check SOST to confirm the message was sent. By the end, you should be able to produce PDFs from Adobe Forms and deliver them either by email or as a file.

Code example

ABAP Code
* ===== Get PDF and email it =====FORM send_invoice_pdf USING iv_pdf    TYPE xstring                            iv_vbeln  TYPE vbeln_vf                            iv_email  TYPE ad_smtpadr.  DATA: lo_send   TYPE REF TO cl_bcs,        lo_doc    TYPE REF TO cl_document_bcs,        lo_rcpt   TYPE REF TO if_recipient_bcs,        lt_body   TYPE bcsy_text,        ls_body   TYPE soli,        lt_solix  TYPE solix_tab,        lv_subj   TYPE so_obj_des,        lv_size   TYPE so_obj_len,        lx_bcs    TYPE REF TO cx_bcs.   TRY.      lo_send = cl_bcs=>create_persistent( ).       CONCATENATE 'Invoice' iv_vbeln INTO lv_subj SEPARATED BY space.      ls_body-line = 'Please find your invoice attached.'.      APPEND ls_body TO lt_body.      lo_doc = cl_document_bcs=>create_document( i_type    = 'RAW'                                                  i_text    = lt_body                                                  i_subject = lv_subj ). *     PDF xstring -> SOLIX table for the attachment      lt_solix = cl_bcs_convert=>xstring_to_solix( iv_xstring = iv_pdf ).      lv_size  = xstrlen( iv_pdf ).      lo_doc->add_attachment( i_attachment_type    = 'PDF'                              i_attachment_subject = lv_subj                              i_attachment_size    = lv_size                              i_att_content_hex    = lt_solix ).      lo_send->set_document( lo_doc ).       lo_rcpt = cl_cam_address_bcs=>create_internet_address( iv_email ).  " plain SMTP address, not a SAP user -> internet address, not create_persistent( )      lo_send->add_recipient( lo_rcpt ).      lo_send->send( ).      COMMIT WORK.                            " mail is sent only after commit    CATCH cx_bcs INTO lx_bcs.      MESSAGE lx_bcs TYPE 'S' DISPLAY LIKE 'E'.  ENDTRY.ENDFORM. * ===== In the driver: request the PDF =====* ls_outpar-getpdf   = 'X'.* ls_outpar-nodialog = 'X'.* CALL FUNCTION lv_fm ... IMPORTING /1bcdwb/formoutput = ls_result.* PERFORM send_invoice_pdf USING ls_result-pdf ls_header-vbeln lv_email.

Watch out

Common mistakes

  • Missing COMMIT WORK after CL_BCS send.
  • GETPDF without NODIALOG in background.
  • Passing XSTRING directly as text attachment.
  • No SCOT/SOST configuration in test systems.
  • One job per document when only PDFs are needed.

Do this

Best practices

  • Use GETPDF for email/archive scenarios.
  • Convert PDF with CL_BCS_CONVERT.
  • Commit after send; monitor SOST.
  • Download PDFs for regression comparison.
  • Configure archiving mode deliberately.

In the interview

Interview angle

Questions: "How do you get a PDF from an Adobe Form?", "How do you email it?", "Which output parameters matter?"
Strong answer: SFPOUTPUTPARAMS (DEST, NODIALOG, PREVIEW, REQIMM, GETPDF, ARCMODE); GETPDF returns FPFORMOUTPUT-PDF xstring; email with CL_BCS: create document, attachment via XSTRING_TO_SOLIX, recipient, send, COMMIT WORK, monitor SOST; FP_JOB_CLOSE result for spool info.

Practice this lesson

Quick check

0 of 3 questions attempted

Question 1 of 3

PDFs are generated and sent with CL_BCS, but no email arrives and SOST shows nothing. Likely cause?

Practise this in an interview

Answer in your own words and get instant feedback, the way an interviewer would judge it.

1A billing job generated PDFs successfully, but customers never received the emails. What do you check?

2How do you call an Adobe Form from an ABAP driver program?

Try a related Code Lab

This published exercise covers the same SAP topic. Apply the ideas in a hands-on scenario, then return to review your answers.

Open: ADS Failure Misdiagnosed as ABAP Driver Issue →

See it in code

Each example starts from a requirement, shows the design, then the code step by step with a plain-language explanation of every part.

Was this lesson helpful?

Keep exploring

Referenced SAP objects

Reviewed reference pages for the objects this page mentions.

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.