cancel
Showing results for 
Search instead for 
Did you mean: 

sapscript via sapconnect as fax

Former Member
0 Kudos

Hallo,

we have old formulars (Z-Programms).

In the past we printed the formulars to an printer. The Printer had an driver wich sended the spool to our fax-system.

But now we get an new fax-solution.

This needs to fax via sapconnect (Transaction SOST).

How is the easiest way.

Easi is perhaps only to change the open_form parameters.

But a few tests shows that it does'nt work.

Has someone an example how to use the open_form parameters?

I found an example in the Report RSSOKIF2.

This works with the Business Communication Interface.

There are a lot of code for this - is this realy the way. Is there no easy way?

I am very happy for each comment, tipp etc.

I wish all readers a good time in waiting for the Messias which is born on Christmas. Jesus is alive on eastern and he lives today.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

If your new Fax solution allows SMTP traffic (fax from email) you could set up a printer with access method 'M'. It's a crude work around but it could allow you to keep a fax as a printer type solution. Otherwise you do need to change a fair bit of code, Faxes are now more like emails than print jobs.

Former Member
0 Kudos

In the following you find my coding.

I have the problem, there are generated 2 mails (TA SOST) with the same title.

I think there are a lot of data in the memory.

But how can I be sure that I have the right one.

Is there a method in OO-Language where I can destroy my old memory?

It is crazy because my solution is also using macros .-(

This is only a demo-program.

I want to use in the next step a Funcion Modul (call funkction 'xxxxxx').

Has any one tipps ore a complete solution....

I know it's not ok if someone writes the solution for me

But it can be theat other guys wants a solution too - and they are thankful also.

REPORT ZZZ_SPRANZ_DEMO_SAPSCRIPT.

PARAMETERS: LAND LIKE SOXFX-REC_STATE DEFAULT 'DE' OBLIGATORY.

PARAMETERS: NUMBER LIKE SOXFX-REC_FAX OBLIGATORY.

data: gv_title type TDTITLE.

data: gv_RECIPIENT_ID LIKE SWOTOBJID.

data: gv_APPL_OBJECT_ID LIKE SWOTOBJID.

data: gs_options LIKE ITCPO.

do 2 times.

CLEAR gs_OPTIONS.

gs_options-tdtitle = sy-tabix.

shift gs_options-tdtitle left deleting leading space.

CONCATENATE 'Senden über SAPscript'

gs_options-tdtitle

INTO gs_OPTIONS-TDTITLE SEPARATED BY SPACE.

perform vorlauf.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

DEVICE = 'MAIL'

DIALOG = 'X'

FORM = 'ZZZ_SPRANZ_DEMO'

OPTIONS = gs_options

MAIL_RECIPIENT = gv_RECIPIENT_ID

MAIL_APPL_OBJECT = gv_APPL_OBJECT_ID

EXCEPTIONS

CANCELED = 1

DEVICE = 2

FORM = 3

OPTIONS = 4

UNCLOSED = 5

MAIL_OPTIONS = 6

OTHERS = 7.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'WRITE_FORM'

EXCEPTIONS

ELEMENT = 1

FUNCTION = 2

TYPE = 3

UNOPENED = 4

UNSTARTED = 5

WINDOW = 6

BAD_PAGEFORMAT_FOR_PRINT = 7

SPOOL_ERROR = 8

CODEPAGE = 9

OTHERS = 10

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'CLOSE_FORM'

EXCEPTIONS

UNOPENED = 1

BAD_PAGEFORMAT_FOR_PRINT = 2

SEND_ERROR = 3

SPOOL_ERROR = 4

CODEPAGE = 5

OTHERS = 6

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

commit work and wait.

enddo.

*&----


*

*& Form vorlauf

*&----


*

FORM vorlauf .

TABLES: SOUD.

  • Makros für Zugriff aufs BOR

INCLUDE .

  • Datendeklaration

  • * (BOR)

DATA: SENDER_ID LIKE SWOTOBJID,

APPL_OBJECT_ID LIKE SWOTOBJID,

RECIPIENT_ID LIKE SWOTOBJID,

RECIPIENT TYPE SWC_OBJECT,

SENDER TYPE SWC_OBJECT,

RECIPIENT_TAB TYPE SWC_OBJECT OCCURS 0 WITH HEADER LINE,

FOLDER TYPE SWC_OBJECT,

BEGIN OF SOFMFOL_KEY,

FOLDERTYPE LIKE SOFM-FOLTP,

FOLDERYEAR LIKE SOFM-FOLYR,

FOLDERNUMBER LIKE SOFM-FOLNO,

TYPE LIKE SOFM-DOCTP,

YEAR LIKE SOFM-DOCYR,

NUMBER LIKE SOFM-DOCNO,

FORWARDER LIKE SOUB-USRNAM,

END OF SOFMFOL_KEY,

BOR_KEY LIKE SWOTOBJID-OBJKEY,

ADDRESS_STRING LIKE SOXNA-FULLNAME.

  • * (SAPscript)

DATA: HEADER LIKE THEAD,

RESULT LIKE ITCPP,

LINES LIKE TLINE OCCURS 0 WITH HEADER LINE,

OTFDATA LIKE ITCOO OCCURS 0.

  • OPTIONS LIKE ITCPO.

  • Deklaration eines Containers

SWC_CONTAINER CONTAINER.

************************************************************************

  • Sender (BOR-Objekt-ID) *

************************************************************************

  • Objektreferenz auf ein RECIPIENT-Objekt erzeugen

SWC_CREATE_OBJECT SENDER 'RECIPIENT' SPACE.

  • Container leeren

SWC_CLEAR_CONTAINER CONTAINER.

  • Adresse (aufrufender interner Benutzer)

SWC_SET_ELEMENT CONTAINER 'AddressString' SY-UNAME.

  • Adreßtyp (interner Benutzer)

SWC_SET_ELEMENT CONTAINER 'TypeId' 'B'.

  • Aufruf der Methode RECIPIENT.FindAddress

SWC_CALL_METHOD SENDER 'FindAddress' CONTAINER.

  • Ausgabe der zur Ausnahme gehörigen Fehlermeldung

IF SY-SUBRC NE 0.

MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO.

ENDIF.

  • Ermittlung der BOR-Objekt-ID

SWC_OBJECT_TO_PERSISTENT SENDER SENDER_ID.

************************************************************************

  • Empfänger (BOR-Objekt-ID) *

************************************************************************

  • Objektreferenz auf ein RECIPIENT-Objekt erzeugen

SWC_CREATE_OBJECT RECIPIENT 'RECIPIENT' SPACE.

  • Container leeren

SWC_CLEAR_CONTAINER CONTAINER.

  • Importparameter: Adreßtyp (FAX)

SWC_SET_ELEMENT CONTAINER 'TypeId' 'F'.

  • Importparameter: FAX-Nummer

MOVE: LAND TO ADDRESS_STRING,

NUMBER TO ADDRESS_STRING+3.

SWC_SET_ELEMENT CONTAINER 'AddressString' ADDRESS_STRING.

  • Aufruf der Methode RECIPIENT.CreateAddress

SWC_CALL_METHOD RECIPIENT 'CreateAddress' CONTAINER.

  • Ausgabe der zur Ausnahme gehörigen Fehlermeldung

IF SY-SUBRC NE 0.

MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO.

ENDIF.

  • Ermittlung der BOR-Objekt-ID

SWC_OBJECT_TO_PERSISTENT RECIPIENT RECIPIENT_ID.

************************************************************************

  • Aufruf von SAPscript *

************************************************************************

SWC_CLEAR_CONTAINER CONTAINER.

REFRESH RECIPIENT_TAB.

SWC_CALL_METHOD RECIPIENT 'Expand' CONTAINER.

IF SY-SUBRC NE 0.

MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO.

ENDIF.

  • "Flache" Recipient-Objekte aus Container lesen

SWC_GET_TABLE CONTAINER 'ResultTable' RECIPIENT_TAB.

IF SY-SUBRC NE 0.

REFRESH RECIPIENT_TAB.

ENDIF.

  • Loop über die "flachen" Recipient-Objekt.

LOOP AT RECIPIENT_TAB.

  • * Für jedes "flache" Recipient-Objekt ein Aufruf von SAPscript:

  • * BOR-Objekt-ID des Handles ermitteln

SWC_OBJECT_TO_PERSISTENT RECIPIENT_TAB RECIPIENT_ID.

ENDLOOP.

*

  • Rückgaben

*

gv_recipient_id = RECIPIENT_ID.

gv_APPL_OBJECT_ID = APPL_OBJECT_ID.

ENDFORM. " vorlauf

Former Member
0 Kudos

it's crazy

in include is written:

************************************************************************

  • BITTE NEUES INCLUDE CNTN01_SWC benutzen!!!

also there should be used the include CNTN01_SWC unstead but CNTN01_SWC

Edited by: Jürgen Spranz on Jan 29, 2009 7:00 PM