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

Multiple attachment using SO_NEW_DOCUMENT_ATT_SEND_API1

Former Member
0 Likes
1,697

HI geeks,

Can anyone pls tell me how to attach multiple files using function module SO_NEW_DOCUMENT_ATT_SEND_API1.

I have seen example of multiple attachments using same file type.I mean 1 or more files are same type like PDF or Excel.

But my requirement is i have to send multiple attachment,1 file as PDF and other three excel file.

Can anyone pls let me know,if anyone done this already,

Thanks in advance

Srini.

2 REPLIES 2
Read only

Former Member
0 Likes
557

Hi Srinivasn,

Please see the below code u need to follow. In the object pack table u might specified the number of lines per each attachement. At the same time u need to specify the document type as PDF or XLS. Please see the below code which is wrote for two attachments as xls. In your case one attachment should be PDF. This can be specified in the field

LT_OBJPACK-DOC_TYPE = 'PDF'.

IF NOT LT_ATT_TAB[] IS INITIAL AND

NOT GV_ERR_REC IS INITIAL.

DESCRIBE TABLE LT_OBJBIN LINES LV_TAB_LINES.

LV_TAB_LINES = LV_TAB_LINES - GV_SUC_REC.

READ TABLE LT_OBJBIN INDEX LV_TAB_LINES.

LT_OBJPACK-DOC_SIZE =

( LV_TAB_LINES - 1 ) * 255 + STRLEN( LT_OBJBIN ).

LT_OBJPACK-TRANSF_BIN = 'X'.

LT_OBJPACK-HEAD_START = 1.

LT_OBJPACK-HEAD_NUM = 0.

LT_OBJPACK-BODY_START = 1.

LT_OBJPACK-BODY_NUM = LV_TAB_LINES.

LT_OBJPACK-DOC_TYPE = LC_XLS.

LT_OBJPACK-OBJ_NAME = 'ATTACHMENT'.

LT_OBJPACK-OBJ_DESCR = LV_ATTACH_NAME2(50).

APPEND LT_OBJPACK.

ENDIF. " IF NOT lt_att_tab[] IS ...

  • File2 attachment for processed records.

IF NOT LT_ATT_TAB[] IS INITIAL AND

NOT GV_SUC_REC IS INITIAL.

CLEAR LT_OBJPACK.

DESCRIBE TABLE LT_OBJBIN LINES LV_TAB_LINES.

LV_TAB_LINES = LV_TAB_LINES - GV_ERR_REC.

GV_ERR_REC = GV_ERR_REC + 1.

READ TABLE LT_OBJBIN INDEX LV_TAB_LINES.

LT_OBJPACK-DOC_SIZE =

( LV_TAB_LINES - 1 ) * 255 + STRLEN( LT_OBJBIN ).

LT_OBJPACK-TRANSF_BIN = 'X'.

LT_OBJPACK-HEAD_START = GV_ERR_REC.

LT_OBJPACK-HEAD_NUM = 0.

LT_OBJPACK-BODY_START = GV_ERR_REC.

LT_OBJPACK-BODY_NUM = LV_TAB_LINES.

LT_OBJPACK-DOC_TYPE = LC_XLS.

LT_OBJPACK-OBJ_NAME = 'ATTACHMENT'(009).

LT_OBJPACK-OBJ_DESCR = LV_ATTACH_NAME(50).

APPEND LT_OBJPACK.

ENDIF. " IF NOT lt_att_tab[] IS ...

Thanks

IF NOT LT_ATT_TAB[] IS INITIAL AND

NOT GV_ERR_REC IS INITIAL.

DESCRIBE TABLE LT_OBJBIN LINES LV_TAB_LINES.

LV_TAB_LINES = LV_TAB_LINES - GV_SUC_REC.

READ TABLE LT_OBJBIN INDEX LV_TAB_LINES.

LT_OBJPACK-DOC_SIZE =

( LV_TAB_LINES - 1 ) * 255 + STRLEN( LT_OBJBIN ).

LT_OBJPACK-TRANSF_BIN = 'X'.

LT_OBJPACK-HEAD_START = 1.

LT_OBJPACK-HEAD_NUM = 0.

LT_OBJPACK-BODY_START = 1.

LT_OBJPACK-BODY_NUM = LV_TAB_LINES.

LT_OBJPACK-DOC_TYPE = LC_XLS.

LT_OBJPACK-OBJ_NAME = 'ATTACHMENT'.

LT_OBJPACK-OBJ_DESCR = LV_ATTACH_NAME2(50).

APPEND LT_OBJPACK.

ENDIF. " IF NOT lt_att_tab[] IS ...

  • File2 attachment for processed records.

IF NOT LT_ATT_TAB[] IS INITIAL AND

NOT GV_SUC_REC IS INITIAL.

CLEAR LT_OBJPACK.

DESCRIBE TABLE LT_OBJBIN LINES LV_TAB_LINES.

LV_TAB_LINES = LV_TAB_LINES - GV_ERR_REC.

GV_ERR_REC = GV_ERR_REC + 1.

READ TABLE LT_OBJBIN INDEX LV_TAB_LINES.

LT_OBJPACK-DOC_SIZE =

( LV_TAB_LINES - 1 ) * 255 + STRLEN( LT_OBJBIN ).

LT_OBJPACK-TRANSF_BIN = 'X'.

LT_OBJPACK-HEAD_START = GV_ERR_REC.

LT_OBJPACK-HEAD_NUM = 0.

LT_OBJPACK-BODY_START = GV_ERR_REC.

LT_OBJPACK-BODY_NUM = LV_TAB_LINES.

LT_OBJPACK-DOC_TYPE = LC_XLS.

LT_OBJPACK-OBJ_NAME = 'ATTACHMENT'(009).

LT_OBJPACK-OBJ_DESCR = LV_ATTACH_NAME(50).

APPEND LT_OBJPACK.

ENDIF. " IF NOT lt_att_tab[] IS ...

Venkat

Read only

0 Likes
557

Hello Venkat,

I hv done all the logics wat u hv mentioned.As i understand is if First attachments consists of suppose 180 lines as PDF then i will pass the parameters as follows,

y_wa_objpack-transf_bin = 'X' .

y_wa_objpack-head_start = 1.

y_wa_objpack-head_num = 1.

y_wa_objpack-body_start = 1.

y_wa_objpack-body_num = 180 .

y_wa_objpack-doc_type = 'PDF'.

And if the second attachment is an Excel,and which is having some 20 lines then i will pass the parameter as follows,

y_wa_objpack-transf_bin = 'X' .

y_wa_objpack-head_start = 181.

y_wa_objpack-head_num = 0.

y_wa_objpack-body_start = 182.

y_wa_objpack-body_num = 20 .

y_wa_objpack-doc_type = 'XLS'.

These second parametere i hv directly written ...i mean is this is the correct value as to be passed for second attachemen?

Because i havent understand from ur code like wats GV_ERR_REC.

LV_TAB_LINES = LV_TAB_LINES - GV_ERR_REC.

If its possible pls giv me a full code ,so i can identified wat kind of calculation has to be done.And pls tell my values for second attachments is correct r not,thanks.