Skip to Content
0
Former Member
Oct 03, 2013 at 09:38 AM

SO_DOCUMENT_REPOSITORY_MANAGER - Update Termination

99 Views

Hi,

I'm getting update Termination 'SO 611: Proposed recipient & no longer exists'.

Here's my code:

(T_DATAB[] is the Internal Table that I'm getting from CLOSE_FORM which is of Type 'ITCOO')

DATA: lv_adrnr TYPE kna1-adrnr.

DATA: p_receiver TYPE so_recname.

CLEAR: g_objid,

g_header,

g_hd_dat.

REFRESH g_objhead.

CLEAR: g_user,

g_user_data,

g_fold_type,

g_fold_yr,

g_fold_number,

g_files,

g_header,

g_method1,

g_document,

g_owner.

REFRESH: g_receipients.

g_user-sapname = sy-uname.

CALL FUNCTION 'SO_USER_READ_API1'

EXPORTING

user = g_user

IMPORTING

user_data = g_user_data

EXCEPTIONS

user_not_exist = 1

parameter_error = 2

x_error = 3

OTHERS = 4.

IF sy-subrc NE 0.

MESSAGE 'User does not exist' TYPE 'E'.

ENDIF.

* The Object ID of the folder for the outbox will be stored in

* g_user_data-outboxfol

* get folder details.

g_fold_type = g_user_data-outboxfol+0(3).

g_fold_yr = g_user_data-outboxfol+3(2).

g_fold_number = g_user_data-outboxfol+5(12).

CLEAR w_text.

CONCATENATE 'Invoice #' space nast-objky INTO w_text.

g_method1 = 'SAVE'.

g_document-foltp = g_fold_type.

g_document-folyr = g_fold_yr.

g_document-folno = g_fold_number.

g_document-objtp = g_user_data-object_typ.

g_document-objdes = w_text.

g_document-folrg = 'O'.

g_document-objlen = '0'.

g_header-objdes = w_text.

* save the document

PERFORM f700_repository_manager TABLES g_receipients

g_files

USING g_method1

g_document

g_header.

*The OTF contents are moved to a table of type soli

g_objhead[] = t_datab[].

CLEAR w_text.

CONCATENATE 'Invoice #' space nast-objky INTO w_text.

CONDENSE w_text.

* To attach a Purchase Order

g_objid-objtp = 'RAW'.

g_objid-objyr = g_document-objyr.

g_objid-objno = g_document-objno.

g_header-objdes = w_text.

g_header-file_ext = 'PDF'.

g_hd_dat-objdes = w_text.

* the PO which is in the OTF format is attached.

CALL FUNCTION 'SO_ATTACHMENT_INSERT'

EXPORTING

object_id = g_objid

attach_type = 'OTF'

object_hd_change = g_hd_dat

owner = sy-uname

TABLES

objcont = g_otf_data

objhead = g_objhead

EXCEPTIONS

active_user_not_exist = 1

object_type_not_exist = 2

operation_no_authorization = 3

owner_not_exist = 4

parameter_error = 5

substitute_not_active = 6

substitute_not_defined = 7

x_error = 8

system_failure = 9

communication_failure = 10

OTHERS = 11.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CLEAR : g_method1,

g_receipients.

SELECT SINGLE adrnr INTO lv_adrnr

FROM kna1

WHERE kunnr = nast-objky.

IF sy-subrc EQ 0.

SELECT SINGLE smtp_addr INTO p_receiver

FROM adr6

WHERE addrnumber = lv_adrnr.

IF sy-subrc = 0.

TRANSLATE p_receiver TO UPPER CASE.

ELSE.

MESSAGE 'Error-No email address available in customer record' TYPE 'E'.

ENDIF.

ENDIF.

* The reciepient details are from NAST table and medium is E-MAIL

g_receipients-reclan = nast-tland.

g_receipients-recextnam = p_receiver.

g_receipients-sndex = 'X'.

g_receipients-recesc = 'U'.

APPEND g_receipients.

g_method1 = 'SEND'.

* Using the method 'SEND' as input to the FM

* 'SO_DOCUMENT_REPOSITORY_MANAGER', the receipients will be sent the

* message accordingly based on the transmission medium specified.

PERFORM f700_repository_manager TABLES g_receipients

g_files

USING g_method1

g_document

g_header.

* If the OK CODE is 'ESC',display error message.

IF g_document-okcode EQ 'ESC'.

MESSAGE 'Document not sent' TYPE 'E'.

ENDIF.

gs_folder_id-objtp = g_fold_type.

gs_folder_id-objyr = g_fold_yr.

gs_folder_id-objno = g_fold_number.

CALL FUNCTION 'SO_OBJECT_SEND'

EXPORTING

folder_id = gs_folder_id

TABLES

objcont = g_otf_data

objhead = g_objhead

EXCEPTIONS

active_user_not_exist = 1

communication_failure = 2

component_not_available = 3

folder_not_exist = 4

folder_no_authorization = 5

forwarder_not_exist = 6

note_not_exist = 7

object_not_exist = 8

object_not_sent = 9

object_no_authorization = 10

object_type_not_exist = 11

operation_no_authorization = 12

owner_not_exist = 13

parameter_error = 14

substitute_not_active = 15

substitute_not_defined = 16

system_failure = 17

too_much_receivers = 18

user_not_exist = 19

originator_not_exist = 20

x_error = 21

OTHERS = 22

.

IF sy-subrc <> 0.

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

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

ENDIF.

* To create processing log

syst-msgv1 = g_document-objno.

CALL FUNCTION 'NAST_PROTOCOL_UPDATE'

EXPORTING

msg_arbgb = g_msg_arbgb "VN

msg_nr = g_msg_nr "095

msg_ty = g_msg_ty "I

msg_v1 = syst-msgv1

EXCEPTIONS

message_type_not_valid = 1

no_sy_message = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE 'Error in NAST protocol update' TYPE 'E'.

ENDIF.

*&---------------------------------------------------------------------*

*& Form f700_repository_manager

*&---------------------------------------------------------------------*

*----------------------------------------------------------------------*

* The FM SO_DOCUMENT_REPOSITORY_MANAGER

* 1. saves a folder is sap office for method 'SAVE'

* 2. attaches a file from PC for the method 'ATTCREATEFROMPC'

* 3. sends documents to recipents for the method 'SEND'

*----------------------------------------------------------------------*

FORM f700_repository_manager TABLES l_g_receipients STRUCTURE soos1

l_g_files STRUCTURE g_files

USING l_g_method1 LIKE sy-ucomm

l_g_document LIKE sood4

l_g_header LIKE sood2.

CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'

EXPORTING

method = l_g_method1

office_user = sy-uname

TABLES

objcont = g_otf_data

objhead = g_objhead

recipients = l_g_receipients

files = l_g_files

CHANGING

document = l_g_document

header_data = l_g_header.

IF sy-subrc NE 0.

MESSAGE 'Error sending mail' TYPE 'E'.

ENDIF.

ENDFORM. " f700_repository_manager

I'm using SAPscript.

The Email id that I'm using in the Customer Master record is correct.

Please do help me how to correct this update Termination.

Thanks & Regards,
Sowmya