cancel
Showing results for 
Search instead for 
Did you mean: 

delete entries from WF Container _Attach_Objects before sending via Mail

marc_schn2
Explorer
0 Kudos
500

Hello,

we have a workflow with some decisions and some documents in circulation.

As last step and if all decision steps where marked as “ok” we want to create an email to our supplier with the pdf documents.

Unfortunately the comments of the decision steps are in container element _Attach_Objects as well.

As you can see there are 2 SOFM-entries with doctp = RAW, these are the comments in the decision steps and will be attached as txt-file to the outgoing email as well:

Sometimes the comments in decision steps are not for the supplier 😉

How is it possible to attach only the pdf documents to the outgoing email?

Thanks and regards,

Marc

keohanster
Active Contributor
0 Kudos

You could write a small method which would get the Attach_Objects, weed out the RAW ones, and put back a filtered version of Attach_Objects, which you could then use for your email.

SWC_GET_TABLE CONTAINER 'Attach_Objects' ATTACH_OBJECTS.
[loop through your attach_objects and only append to ZATTACH_OBJECTS when Object Type = RAW]
SWC_SET_TABLE CONTAINER 'ZAttach_Objects' ZATTACH_OBJECTS.

Hope this helps,

Sue

View Entire Topic
marc_schn2
Explorer
0 Kudos

Hello Sue,

well now I have in my new small method a defined table of SOFM and it looks like this:

begin_method delete_attachment changing container.
DATA:  it_sofm TYPE TABLE OF swc_object WITH HEADER LINE,
       is_sofm LIKE LINE OF it_sofm.
DATA: et_sofm TYPE TABLE OF swc_object WITH HEADER LINE.

DATA: wf_obj_type TYPE sofolenti1-obj_type.

swc_get_table container 'ATTACH_OBJECTS' it_sofm.

LOOP AT it_sofm.

  swc_get_object_type it_sofm wf_obj_type.

  IF wf_obj_type <> 'RAW'.
    APPEND it_sofm TO et_sofm.
  ENDIF.

ENDLOOP.


swc_set_table container 'MAILATTACHMENT' et_sofm.

end_method.

Table Entry 3 and 4 are the attachments to delete.

How am i able now to refer to the _ATTACH_OBJECTS? I have to find out witch one of these entries refer to doctp RAW or doctp EXT.

Regards,

Marc

keohanster
Active Contributor
0 Kudos

Hi Marc,

You should create a container element in your WF template container for MAILATTACHMENT (type SOFM) and mark it as importing and multiline. Then, at your task to DELETE_ATTACHMENT, bind _ATTACH_OBJECTS into your method's import parameter (ATTACH_OBJECTS with no underscore) and bind MAILATTACHMENT back as an exporting parameter.

I don't have a system at hand.

Hope this helps,

Sue