!--a11y-->
Use
With this function it is possible to prevent the current user (SYUNAME) automatically being entered as the sender of a document. A different sender can be specified instead.

The following terms can be differentiated:
This is the user who is responsible for a document. If, for example, a secretary creates a document as a substitute for his or her boss, the boss is the owner and the secretary the creator.
This is the user who is responsible for a sending a document. As a rule, the sender and the owner are the same person. However, this does not have to be the case. The sender is displayed in the transmission information after the document has been sent.
Activities
When creating a document, the required owner must be specified using the import parameter Owner of the
Create method.Before the document is sent, the required recipient must be specified using the import parameter Sender of the SetNextSender method (Sender = Handle for a BOR object, for example, a Recipient object).

The sender can only be set for the next send process, that is, the next Message.Submit. The sender has to be set again for further send processes.

Sending under a different internal user (in this example, the model user)
* Creating a Recipient object that represents the SAP model user:
SWC_CREATE_OBJECT recipient ‚RECIPIENT‘ space.
SWC_SET_ELEMENT container ‚AdressString‘ ‚MODEL‘.
SWC_SET_ELEMENT container ‚TypeID‘ ‚B‘.
SWC_CALL_METHOD recipient ‚CreateAddress‘ container.
PERFORM error_handling.
SWC_CLEAR_CONTAINER container.
SWC_CALL_METHOD recipient ‚Save‘ container.
PERFORM error_handling.
* Creating a document with Owner = ‘Model‘
SWC_CREATE_OBJECT message ‚MESSAGE‘ space.
SWC_CLEAR_CONTAINER container.
SWC_SET_ELEMENT container ‚Originator‘ recipient.
… "Specify further document attributes (for example, title, content, …)
SWC_CALL_METHOD message ‚Create‘ container.
PERFORM error_handling.
* Set sender
SWC_CLEAR_CONTAINER container.
SWC_SET_ELEMENT container ‚Sender‘ recipient.
SWC_CALL_METHOD message ‚SetNextSender‘ container.
PERFORM error_handling.

The Form routine error_handling is responsible for the processing of errors. For example, it issues error messages. After the method call, SY-SUBRC, SY-MSGID, SY-MSGNO, SY-MSGV1, … are set and can be evaluated.
