Application Development and Automation 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: 
Read only

SO_new_document_send_api1

Former Member
0 Likes
852

Hello All,

I to be confronted with a problem

I execute the Transaktion QM02 and the output is claim as Document.

Now I want to send this Document to sapoffice with the

FB SO_NEW_DOCUMENT_SEND_API1

Is it possibe to make it.

our system is 6.20.

Can someone help me to this problem?

I'd appreciate it very much.

Thanks!

Regards,

Bertram

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
758

Dear Bertram,

check out the following code :-

call function 'SO_NEW_DOCUMENT_SEND_API1'

exporting

document_data = maildata

document_type = 'RAW'

put_in_outbox = 'X'

tables

object_header = mailtxt

object_content = mailtxt

receivers = mailrec

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.

I think it should work

just correct syntax errors.

If helpful reward points

Regards,

Sachin

3 REPLIES 3
Read only

Former Member
0 Likes
759

Dear Bertram,

check out the following code :-

call function 'SO_NEW_DOCUMENT_SEND_API1'

exporting

document_data = maildata

document_type = 'RAW'

put_in_outbox = 'X'

tables

object_header = mailtxt

object_content = mailtxt

receivers = mailrec

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.

I think it should work

just correct syntax errors.

If helpful reward points

Regards,

Sachin

Read only

Former Member
0 Likes
758

Hi all,

But now a question.

I don’t know how to fill Field maildata and Table mailtxt.

call function 'SO_NEW_DOCUMENT_SEND_API1'

exporting

document_data = maildata &#61664; ( fill ??? )

document_type = 'RAW'

put_in_outbox = 'X'

tables

object_header = mailtxt &#61664; ( fill ??? )

object_content = mailtxt

receivers = mailrec

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.

Any idea?

Thanks!

Regards,

Bertram

Read only

0 Likes
758

HI

just go through this sample code

Sending a confidential RAW document to an internal user and an Internet address. The new document is also placed in the sender's outbox.


DATA: OBJCONT LIKE SOLISTI1 OCCURS 5 WITH HEADER LINE.

DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.

DATA: DOC_CHNG LIKE SODOCCHGI1.

DATA: ENTRIES LIKE SY-TABIX.

DATA: NAME(15).


* Fill the document

DOC_CHNG-OBJ_NAME = 'URGENT'.

DOC_CHNG-OBJ_DESCR = 'Read at once !'.

DOC_CHNG-SENSITIVTY = 'P'.

OBJCONT = 'Hey guys, time for lunch !!!'.

APPEND OBJCONT.

OBJCONT = 'Lets get going !'.

APPEND OBJCONT.

DESCRIBE TABLE OBJCONT LINES ENTRIES.

READ TABLE OBJCONT INDEX ENTRIES.

DOC_CHNG-DOC_SIZE = ( ENTRIES - 1 ) * 255 + STRLEN( OBJCONT ).

* Fill the receiver list

CLEAR RECLIST.

RECLIST-RECEIVER = SY-UNAME.  " replace with <login name>

RECLIST-REC_TYPE = 'B'.

RECLIST-EXPRESS = 'X'.

APPEND RECLIST.

CLEAR RECLIST.

RECLIST-RECEIVER = 'ned.neighbour@next.door.com'.

RECLIST-REC_TYPE = 'U'.

APPEND RECLIST.

* Send the document

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

     EXPORTING

          DOCUMENT_TYPE  = 'RAW'

          DOCUMENT_DATA  = DOC_CHNG

          PUT_IN_OUTBOX  = 'X'

     TABLES

          OBJECT_CONTENT = OBJCONT

          RECEIVERS      = RECLIST

     EXCEPTIONS

          TOO_MANY_RECEIVERS         = 1

               DOCUMENT_NOT_SENT          = 2

              OPERATION_NO_AUTHORIZATION = 4

               OTHERS                     = 99.

    CASE SY-SUBRC.

      WHEN 0.

        LOOP AT RECLIST.

          IF RECLIST-RECEIVER = SPACE.

            NAME = RECLIST-REC_ID.

          ELSE.

            NAME = RECLIST-RECEIVER.

          ENDIF.

          IF RECLIST-RETRN_CODE = 0.

            WRITE: / NAME, ': succesfully sent'.

          ELSE.

            WRITE: / NAME, ': error occured'.

          ENDIF.

        ENDLOOP.

      WHEN 1.

        WRITE: / 'Too many receivers specified !'.

      WHEN 2.

        WRITE: / 'No receiver got the document !'.

      WHEN 4.

        WRITE: / 'Missing send authority !'.

      WHEN OTHERS.

        WRITE: / 'Unexpected error occurred !'.

    ENDCASE.

Notes

To send an existing document, you must use the function module SO_OLD_DOCUMENT_SEND_API1.

If the active user is still to be able to process the document after it has been sent, it must be moved to the outbox when sent using the flag PUT_IN_OUTBOX. You can use the function module SO_FOLDER_READ_API1 to read the contents of the outbox and the object ID to find the document sent.

It is not possible to use a user address name as the recipient since this may not be unique. To get around this problem, you can use the function module SO_NAME_CONVERT_API1. This provides a hit list in response to a specified name, for which a dialog is constructed with a choice of required values.

Regards Rk