cancel
Showing results for 
Search instead for 
Did you mean: 

Custom fax cover sheet

Former Member
0 Kudos

Hello,

My scenario is this:

I need to send a custom smartform or sapscript cover sheet in the same output process of faxing smartform PO's, Quotations, Invoces and several other documents. I don't see anywhere in configuration where something like this can be done. Does anyone have any ideas on how to accomplish this?

Thank you,

JR

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Time for a little give-back from me....

Having just worked on this same issue and not finding a solution from SDN (which was unusual) I thought I'd better let you know what I have found..

Transactions SO41,SO42 and SO43 show the default SAP fax cover sheets.

They are kept in client 000 and you need to use SE71 (SAPScript forms) to copy the required form (and rename to Z...), then you are free to modify it as required (Add a logo etc).

Make sure you classify the form as a SAP office form, there are instructions for doing this in the SAP library.

You can test it in SO01 without sending the fax anywhere, create a fax to recipient GB 1234567 or any other fake number, double click on the sender and you will get a popup of the fax details (sender info, receiver info and the cover sheet to use).

or you can use SO_OBJECT_SEND, make sure the recevicers-recextnam field is populated using the SADRFD structure.

and here's the subroutine I use to send a list as a fax with a custom cover sheet :

and below that is a similar subroutine to send emails...

&----


*& Form send_fax

&----


  • Send Fax of internal table GT_MAIL_LINES TYPE soli

----


FORM send_fax using my_company_name TYPE name1_gp.

DATA: ls_object_hd TYPE sood1,

ls_receivers TYPE soos1,

lt_receivers TYPE STANDARD TABLE OF soos1,

l_lines TYPE i,

ls_sadrfd TYPE sadrfd.

CLEAR: ls_object_hd, ls_receivers.

REFRESH lt_receivers.

ls_object_hd-objla = sy-langu.

ls_object_hd-objnam = 'NOTE'.

ls_object_hd-objdes = 'Fax subject line in here'.

  • Calculate size of table

DESCRIBE TABLE gt_mail_lines LINES l_lines.

READ TABLE gt_mail_lines INDEX l_lines INTO gs_mail_lines.

ls_object_hd-objlen = ( l_lines - 1 ) * 255 + STRLEN( gs_mail_lines ).

  • Set Fax control structure

    • Fax number in structure must have no leading zero

    • as this is added by SAPOffice from the country code

ls_sadrfd-rec_fax = gs_address-fax.

shift ls_sadrfd-rec_fax left deleting leading '0'.

condense ls_sadrfd-rec_fax no-gaps.

ls_sadrfd-rec_street = gs_address-street.

ls_sadrfd-rec_town = gs_address-city.

ls_sadrfd-rec_name1 = gs_address-name.

ls_sadrfd-rec_state = gs_address-country.

ls_sadrfd-form_langu = gs_address-langu.

ls_sadrfd-fax_form = 'Z_FAX_COVER'.

ls_sadrfd-send_comp = my_company_name.

ls_sadrfd-send_immi = 'X'.

IF ls_sadrfd-form_langu is initial.

ls_sadrfd-form_langu = sy-langu.

endif.

ls_sadrfd-send_nam = sy-uname.

ls_sadrfd-send_date = sy-datum.

ls_sadrfd-send_time = sy-uzeit.

  • Convert Receiver information to char field

CALL FUNCTION 'C147_WORKAREA_TO_CHARFIELD'

EXPORTING

I_WORKAREA = ls_sadrfd

IMPORTING

E_CHARFIELD = ls_receivers-recextnam.

ls_receivers-recesc = 'F'.

ls_receivers-mailstatus = 'E'.

ls_receivers-sndart = 'FAX'.

ls_receivers-sndpri = '1'.

APPEND ls_receivers TO lt_receivers.

  • Send fax

CALL FUNCTION 'SO_OBJECT_SEND'

EXPORTING

object_hd_change = ls_object_hd

object_type = 'RAW'

owner = sy-uname

originator = g_originator

originator_type = 'B'

TABLES

objcont = gt_mail_lines

receivers = lt_receivers

EXCEPTIONS

OTHERS = 01.

  • The function doesn't commit so we must

  • do it if successful.

IF sy-subrc = 0.

COMMIT WORK AND WAIT.

ELSE.

WRITE: / 'Fax failed RAISE ERROR '(012).

ENDIF.

ENDFORM. "send_fax

&----


*& Form send_email

  • Send Email of internal table GT_MAIL_LINES

&----


FORM send_email USING pi_email_address TYPE ad_smtpadr.

DATA: ls_object_hd TYPE sood1,

ls_receivers TYPE soos1,

lt_receivers TYPE STANDARD TABLE OF soos1,

l_lines TYPE i.

CLEAR: ls_object_hd, ls_receivers.

REFRESH lt_receivers.

ls_object_hd-objla = sy-langu.

ls_object_hd-objnam = 'NOTE'.

ls_object_hd-objdes = 'Email title in here'.

  • get size of text table to be sent

DESCRIBE TABLE gt_mail_lines LINES l_lines.

READ TABLE gt_mail_lines INDEX l_lines INTO gs_mail_lines.

ls_object_hd-objlen = ( l_lines - 1 ) * 255 + STRLEN( gs_mail_lines ).

ls_receivers-recextnam = pi_email_address.

ls_receivers-recesc = 'E'.

ls_receivers-mailstatus = 'E'.

ls_receivers-sndart = 'INT'.

ls_receivers-sndpri = '1'.

APPEND ls_receivers TO lt_receivers.

  • NB: G_originator is a SAP user ID with the email address that you want any

  • replies to go to - its useful to have this not as sy-uname so any replies can go to

  • a central email address like sales@company.com

CALL FUNCTION 'SO_OBJECT_SEND'

EXPORTING

object_hd_change = ls_object_hd

object_type = 'RAW'

owner = sy-uname

originator = g_originator

originator_type = 'B'

TABLES

objcont = gt_mail_lines

receivers = lt_receivers

EXCEPTIONS

OTHERS = 01.

IF sy-subrc = 0.

COMMIT WORK AND WAIT.

ELSE.

WRITE: / 'Email failed RAISE ERROR '(010).

ENDIF.

ENDFORM. " send_email

Former Member
0 Kudos

i forgot to add...

when testing, go into transaction SOST to see the actual transmission.

It will have failed because you used a fake fax number (you did do that didn't you?).

click on the view button and then the recipient tab and then click on the cover sheet icon.

if you don't see anything, the problem is probably within the sapscript form.

if SAPOffice complains about the form its probably because you haven't classified it correctly or transported it to the correct client, i had to use SCC1 to get it and the std texts I used into the testing client.. or the fax node isn't setup correctly in SCOT.

Answers (0)