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

Problem with SO_NEW_DOCUMENT_ATT_SEND_API1 FM

0 Likes
835

Hi all,

I have a problem with the SO_NEW_DOCUMENT_ATT_SEND_API1 fm. I have a body with two or more lines and in the email I only receipt the first line. My call to FM is the next:


  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = gd_doc_data
      put_in_outbox                = 'X'
      commit_work                 = 'X'
    TABLES
      packing_list                    = it_packing_list
      contents_txt                   = it_body
      receivers                        = it_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.

Thanks all,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
797

Hi Lydia,

Try this way:-

DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
  DATA: doc_chng LIKE sodocchgi1.
  DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
  DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
  DATA: objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE.
  DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
  DATA: tab_lines LIKE sy-tabix.
objtxt-line+0  = 'User-Id'.
    objtxt-line+15 = 'Delete date'.
    objtxt-line+30 = 'Status'.
    APPEND objtxt.
    CLEAR: objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
  READ TABLE objtxt INDEX tab_lines.
  doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).

  CLEAR objpack-transf_bin.
  objpack-head_start = 1.
  objpack-head_num = 0.
  objpack-body_start = 1.
  objpack-body_num = tab_lines.
  objpack-doc_type = 'RAW'.
  APPEND objpack.

  objhead = 'Status of Deleted Users'.
  APPEND objhead.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = doc_chng
      put_in_outbox              = 'X'
    TABLES
      packing_list               = objpack
      object_header              = objhead
      contents_bin               = objbin
      contents_txt               = objtxt
      receivers                  = reclist
    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.

Manas M.

6 REPLIES 6
Read only

Former Member
0 Likes
797

Hi,

What is the type with which you are declaring table 'it_packing_list' ?

Thanks,

Archana

Read only

0 Likes
797

DATA: gd_doc_data LIKE sodocchgi1,

it_packing_list TYPE TABLE OF sopcklsti1 INITIAL SIZE 10 WITH HEADER LINE,

it_receivers TYPE TABLE OF somlreci1 INITIAL SIZE 10 WITH HEADER LINE,

it_body TYPE TABLE OF solisti1 INITIAL SIZE 10 WITH HEADER LINE. " Cuerpo del mensaje

Thanks!

Read only

Former Member
0 Likes
798

Hi Lydia,

Try this way:-

DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
  DATA: doc_chng LIKE sodocchgi1.
  DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
  DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
  DATA: objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE.
  DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
  DATA: tab_lines LIKE sy-tabix.
objtxt-line+0  = 'User-Id'.
    objtxt-line+15 = 'Delete date'.
    objtxt-line+30 = 'Status'.
    APPEND objtxt.
    CLEAR: objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
  READ TABLE objtxt INDEX tab_lines.
  doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).

  CLEAR objpack-transf_bin.
  objpack-head_start = 1.
  objpack-head_num = 0.
  objpack-body_start = 1.
  objpack-body_num = tab_lines.
  objpack-doc_type = 'RAW'.
  APPEND objpack.

  objhead = 'Status of Deleted Users'.
  APPEND objhead.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = doc_chng
      put_in_outbox              = 'X'
    TABLES
      packing_list               = objpack
      object_header              = objhead
      contents_bin               = objbin
      contents_txt               = objtxt
      receivers                  = reclist
    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.

Manas M.

Read only

0 Likes
797

Thanks!!!

it works correctly....

Read only

0 Likes
797

Sorry Kumar...but...OCCURS? WITH HEADER LINE? That's old school ABAP programming -;)

Greetings,

Blag.

Read only

0 Likes
797

Hi Blag,

Yes you are right...That code was written 7 years back.

We dont use occurs with header line as of now.

Thanks for your respose.

Manas M.