Application Development 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: 

SO_DOCUMENT_REPOSITORY_MANAGER - Update Termination

Former Member
0 Kudos

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

17 REPLIES 17

Former Member
0 Kudos

Here's my NACE Config screesnhot:

Please let me know if this okay.

What should be selected for Partner Function? SH or BP?

Why am I getting the above Update Termination?

Please help!

Thanks & Regards,
Sowmya

0 Kudos

Hi Sowmya,

Which place of code you are getting termination ??

Deependra

0 Kudos

I'm unable to debug this program as it runs in the background through some other program.

I think it is at this place:

  PERFORM f700_repository_manager TABLES g_receipients

                                          g_files

                                   USING  g_method1

                                          g_document

                                          g_header.

Thanks & Regards,
Sowmya

0 Kudos

This functionality will performed by update task.

You can debug the program , once enable system debugging and background/update debugging by putting breakpoint on perticular code.

Deependra

gouravkumar64
Active Contributor
0 Kudos

Hi @Sowmya ,

SO611 - It means simply Proposed recipient  no longer exists.

Instead of this FM ,You can use SO_DOCUMENT_SEND_API1 like thomas said in this thread to fill this FM.

http://scn.sap.com/thread/12963

Still of you want to use that SO_OBJECT_SEND,You can check this wiki link to get proper idea

http://wiki.scn.sap.com/wiki/display/Snippets/Abap+EMAIL+Program

For background job debug use - JDBG in command BAR.

Try it.

Hope it will help you.

Thanks

Gourav.

0 Kudos

Hi Gourav,

I tried using SO_DCOUMENT_SEND_API1, but getting 'TD 030: OTF end  command // missing in OTF data' Update Termination.

I've already tried almost all FM's / Classes/objects.

Nothing is working

Thanks,

-Sowmya

0 Kudos

Hi,

TD 030 : OTF data end command missing,that is some common error ,if you search in scn ,you will found many link.

You have to correct that as per your code.

At last I can give you wiki link of sending mail with class, FM,  Frequently asked question + notes.

I think you have tried with CL_BCS Class also.

http://wiki.scn.sap.com/wiki/display/ABAP/Sending+Mails+-+Home+Page

Check this.

Otherwise wait for some other advice.

Thanks

Gourav.

0 Kudos

I've even tried CL_BCS too.

Can someone please help me on this?

Thanks & Regards,
Sowmya

0 Kudos

Issue w.r.t 'Proposed Recepient & no longer exists' issue is resolved.

But I'm getting another Update Termination:

Runtime errors         POSTING_ILLEGAL_STATEMENT

Statement "CALL SCREEN" is not allowed in this form.

This program is triggered in the update task. There, the following ABAP/4 statements are not allowed:

-  CALL SCREEN
-  CALL DIALOG
-  CALL TRANSACTION
-  SUBMIT

Please advise how to resolve this issue.

Thanks & Regards,
Sowmya

0 Kudos

Hi Sowya,

If u want to use the class  CL_BCS i will help u.

Please check the below attached sample code.

DATA: send_request       TYPE REF TO cl_bcs.

DATA: text               TYPE bcsy_text.

DATA: document           TYPE REF TO cl_document_bcs.

DATA: sender             TYPE REF TO cl_sapuser_bcs.

DATA: recipient          TYPE REF TO if_recipient_bcs.

DATA: bcs_exception      TYPE REF TO cx_bcs.

DATA: sent_to_all        TYPE os_boolean.

DATA : lv_approved TYPE so_obj_des.

DATA : v_mail TYPE ad_smtpadr.

START-OF-SELECTION.

  lv_approved = '5 line items are pending for yr approval'.

  v_mail = 'kkkk@gmail.com'.

  PERFORM main.

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

*       FORM main                                                     *

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

FORM main.

  TRY.

*     -------- create persistent send request ------------------------

      send_request = cl_bcs=>create_persistent( ).

*     -------- create and set document -------------------------------

*     create document from internal table with text

      APPEND '5 Line Items are pending for your Approval' TO text.

      document = cl_document_bcs=>create_document(

                      i_type    = 'RAW'

                      i_text    = text

                      i_length  = '12'

                      i_subject = lv_approved ).                      "'test created by BCS_EXAMPLE_1' ).

*     add document to send request

      CALL METHOD send_request->set_document( document ).

*     --------- set sender -------------------------------------------

*     note: this is necessary only if you want to set the sender

*           different from actual user (SY-UNAME). Otherwise sender is

*           set automatically with actual user.

      sender = cl_sapuser_bcs=>create( sy-uname ).

      CALL METHOD send_request->set_sender

        EXPORTING

          i_sender = sender.

*     --------- add recipient (e-mail address) -----------------------

*     create recipient - please replace e-mail address !!!

      recipient = cl_cam_address_bcs=>create_internet_address(

                                      v_mail   ).

*     add recipient with its respective attributes to send request

      CALL METHOD send_request->add_recipient

        EXPORTING

          i_recipient = recipient

          i_express   = 'X'.

*     ---------- send document ---------------------------------------

      CALL METHOD send_request->send(

        EXPORTING

          i_with_error_screen = 'X'

        RECEIVING

          result              = sent_to_all ).

      IF sent_to_all = 'X'.

        WRITE text-003.

      ENDIF.

      COMMIT WORK.

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

* *                     exception handling

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

* * replace this very rudimentary exception handling

* * with your own one !!!

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

    CATCH cx_bcs INTO bcs_exception.

      WRITE: text-001.

      WRITE: text-002, bcs_exception->error_type.

      EXIT.

  ENDTRY.

ENDFORM.                    "main

Thanks

Pavan.N

0 Kudos

Thanks for the reply Pavan.

I want to attach the PDF File in the email.

I have an Internal Table of type ITCOO and SOLI.

How can this be converted and attached as PDF?

Thanks & Regards,
Sowmya

0 Kudos

Hi Sowmya,

Please find the below attached link for your requirement.

http://wiki.scn.sap.com/wiki/display/ABAP/Sending+Mails+-+Home+Page

Let me know if u find the issues.

Thanks

Pavan.N

0 Kudos

Hi @Pavan ,

I already provide her this link.

I am confused with her actual issue.

I tried with other Function module / class, but do not know what is happening .

Gourav.

0 Kudos

Its k Gourav thanks for your information.

she want to come up with the exact issue.

Thanks

Pavan.N

0 Kudos

The issue is 'POSTING_ILLEGAL_STATEMENT' Dump.

To use CL_BCS, we have to pass the Itab of type SOLIX.

But my Internal Table is of type SOLI / ITCOO.

ITCOO Internal Table is OTF Format which is from CLOSE_FORM (SAPscript).

How can we convert this to SOLIX type and attach it as PDF File in the email?

Hope you understood my issue.

Kindly revert in case of any queries.

Please do provide your inputs.

Thanks & Regards,
Sowmya

0 Kudos

Sowmaya,

There is 2 way , either you can Convert SOLI_TAB into SOLIX_TAB. SOLI_TAB also could be used in send mail as :

   *-- Add Attachment to the Document
      CALL METHOD us_doc->add_attachment
        EXPORTING
          i_attachment_type    = us_extn
          i_attachment_subject = us_subject
          i_att_content_hex    = us_attcon. " For SOLIX_TAB
*          i_att_content_text   = us_attcon. " For SOLI_TAB

In 2nd  way u can do it like this :

   * Convert the OTF data to PDF data internal table
  CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
      format                = 'PDF'
      max_linewidth         = 132
    IMPORTING
      bin_filesize          = lv_bin_filesize
    TABLES
      otf                   = ta_lt_job_info_otfdata
      lines                 = lt_pdfdata
    EXCEPTIONS
      err_max_linewidth     = 1
      err_format            = 2
      err_conv_not_possible = 3
      err_bad_otf           = 4
      OTHERS                = 5.
  IF sy-subrc <> 0.
    ch_retcode = sy-subrc.
    EXIT.
  ENDIF.

*  Convert PDF from 132 to 255.
  LOOP AT lt_pdfdata INTO ls_pdfdata.
*•  Replacing space by ~
    TRANSLATE ls_pdfdata USING ' ~'.
    CONCATENATE ls_buffer ls_pdfdata INTO ls_buffer.
    CLEAR ls_pdfdata.
  ENDLOOP.
*•  Replacing ~ by space
  TRANSLATE ls_buffer USING '~ '.

  DO.
    ls_record-line = ls_buffer.
*•  Appending 255 characters as a record
    APPEND ls_record TO lt_record.
    SHIFT ls_buffer LEFT BY 255 PLACES.
    IF ls_buffer IS INITIAL.
      EXIT.
    ENDIF.
  ENDDO.

  lt_attachment_data[] = lt_record[].

And at last :-

   CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
      document_data              = ls_doc_data
      put_in_outbox              = 'X'
*     commit_work                = 'X'
      sender_address             = us_uname
      sender_address_type        = space
    IMPORTING
      sent_to_all                = lv_sent_all
    TABLES
      packing_list               = lt_packing_list
      contents_bin               = lt_attachment_data
      contents_txt               = lt_mail_contents
      receivers                  = lt_receivers
    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.

Let me know if u still face any problem ..

Thanks,

Deependra

0 Kudos

Hi Sowmya,

For CL_BCS ,Soli to solix conversion,you can use class

CL_BCS_CONVERT as priyanka suggetsed in this link,

http://scn.sap.com/message/10181388

Also you can send Spool as PDF to email by standard program help ,name is

BCS_EXAMPLE_8.

Check it.

Thanks

Gourav.