Application Development 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: 

Convert PO into PDF format and send by an email to vendor

Former Member
0 Kudos

We are using SAP version ECC 5.0. We want to convert SAP PO into PDF format and attached it in an email and send it to vendor. Please give me some tips to achieve this?

Thanks in advance!

Mrudula

6 REPLIES 6

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

I believe that all that can be set up thru output types. Check SPRO for the configurations under the Materials Management->Purchasing->Messages->Output Control->Message Types

Regards,

Rich Heilman

Former Member
0 Kudos

Hi Mrudula

You should generate a spool and so convert this spool into PDF.

Here you can see an abap program:

http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm

In that example it use CONVERT_ABAPSPOOLJOB_2_PDF, but you should used CONVERT_OTFSPOOLJOB_2_PDF instead of that. Infact before you create the spool (print PO using a message) and then convert it.

Max

Message was edited by: max bianchi

Former Member
0 Kudos

Hi!

The way to achieve your goal depends on how you get PO printed - by sapscript, smartform or abap list.

As have been mentioned you can create spool request and process it. But for sapscript and smartform you can proceed without spool request - just get back OTF data from corresponding FM and convert it to PDF.

In case of smartform:

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZFORMNAME'

IMPORTING

fm_name = v_form_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

w_ctrlop-getotf = 'X'.

w_ctrlop-no_dialog = 'X'.

w_compop-tdnoprev = 'X'.

CALL FUNCTION v_form_name

EXPORTING

control_parameters = w_ctrlop

output_options = w_compop

user_settings = 'X'

IMPORTING

job_output_info = w_return

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

i_otf[] = w_return-otfdata[].

In case of sapscript:

options-tdgetotf = 'X'.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

options = options

...

CALL FUNCTION 'CLOSE_FORM'

  • IMPORTING

  • RESULT =

  • RDI_RESULT =

TABLES

otfdata = i_otf

EXCEPTIONS

unopened = 1

bad_pageformat_for_print = 2

send_error = 3

spool_error = 4

OTHERS = 5.

Then convert to PDF

DATA:

pdf LIKE tline OCCURS 100 WITH HEADER LINE,

v_len_in LIKE sood-objlen.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

  • ARCHIVE_INDEX = ' '

IMPORTING

bin_filesize = v_len_in

TABLES

otf = i_otf

lines = pdf

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

OTHERS = 4

.

Then send as attachment as Max proposed.

Regards,

Maxim.

Former Member
0 Kudos

Hi Mrudula,

This is supported with stanadrad output control . You can do this using your sapscript or smartform. Just see if your output type has a processing routine & smartform defined for medium "5" external send . It can be the same print program and routine you use for printing .

Now create a condition record for output medium "5" .

Also make sure that email is maintained in Vendor Master .

Cheers

0 Kudos

Hi Sanjay,

I am using standard print program : RLB_INVOICE and layout LB_BIL_INVOICE for sending the Invoice to the customer via e-mail.

I am trying through a standard output type MAIL.

I have also maintained the email settings .

Can you please elobarate on how to attach the print program and layout to the output type?

Former Member
0 Kudos

Thanks to all of you for your quick replies and suggestions. I would look at them and would see if I need more information or help from you guys.

Thanks again!

Mrudula