cancel
Showing results for 
Search instead for 
Did you mean: 

user exit

Former Member
0 Kudos

by using user exit s who can i pass data to pdf or email format

Accepted Solutions (0)

Answers (1)

Answers (1)

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Ravi!

You need to create some data, which you can send. e.g. a sapscript formular, a smartform or a spool list (little bit more complicated than the forms).

For sapscript / smartform, there is an import parameter for OTF-stream. By setting this, no screen or spool output will be generated, but you will get a table parameter with the result.

This you can forward to function modules to get PDF and e-mail:

    call function 'CONVERT_OTF'
      exporting
        format                = 'PDF'
      importing
        bin_filesize          = g_binfilesize
      tables
        otf                   = t_otfdata
        lines                 = gt_pdf
      exceptions
        err_max_linewidth     = 1
        err_format            = 2
        err_conv_not_possible = 3
        err_bad_otf           = 4
        others                = 5.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
  EXPORTING
    document_data                    = document_data
*   PUT_IN_OUTBOX                    = ' '
*   SENDER_ADDRESS                   = SY-UNAME
*   SENDER_ADDRESS_TYPE              = 'B'
*   COMMIT_WORK                      = ' '
* IMPORTING
*   SENT_TO_ALL                      = SENT_TO_ALL
*   NEW_OBJECT_ID                    = NEW_OBJECT_ID
*   SENDER_ID                        = SENDER_ID
  TABLES
    packing_list                     = packing_list
*   OBJECT_HEADER                    = OBJECT_HEADER
*   CONTENTS_BIN                     = CONTENTS_BIN
*   CONTENTS_TXT                     = CONTENTS_TXT
*   CONTENTS_HEX                     = CONTENTS_HEX
*   OBJECT_PARA                      = OBJECT_PARA
*   OBJECT_PARB                      = OBJECT_PARB
    receivers                        = receivers
* EXCEPTIONS
*   TOO_MANY_RECEIVERS               = 1
*   DOCUMENT_NOT_SENT                = 2
*   DOCUMENT_TYPE_NOT_EXIST          = 3
*   OPERATION_NO_AUTHORIZATION       = 4
*   PARAMETER_ERROR                  = 5
*   X_ERROR                          = 6
*   ENQUEUE_ERROR                    = 7
*   OTHERS                           = 8
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Have a look in the forum in case you need more info about sending documents, there are already lots of posts and blogs about sending email.

Regards,

Christian