Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Generate Spool with one single PDF Document not Multiple PDF Documents.

Former Member
0 Likes
3,483

Hi Everyone,

we have a requirement to generate a single PDF document in a Spool, currently multiple PDF documents are getting generated in a single spool request.

For example.

if we create a plain adobe form with simple text "HELLO", and we call this form (or corresponding FM) thrice between fp_job_open and fp_job_close, we want to generate a single PDF document in spool. currently we are getting 3 different PDF document for the same.

currently i am using below code with no success-

______________________________________________________________________________________________________

TYPES: BEGIN OF gty_result,

          index   TYPE syindex,

          time    TYPE syuzeit,

          pages   TYPE fppagecount,

          size    TYPE filesize,

          content TYPE fpcontent,

        END OF gty_result,

        gty_result_tab TYPE STANDARD TABLE OF gty_result.

data gs_outputparams   TYPE sfpoutputparams.                   " form output parameters.

DATA gs_output       TYPE fpformoutput.

data gv_cnt          type i.

DATA gt_result       TYPE gty_result_tab.

CONSTANTS gc_form_1 TYPE fpname VALUE 'YAKA_TEST_003'.

DATA gv_fm_name_1    TYPE rs38l_fnam.

DATA gs_joboutput    TYPE sfpjoboutput.

PARAMETERS: P_DEST TYPE sfpoutputparams-DEST.

TRY.

       CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'

         EXPORTING

           i_name     = gc_form_1

         IMPORTING

           e_funcname = gv_fm_name_1.

     CATCH cx_fp_api_repository cx_fp_api_usage cx_fp_api_internal.

       MESSAGE ID 'FPAPIGENERIC' TYPE 'E' NUMBER '000' WITH gc_form_1.

   ENDTRY.

     gs_outputparams-nodialog     = 'X'.

    gs_outputparams-dest          = P_DEST.

    gs_outputparams-reqnew      abap_true.        "New spool request

    gs_outputparams-reqimm      abap_true.        "Print immediately

    gs_outputparams-connection =  cl_fp=>get_ads_connection( ).

    gs_outputparams-bumode     = 'M'.                   " Bundle

    if cl_fp_feature_test=>is_available(

                 iv_connection = 'ADS'

                 iv_feature    = cl_fp_feature_test=>gc_assemble_stitch )

             = abap_true.

          gs_outputparams-assemble = 'S'.               " Assemble

   else.

          gs_outputparams-assemble = 'X'.                " Assemble

   endif.

  

CALL FUNCTION 'FP_JOB_OPEN'

     CHANGING

       ie_outputparams = gs_outputparams

     EXCEPTIONS

       cancel          = 1

       usage_error     = 2

       system_error    = 3

       internal_error  = 4

       OTHERS          = 5.

   IF sy-subrc IS NOT INITIAL.

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

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

   ENDIF.

clear gv_cnt.

   do 3 times.

     gv_cnt = gv_cnt + 1.

     CALL FUNCTION gv_fm_name_1

*     EXPORTING

*       /1BCDWB/DOCPARAMS        =

      IMPORTING

        /1BCDWB/FORMOUTPUT       = gs_output

      EXCEPTIONS

        USAGE_ERROR              = 1

        SYSTEM_ERROR             = 2

        INTERNAL_ERROR           = 3

        OTHERS                   = 4

               .

     IF sy-subrc ne 0.

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

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

     ENDIF.

   ENDDO.


* Close spool job.

   CALL FUNCTION 'FP_JOB_CLOSE'

     IMPORTING

       e_result       = gs_joboutput

     EXCEPTIONS

       usage_error    = 1

       system_error   = 2

       internal_error = 3

       OTHERS         = 4.

   IF sy-subrc ne 0.

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

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

   ENDIF.

________________________________________________________________________________________________________

I have already checked sample program "FP_CHECK_BATCH_PDF_RETURN".

Also i have looked to below all links-

http://help.sap.com/saphelp_nw73/helpdata/en/4a/a1931bacd5007fe10000000a42189c/content.htm

http://help.sap.com/saphelp_nw73/helpdata/en/42/01653f9e1f4ea09f1860c297833400/content.htm

do we need to create user ADS_AGENT and assign Role SAP_BC_FPADS_ICF , as mentioned in link-

http://help.sap.com/saphelp_nw73/helpdata/en/42/01653f9e1f4ea09f1860c297833400/content.htm    and

http://help.sap.com/saphelp_nw73/helpdata/en/4b/94e942ea576e82e10000000a421937/frameset.htm

Please help on this.

Regards,

Akash






Hi Everyone,

we have a requirement to generate a single PDF document in a Spool, currently multiple PDF documents are getting generated in a single spool request.

For example.

if we create a plain adobe form with simple text "HELLO", and we call this form (or corresponding FM) thrice between fp_job_open and fp_job_close, we want to generate a single PDF document in spool. currently we are getting 3 different PDF document for the same.

currently i am using below code with no success-

______________________________________________________________________________________________________

TYPES: BEGIN OF gty_result,

          index   TYPE syindex,

          time    TYPE syuzeit,

          pages   TYPE fppagecount,

          size    TYPE filesize,

          content TYPE fpcontent,

        END OF gty_result,

        gty_result_tab TYPE STANDARD TABLE OF gty_result.

data gs_outputparams   TYPE sfpoutputparams.                   " form output parameters.

DATA gs_output       TYPE fpformoutput.

data gv_cnt          type i.

DATA gt_result       TYPE gty_result_tab.

CONSTANTS gc_form_1 TYPE fpname VALUE 'YAKA_TEST_003'.

DATA gv_fm_name_1    TYPE rs38l_fnam.

DATA gs_joboutput    TYPE sfpjoboutput.

PARAMETERS: P_DEST TYPE sfpoutputparams-DEST.

TRY.

       CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'

         EXPORTING

           i_name     = gc_form_1

         IMPORTING

           e_funcname = gv_fm_name_1.

     CATCH cx_fp_api_repository cx_fp_api_usage cx_fp_api_internal.

       MESSAGE ID 'FPAPIGENERIC' TYPE 'E' NUMBER '000' WITH gc_form_1.

   ENDTRY.

     gs_outputparams-nodialog     = 'X'.

    gs_outputparams-dest          = P_DEST.

    gs_outputparams-reqnew      abap_true.        "New spool request

    gs_outputparams-reqimm      abap_true.        "Print immediately

    gs_outputparams-connection =  cl_fp=>get_ads_connection( ).

    gs_outputparams-bumode     = 'M'.                   " Bundle

    if cl_fp_feature_test=>is_available(

                 iv_connection = 'ADS'

                 iv_feature    = cl_fp_feature_test=>gc_assemble_stitch )

             = abap_true.

          gs_outputparams-assemble = 'S'.               " Assemble

   else.

          gs_outputparams-assemble = 'X'.                " Assemble

   endif.

  

CALL FUNCTION 'FP_JOB_OPEN'

     CHANGING

       ie_outputparams = gs_outputparams

     EXCEPTIONS

       cancel          = 1

       usage_error     = 2

       system_error    = 3

       internal_error  = 4

       OTHERS          = 5.

   IF sy-subrc IS NOT INITIAL.

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

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

   ENDIF.

clear gv_cnt.

   do 3 times.

     gv_cnt = gv_cnt + 1.

     CALL FUNCTION gv_fm_name_1

*     EXPORTING

*       /1BCDWB/DOCPARAMS        =

      IMPORTING

        /1BCDWB/FORMOUTPUT       = gs_output

      EXCEPTIONS

        USAGE_ERROR              = 1

        SYSTEM_ERROR             = 2

        INTERNAL_ERROR           = 3

        OTHERS                   = 4

               .

     IF sy-subrc ne 0.

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

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

     ENDIF.

   ENDDO.


* Close spool job.

   CALL FUNCTION 'FP_JOB_CLOSE'

     IMPORTING

       e_result       = gs_joboutput

     EXCEPTIONS

       usage_error    = 1

       system_error   = 2

       internal_error = 3

       OTHERS         = 4.

   IF sy-subrc ne 0.

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

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

   ENDIF.

________________________________________________________________________________________________________

I have already checked sample program "FP_CHECK_BATCH_PDF_RETURN".

Also i have looked to below all links-

http://help.sap.com/saphelp_nw73/helpdata/en/4a/a1931bacd5007fe10000000a42189c/content.htm

http://help.sap.com/saphelp_nw73/helpdata/en/42/01653f9e1f4ea09f1860c297833400/content.htm

do we need to create user ADS_AGENT and assign Role SAP_BC_FPADS_ICF , as mentioned in link-

http://help.sap.com/saphelp_nw73/helpdata/en/42/01653f9e1f4ea09f1860c297833400/content.htm    and

http://help.sap.com/saphelp_nw73/helpdata/en/4b/94e942ea576e82e10000000a421937/frameset.htm

Please help on this.

Regards,

Akash






4 REPLIES 4
Read only

Former Member
0 Likes
1,519

Do we have any Adobeform ? expert here who can help on this.

Regards,

Akash

Read only

Former Member
0 Likes
1,519

Hi Akash,

You are calling (Generated function module) gv_fm_name_1 in a loop or using DO statement. By this there will be 3 different outputs issued.

Declare the Interface type as a Smartform compatible interface by doing this you can retrieve the OTF data for each entry in loop.

Move the OTF data of each entry to the final OTF table. (  Do not overwrite the OTF data )

Once you have the final OTF data table then by using CONVERT_OTF you can simply create a single pdf for all the outputs.

Let me know if need additional info on this.

Thanks,

Tooshar Bendale

Read only

0 Likes
1,519

Hi Tooshar,

Thanks for your reply, i dont want to download a PDF, i am already able to do that, i want a single PDF in Spool.

Regards,

AKR

Read only

0 Likes
1,519

Hi Akash,

what SAP Netweaver and ADS Version are you using - Are you using ABAP and JAVA ADS?

I can write that when using the configuration ABAP and ABAP ADS the spool contained indeed only one PDF Document with more pages and not more documents. At least it looked like this in print preview - when downloading the PDF from there, the whole PDF was downloaded with all the pages. With the new system settings, ABAP and JAVA ADS + ABAP EHP6 we are not able to do this anymore. I am able to download only each page.

With the current system settings I am able to use the option assemble only with using the option getpdf = 'X'. If I use this option, getpdf 'X' no spool is generated. Did you find a solution in the meantime?

Thanks and Best regards!

Florin