cancel
Showing results for 
Search instead for 
Did you mean: 

POSTING_ILLEGAL_STATEMENT ?

Former Member
0 Kudos

Hi,

I am getting this error when saving SapScript as PDF file?

There is probably an error in the program

"ZSAPFM06P".

This program is triggered in the update task. There, the

following ABAP/4 statements are not allowed:

- CALL SCREEN

- CALL DIALOG

- CALL TRANSACTION

- SUBMIT


   59 *-- Find out the spool number
   60     PERFORM get_spool_number USING sy-repid
   61                sy-uname
   62       CHANGING mi_rqident.
   63
->    SUBMIT rstxpdft4
   65       WITH spoolno = mi_rqident "425
   66       WITH p_file = 'C:\testPDF.pdf'
   67       AND RETURN.

How can I solve this problem?

Thanks,

Adibo.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Type of this program ZSAPFM06P is M - Module pool. Where we can't use SUBMIT statement and you have to have program type 'E - Executable' if you want to submit any program.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi all,

Thanks!

When calling FM in background nothing happens??


REPORT  ZZ_TEST_AA1.

    CALL FUNCTION 'Z_SAVE_SPOOL_AS_PDF'
      IN BACKGROUND TASK DESTINATION 'NONE'. <------------------------
    .


FUNCTION z_save_spool_as_pdf.
*"----------------------------------------------------------------------
*"*"Lokale interface:
*"----------------------------------------------------------------------
  TABLES: tsp01.
  DATA: mi_rqident TYPE tsp01-rqident.
  DATA: pdf LIKE STANDARD TABLE OF tline WITH HEADER LINE,
        pdf_bytecount TYPE i.


  CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
      src_spoolid = '517'"mi_rqident "'430'
    TABLES
      pdf         = pdf.


  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      bin_filesize = pdf_bytecount
      filename     = 'C:\TEST.PDF'
      filetype     = 'BIN'
    TABLES
      data_tab     = pdf[].

ENDFUNCTION.

former_member555112
Active Contributor
0 Kudos

Hi,

Do not create a new Z report.

Call the FM in background in program ZSAPFM06P at the place where you are calling SUBMIT RSTXPDFT4.

Since the program ZSAPFM06P is called in update task after commit so the FM will be called properly.

Regards,

Ankur Parab

Former Member
0 Kudos

@Ankur Parab,

I know, I just created Z program for testing.

Same happens when I call FM in ZSAPFM06P. I mean nothing happens. PDF is not saved..

ZSAPFM06P:


  IF wa_eket-menge = lv_menge.
    CALL FUNCTION 'ME_PRINT_PO'
      EXPORTING
        ix_nast        = l_nast
        ix_druvo       = l_druvo
        doc            = l_doc
        ix_screen      = ent_screen
        ix_from_memory = l_from_memory
        ix_toa_dara    = toa_dara
        ix_arc_params  = arc_params
        ix_fonam       = tnapr-fonam                        "HW 214570
      IMPORTING
        ex_retco       = ent_retco.


    CALL FUNCTION 'Z_SAVE_SPOOL_AS_PDF'
      IN BACKGROUND TASK DESTINATION 'NONE'.
    .


  ENDIF.

Edited by: Adibo A on May 26, 2009 2:52 PM

Sm1tje
Active Contributor
0 Kudos

Well, seems that you are trying to save the PDF on local machine (C:\....) in BACKGROUND, correct?

Former Member
0 Kudos

Your right...

Sm1tje
Active Contributor
0 Kudos

So two options:

1. Forget about the background processing (is this really necessary?).

2. Don't save PDF to local file, but on application server.

Former Member
0 Kudos

Well, I need to save spool as PDF. It doesn't matter how..:)

Thanks!

former_member555112
Active Contributor
0 Kudos

Hi,

Create a Z RFC FM and call it in background task.

In this FM use pass the relevant details and write the statement to submit.

When you call the FM in a bakground task in the update task; the FM will run in a separate task so your submit statement will work.

Regards,

Ankur Parab

Former Member
0 Kudos

Hi

I believe you'vw insert your SUBMIT in a routine called in UPDATE TASK mode, here some statament are not allowed.

Where did you place your submit?

Max