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_NEW_DOCUMENT_ATT_SEND_API1

Former Member
0 Kudos

Hi experts ,

I am using FM ... SO_NEW_DOCUMENT_ATT_SEND_API1 to send emails

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = l_t_doc_data

put_in_outbox = 'X'

commit_work = 'X'

TABLES

packing_list = l_t_pack

object_header = l_t_objhead

contents_bin = g_t_con_bin

contents_txt = l_t_con_text

receivers = l_t_receivers

eveything is fine with this ....it works fine...

now.. if you go and have a look at this FM in SE37... in TABLES section

<b>CONTENTS_BIN</b> is described as <b>obsolete.</b>

now i have to use this FM along with TABLES -> <b>CONTENTS_HEX</b> instead of using <b>CONTENTS_BIN</b>

can anyone help me how can I go about it.

Please do not post any code from the net.

just tell me how can i use CONTENTS_HEX

<b>What i have tried.</b>

I have tried using conversion FM to convert fom char to hex CHAR_HEX_CONVERSION

and then using the email FM.

<b>NOTE: the table content_hex uses structure SOLIX

which has a data type as RAW</b>

can somone please help.

Points will be rewarded for the helpful answer

Thanks is advance

8 REPLIES 8

Former Member
0 Kudos

Hai Rashmi,

Go through the following Code

DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.

DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.

DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.

DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.

DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.

DATA: DOC_CHNG LIKE SODOCCHGI1.

DOC_CHNG-OBJ_NAME = 'TEST'.

DOC_CHNG-OBJ_DESCR = 'Test-Dokument fur API1 Test'(001).

OBJTXT = 'Mindestgebot : $250000'.

APPEND OBJTXT.

OBJTXT = 'Eine Abbildung des zur Versteigerung stehenden Bildes'.

APPEND OBJTXT.

OBJTXT = 'wurde als Anlage beigefugt.'.

APPEND OBJTXT.

DESCRIBE TABLE OBJTXT LINES TAB_LINES.

READ TABLE OBJTXT INDEX TAB_LINES.

DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).

  • * ERSTELLEN DES EINTRAGS ZUM KOMPRIMIERTEN DOKUMENT

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.

  • * ERSTELLEN DER ANLAGE FUR DAS DOKUMENT

OBJBIN = '\O/ '. APPEND OBJBIN.

OBJBIN = ' '. APPEND OBJBIN.

OBJBIN = ' / \ '. APPEND OBJBIN.

DESCRIBE TABLE OBJBIN LINES TAB_LINES.

OBJHEAD = 'picasso.txt'. APPEND OBJHEAD.

  • * Erstellen des Eintrags zur komprimierten Anlage

OBJPACK-TRANSF_BIN = 'X'.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 1.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = TAB_LINES.

OBJPACK-DOC_TYPE = 'TXT'.

OBJPACK-OBJ_NAME = 'ANLAGE'.

OBJPACK-OBJ_DESCR = 'Abbildung Objekt 138'.

OBJPACK-DOC_SIZE = TAB_LINES * 255.

APPEND OBJPACK.

  • * Fullen der Empfangerliste

RECLIST-RECEIVER = SY-UNAME.

RECLIST-REC_TYPE = 'B'.

APPEND RECLIST.

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

OPERATION_NO_AUTHORIZATION = 4

OTHERS = 99.

Regards

Sreeni

Former Member
0 Kudos

See the below ex:

DATA: LD_ERROR TYPE SY-SUBRC,

LD_RECIEVER TYPE SY-SUBRC,

LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,

LD_EMAIL LIKE SOMLRECI1-RECEIVER,

LD_FORMAT TYPE SO_OBJ_TP ,

LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,

LD_ATTFILENAME TYPE SO_OBJ_DES ,

LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,

LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,

LD_RECEIVER LIKE SY-SUBRC.

LD_EMAIL = P_EMAIL.

LD_MTITLE = P_MTITLE.

LD_FORMAT = P_FORMAT.

LD_ATTDESCRIPTION = P_ATTDESCRIPTION.

LD_ATTFILENAME = P_FILENAME.

LD_SENDER_ADDRESS = P_SENDER_ADDRESS.

LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.

  • Fill the document data.

W_DOC_DATA-DOC_SIZE = 1.

  • Populate the subject/generic message attributes

W_DOC_DATA-OBJ_LANGU = SY-LANGU.

W_DOC_DATA-OBJ_NAME = 'SAPRPT'.

W_DOC_DATA-OBJ_DESCR = LD_MTITLE .

W_DOC_DATA-SENSITIVTY = 'F'.

  • Fill the document data and get size of attachment

CLEAR W_DOC_DATA.

READ TABLE IT_ATTACH INDEX W_CNT.

W_DOC_DATA-DOC_SIZE =

( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).

W_DOC_DATA-OBJ_LANGU = SY-LANGU.

W_DOC_DATA-OBJ_NAME = 'SAPRPT'.

W_DOC_DATA-OBJ_DESCR = LD_MTITLE.

W_DOC_DATA-SENSITIVTY = 'F'.

CLEAR T_ATTACHMENT.

REFRESH T_ATTACHMENT.

T_ATTACHMENT[] = PIT_ATTACH[].

  • Describe the body of the message

CLEAR T_PACKING_LIST.

REFRESH T_PACKING_LIST.

T_PACKING_LIST-TRANSF_BIN = SPACE.

T_PACKING_LIST-HEAD_START = 1.

T_PACKING_LIST-HEAD_NUM = 0.

T_PACKING_LIST-BODY_START = 1.

T_PACKING_LIST-OBJ_NAME = 'stb'.

DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.

T_PACKING_LIST-DOC_TYPE = 'RAW'.

APPEND T_PACKING_LIST.

  • Create attachment notification

T_PACKING_LIST-TRANSF_BIN = 'X'.

T_PACKING_LIST-HEAD_START = 1.

T_PACKING_LIST-HEAD_NUM = 1.

T_PACKING_LIST-BODY_START = 1.

DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.

  • T_PACKING_LIST-DOC_TYPE = LD_FORMAT.

T_PACKING_LIST-DOC_TYPE = 'XLS'.

  • T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.

T_PACKING_LIST-OBJ_DESCR = 'Sales_STB'.

  • T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.

T_PACKING_LIST-OBJ_NAME = 'stb'.

T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.

APPEND T_PACKING_LIST.

  • Add the recipients email address

CLEAR T_RECEIVERS.

REFRESH T_RECEIVERS.

LOOP AT IT_RECV.

T_RECEIVERS-RECEIVER = IT_RECV-EMAIL.

T_RECEIVERS-REC_TYPE = 'U'.

  • T_RECEIVERS-COM_TYPE = 'INT'.

  • T_RECEIVERS-COPY = 'X'.

  • T_RECEIVERS-NOTIF_DEL = 'X'.

  • T_RECEIVERS-NOTIF_NDEL = 'X'.

APPEND T_RECEIVERS.

ENDLOOP.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

DOCUMENT_DATA = W_DOC_DATA

PUT_IN_OUTBOX = 'X'

SENDER_ADDRESS = LD_SENDER_ADDRESS

SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE

COMMIT_WORK = 'X'

IMPORTING

SENT_TO_ALL = W_SENT_ALL

TABLES

PACKING_LIST = T_PACKING_LIST

CONTENTS_BIN = T_ATTACHMENT

CONTENTS_TXT = IT_MESSAGE

RECEIVERS = T_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.

Former Member
0 Kudos

hi shree

thanks for the input ....

I haev already done this part of teh coding.....

can you help me out as to how can i use

CONTENTS_HEX

instead on CONTENTS_BIN in teh following lines

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

DOCUMENT_DATA = DOC_CHNG

PUT_IN_OUTBOX = 'X'

TABLES

PACKING_LIST = OBJPACK

OBJECT_HEADER = OBJHEAD

<b>* CONTENTS_BIN = OBJBIN

CONTENTS_HEX =????????????????????</b>

CONTENTS_TXT = OBJTXT

RECEIVERS = RECLIST

EXCEPTIONS

TOO_MANY_RECEIVERS = 1

DOCUMENT_NOT_SENT = 2

OPERATION_NO_AUTHORIZATION = 4

OTHERS = 99.

thanks

Former Member
0 Kudos

Hi rashmi,

1. No problem, we can still use CONTENTS_BIN.

It will work perfectly fine.

regards,

amit m.

Former Member
0 Kudos

Hi amit,

I know but I still have to use CONTENTS_HEX.

can u please help

Thanks.

0 Kudos

Hi Rashmi,

Check the logic in the standard FM 'FI_SEND_PDF', if this FM is not in your system see SAP note 976306.

Regards,

Rajesh.

Message was edited by:

Rajesh Vankadaru

Former Member
0 Kudos

Hi Rashmi

I have the same query, did you ever get an answer on how to CONTENTS_HEX instead of CONTENTS_BIN.

Thanks

Daniel

0 Kudos

Hi

If u find the solution tell to me also. other wise put in sdn.

send mail to khemanthkumar810@gmail.com