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: 

External Send or FAX for shipment info to Customers

Former Member
0 Kudos

Hi,

i already posted a question on this but no replies... trying my luck again...

A very simple question..

Do we need to use function module SO_NEW_DOCUMENT_ATT_SEND_API1 even if we configure the output type for transmission medium 5 (External Send).

Std SAP output type for shipments CPAC uses the Processing Program RLE_TRA_CONFIRM_STATUS and i dont see any code for the above function module.

Appreciate your early reply... Helpful answers will be rewarded..

Tanuja

2 REPLIES 2

p291102
Active Contributor
0 Kudos

Hi,

U can try through this coding also man.

REPORT YMS_MAIL LINE-COUNT 1000.

DATA:

FS_ABAPLIST LIKE ABAPLIST.

*DATA W_RULE(2) TYPE X VALUE '2009'.

DATA:

T_LIST LIKE STANDARD TABLE

OF ABAPLIST.

DATA:

T_DATA(1000) OCCURS 0,

FS_DATA(1000).

DATA:

DOC_CHNG LIKE SODOCCHGI1,

OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,

OBJHEAD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,

OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,

OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,

RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,

EML_TAB LIKE W3HTML OCCURS 0 WITH HEADER LINE,

EML_LINES LIKE SY-TABIX,

L_T_LINES LIKE TLINE OCCURS 0 WITH HEADER LINE,

TAB_LINES LIKE SY-TABIX.

SUBMIT YH647_PRJ_TEST2 AND RETURN.

IMPORT T_LIST FROM MEMORY ID 'MAN'.

LOOP AT T_LIST INTO FS_ABAPLIST.

CONDENSE FS_ABAPLIST.

  • TRANSLATE fs_abaplist using w_rule.

WRITE : / FS_ABAPLIST.

ENDLOOP.

T_DATA[] = T_LIST[].

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = 'D:\test\PRJ1.XLS'

FILETYPE = 'ASC'

  • APPEND = ' '

  • WRITE_FIELD_SEPARATOR = ''

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = T_DATA

  • FIELDNAMES =

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_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.

OBJBIN[] = T_DATA.

**************************************************

DOC_CHNG-OBJ_NAME = 'OFFER'.

DOC_CHNG-OBJ_DESCR = 'Test Program List Output'.

APPEND OBJTXT.

OBJTXT = 'is enclosed as an attachment.'.

APPEND OBJTXT.

DESCRIBE TABLE OBJTXT LINES TAB_LINES.

READ TABLE OBJTXT INDEX TAB_LINES.

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

  • Creating the entry for the compressed document

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.

  • Creating the document attachment

  • (Assume the data in OBJBIN are given in BMP format)

DESCRIBE TABLE OBJBIN LINES TAB_LINES.

OBJHEAD = 'OUTPUT.XLS'. APPEND OBJHEAD.

  • Creating the entry for the compressed attachment

OBJPACK-TRANSF_BIN = 'X'.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 1.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = TAB_LINES.

OBJPACK-DOC_TYPE = 'RAW'.

OBJPACK-OBJ_NAME = 'ATTACHMENT'.

OBJPACK-OBJ_DESCR = 'Test program output'.

OBJPACK-DOC_SIZE = TAB_LINES * 255.

APPEND OBJPACK..

***Recepients List

  • reclist-receiver = 'SAPDEV17'.

  • reclist-rec_type = 'B'.

  • APPEND reclist.

RECLIST-RECEIVER = 'suresh.linga@yash.com'.

RECLIST-REC_TYPE = 'U'.

APPEND RECLIST.

    • Sending the document

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

DOCUMENT_DATA = DOC_CHNG

PUT_IN_OUTBOX = 'X'

COMMIT_WORK = '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.

CASE SY-SUBRC.

WHEN 0.

WRITE: / 'Result of the send process:'.

LOOP AT RECLIST.

WRITE: / RECLIST-RECEIVER(48), ':'.

IF RECLIST-RETRN_CODE = 0.

WRITE 'sent successfully'.

ELSE.

WRITE 'not sent'.

ENDIF.

ENDLOOP.

WHEN 1.

WRITE: /

'no authorization to send to the specified number of recipients!'

.

RAISE TOO_MANY_RECIEVERS.

WHEN 2.

WRITE: / 'document could not be sent to any of the recipients!'.

RAISE DOCUMENT_NOT_SENT.

WHEN 4.

WRITE: / 'no authorization to send !'.

RAISE OPERATION_NO_AUTHORIZATION.

WHEN OTHERS.

WRITE: / 'error occurred during sending !'.

RAISE OTHERS.

ENDCASE.

Thanks,

Sankar M

Former Member
0 Kudos

Thanx Sankar for ur reply..

But i want to use EXTERNAL SEND - 5 only.. as i need to FAX the document if the customer master has the communication method as FAX. Based on the communication method as FAX or EMAIL i need to send the document to the customer...

All the required customizing is done... Only issue i have is on the usage of FM to send mails.. i just want to understand whether the FM is still required or not...

hope u understand my requirement.