cancel
Showing results for 
Search instead for 
Did you mean: 

To generate PDF on save of Purchase Order

gowrinath_gundu
Participant
0 Kudos

Hi All,

My requirement is to generate PDF on save of purchase order. I have chosen transmission medium 'special function' for the same.Following is the code snippet

IF NAST-KSCHL = 'ZEU' AND NAST-NACHA = 8.

    DATA : LV_ITCPO TYPE ITCPO.

    LV_ITCPO-TDNOPRINT = 'X'.

    LV_ITCPO-tdgetotf = 'X'.

    LV_ITCPO-TDNEWID = 'X'.

    LV_ITCPO-tdnoprev = 'X'.

      CALL FUNCTION 'OPEN_FORM'

       EXPORTING FORM = XFORMULAR

                 LANGUAGE = EKKO-SPRAS

                 OPTIONS = LV_ITCPO

*                 ARCHIVE_INDEX  = TOA_DARA

*                 ARCHIVE_PARAMS = ARC_PARAMS

*              ARCHIVE_PARAMS = ALARC_PAR1

                 DEVICE = 'PRINTER'

                 DIALOG = ''

       EXCEPTIONS CANCELED = 01.

  IF SY-SUBRC NE 0.

    PERFORM PROTOCOL_UPDATE USING '142' EKKO-EBELN SPACE SPACE SPACE.

    RETCO = SY-SUBRC.

    EXIT.

  ENDIF.

This is followed by WRITE_FORM and CLOSE_FORM and I have used FM CONVERT_TO_OTF ,GUI_DOWNLOAD to get PDF.

So now I am able to get PDF if select dispact time as 'Send with periodically scheduled job' and by running RSNAST00. But I am getting error 'express document update was terminated received from author' if I  select dispatch time as 'Send while saving the application. Upon looking below is the message for this.

Should I need to add anything so it works for 'Send while saving the application' too.

Thanks,

Gowrinath.

Accepted Solutions (0)

Answers (2)

Answers (2)

Jelena
Active Contributor
0 Kudos

This can be done by simply directing print output to a special printer that creates PDF instead of a printout. The device type PDF1 (or similar) needs to be configured in SAP and the users will need to have a special printer configured on their PCs.

E.g. we use CutePDF Writer and when I send output to PDF device in SAP, it just opens a printer dialog and then prompts for a pathname for PDF file. There are other similar programs available.

gowrinath_gundu
Participant
0 Kudos

Hi Jelena,

Thanks for your response.

I have set cute pdf writer as default and able to get PDF. But now,the issue is company logo is missing on PDF file. Do you have any idea how to fix this.

Thanks,

Gowrinath.

Jelena
Active Contributor
0 Kudos

For the missing logo - check the form and check whether the bitmap actually exists and whether there are any conditions on the element. It's just basic troubleshooting.

nabheetscn
Active Contributor
0 Kudos

You are trying to download a PDF file in the background which I believe is not possible. You can email it but can not download it in background

Nabheet

gowrinath_gundu
Participant
0 Kudos

Hi Nabeet,

Thanks for your quick response.

There is already code in place for email. But my client wants to create PDF  on click of save button. Is there any possibility I can do this?Like writing the file to application server or any other way.

I have configured PDF printer too. But its not asking me for the path where to save the PDF file.

Thanks,

Gowrinath.

nabheetscn
Active Contributor
0 Kudos

Their can be two alternatives. Either you process this output type in foreground or other is you write the file to application server client can download it via CG3Y/CG3G

Nabheet

gowrinath_gundu
Participant
0 Kudos

Hi Nabheet,

Process output type in foreground?Can you please elaborate on that.

Thanks

Gowrinath.