How to attach a document stored in Archive link in a notification

Florin Wach florin.wach at gmx.net
Mon Aug 18 02:12:04 EDT 2008


Hello,

here's some sample coding for generating an URL with an extended expiration.
To create an attachment you'll have to compose a plain text file from the example mentioned below. It is best to use binary format (for sending via the SOFM API) and use cl_abap_char_utilities=>cr_lf to create the line break.

*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZZSCMS LINE-SIZE 255.

*--- Declare var for holding the result URL
DATA: lv_http_uri(8192)             TYPE C,
      lv_absolute_uri(8192)         TYPE C,
      lv_https_uri(8192)            TYPE C.

*--- Set timeStamp for expiration to +10 days from now on

DATA: l_expiration10d               TYPE TIMESTAMP,
      l_date                        TYPE sy-datum,
      l_timeZone_UTC                TYPE TIMEZONE VALUE 'UTC'.

l_date = sy-datum + 10.

CONVERT DATE l_date
        TIME sy-uzeit
        INTO TIME STAMP l_expiration10d
        TIME ZONE l_timeZone_UTC.

CALL FUNCTION 'SCMS_URL_GENERATE'
   EXPORTING
      command    = 'get'
      contrep    = 'X1'
      docid      = '76ADA248DBDE881CE100000048250C94'
      accessmode = 'r'
      signature  = 'X'
      security   = 'B'
      expiration = l_expiration10d
   IMPORTING
      ABSOLUTE_URI = lv_absolute_uri
      HTTP_URI     = lv_http_uri
      HTTPS_URI    = lv_https_uri.


WRITE:/ lv_http_uri.


----------------------

The file format for .URL is the following:

[InternetShortcut]
URL=http://www.yahoo.de



Best wishes,
Florin


-------- Original-Nachricht --------
> Datum: Mon, 18 Aug 2008 11:36:32 +0800
> Von: "Ibrahim Khan" <ikhansap at gmail.com>
> An: "SAP Workflow Users\' Group" <sap-wug at mit.edu>
> Betreff: Re: How to attach a document stored in Archive link in a notification

> Hi Florin,
>   I am getting the following error while using the FM
> SCMS_URL_GENERATE :*"Overflow
> in calculation of URI" *. Please find my coding below.
> 
> CALL FUNCTION 'SCMS_URL_GENERATE'
> EXPORTING
> command = 'get'
> contrep = 'Z1'
> docid =  '76ADA248DBDE881CE100000048250C94'
> accessmode = 'r'
> signature = 'X'
> security = 'B'
> IMPORTING
> ABSOLUTE_URI = lv_abs_uri
> HTTP_URI = lv_http_uri
> HTTPS_URI = lv_https_uri.
> 
> Regards,
> IKhan
> 
> On Fri, Aug 15, 2008 at 5:20 PM, Florin Wach <florin.wach at gmx.net> wrote:
> 
> > hm...
> > As I was using a complete .URL-File holding the hyperLink I didn't have
> > that problem. Anyways we had deactivated the Security-key for the
> archive.
> > Furthermore when creating the URI for the document access keep in mind
> that
> > there's a timeOut of 2hours usually included. To make the link available
> > more longer, you had to use a more underlaying API like
> SCMS_URL_GENERATE
> >
> > For the URL itself and the mail text: As far as I know, Outlook combines
> > hrefs embraces by < and > over linebreaks, so you may split your URL
> into
> > 255char's internal table making it a multi-line element and put a < in
> the
> > first place and > at the very end of the URL.
> >
> > Best wishes,
> > Florin
> >
> > -------- Original-Nachricht --------
> > > Datum: Fri, 15 Aug 2008 16:57:02 +0800
> > > Von: "Ibrahim Khan" <ikhansap at gmail.com>
> > > An: "SAP Workflow Users\' Group" <sap-wug at mit.edu>
> > > Betreff: Re: How to attach a document stored in Archive link in a
> > notification
> >
> > > Hi Guys,
> > >   I am facing one more issue here. Since my URL link is more than 255
> > > characters i am not able to create a virtual attribute, also i tried
> with
> > > FM
> > > SO_NEW... but since the contents table can accept only 255 characters
> i
> > > can't use this as well. Please let me know how to achieve this.
> > >
> > > Thanks.
> > > Ikhan
> > >
> > > On Fri, Aug 15, 2008 at 11:26 AM, Ibrahim Khan <ikhansap at gmail.com>
> > wrote:
> > >
> > > > Hi All,
> > > >   Its working now. I was just seeing the structure output from the
> FM
> > > where
> > > > the link  was not properly formulated. Thanks Florin and Sudhir.
> > > >
> > > >
> > > > On Fri, Aug 15, 2008 at 11:08 AM, Ibrahim Khan <ikhansap at gmail.com>
> > > wrote:
> > > >
> > > >> Hi Sudhir,
> > > >>   Thanks. I got the following output using the function module you
> > > said,
> > > >> but i dont know how to formulate the exact link to that object
> using
> > > this
> > > >> URL field. Pls let me know the same.
> > > >>
> > > >> SAP_OBJECT                 BUS2104
> > > >> OBJECT_ID                     000000010327
> > > >> ARCHIV_ID                      Z1
> > > >> ARC_DOC_ID                  76ADA248DBDE881CE100000048250C94
> > > >> AR_OBJECT                    ZIMOPDF
> > > >> AR_DATE                        08/13/2008
> > > >> DEL_DATE                         /  /
> > > >> URI                         *
> > > >>
> > http://omhq10d5:48020/acsap/dispatcher?get&pVersion=0046&contRep=Z1&do*
> > > >> MIMETYPE                     application/pdf
> > > >>
> > > >> Regards,
> > > >> Ibrahim Khan
> > > >>
> > > >> 2008/8/15 Sudhir Pargaonkar <pargov at gmail.com>
> > > >>
> > > >> Use Function Module "ARCHIVOBJECT_GET_URI"...
> > > >>>
> > > >>> sudhir
> > > >>>
> > > >>> 2008/8/14 Ibrahim Khan <ikhansap at gmail.com>
> > > >>>
> > > >>> Hi Florin,
> > > >>>>   Thanks for your idea. Can you Please let me know from where can
> we
> > > get
> > > >>>> this http link,
> > > >>>> Is there any table using which we can formulate the http link
> using
> > > the
> > > >>>> archive id. Please reply.
> > > >>>>
> > > >>>> Regards,
> > > >>>> Ikhan
> > > >>>>
> > > >>>> On Thu, Aug 14, 2008 at 9:16 PM, Florin Wach
> > > <florin.wach at gmx.net>wrote:
> > > >>>>
> > > >>>>> He Ikhan,
> > > >>>>>
> > > >>>>> I once have programmed a custom send-mail-step that reads the
> > > >>>>> archiveLink-object via the ArchiveLink API and creates a full
> mail
> > > >>>>> attachment from that.
> > > >>>>> Later on I have changed this to an attachment of type .URL
> having
> > > the
> > > >>>>> http-Link of the contentServer to avoid too much
> traffic/storage.
> > > >>>>>
> > > >>>>> Mayhaps you could create a virtual attribute that resolve as a
> > > >>>>> http-link to the archiveLink object and put this in the
> workitem's
> > > long
> > > >>>>> text, so the recipient may click on it?!
> > > >>>>>
> > > >>>>> Best wishes,
> > > >>>>> Florin
> > > >>>>>
> > > >>>>>
> > > >>>>> -------- Original-Nachricht --------
> > > >>>>> > Datum: Thu, 14 Aug 2008 20:42:40 +0800
> > > >>>>> > Von: "Ibrahim Khan" <ikhansap at gmail.com>
> > > >>>>> > An: "SAP Workflow Users\' Group" <sap-wug at mit.edu>
> > > >>>>> > Betreff: Re: How to attach a document stored in Archive link
> in a
> > > >>>>> notification
> > > >>>>>
> > > >>>>> > Hi Akshay,
> > > >>>>> >   Thanks for your reply. It can be done if it is a work item,
> but
> > > >>>>> > notification attachment can be of only type SOFM right, in
> this
> > > case
> > > >>>>> how
> > > >>>>> > to
> > > >>>>> > do. Please advice.
> > > >>>>> >
> > > >>>>> > Regards,
> > > >>>>> > IKhan
> > > >>>>> >
> > > >>>>> > 2008/8/14 <akshay.bhagwat at wipro.com>
> > > >>>>> >
> > > >>>>> > >
> > > >>>>> > > I can think of an option like,  instead of attachment if you
> > can
> > > >>>>> use the
> > > >>>>> > > archived image as object in this notification and use object
> > > link
> > > >>>>> of
> > > >>>>> > this
> > > >>>>> > > object in notification ( which gets displayed in  work item
> > > >>>>> preview), to
> > > >>>>> > > refer the stored PDF image??
> > > >>>>> > >
> > > >>>>> > >
> > > >>>>> > >
> > > >>>>> > > Thanks and Regards,
> > > >>>>> > >
> > > >>>>> > > Akshay Bhagwat
> > > >>>>> > >
> > > >>>>> > > SAP Practice
> > > >>>>> > >
> > > >>>>> > > *Wipro Technologies*
> > > >>>>> > >
> > > >>>>> > >
> > > >>>>> > >
> > > >>>>> > >
> > > >>>>> > >  ------------------------------
> > > >>>>> > > *From:* sap-wug-bounces at mit.edu [mailto:
> > sap-wug-bounces at mit.edu]
> > > >>>>> *On
> > > >>>>> > > Behalf Of *Ibrahim Khan
> > > >>>>> > > *Sent:* Thursday, August 14, 2008 1:38 PM
> > > >>>>> > > *To:* SAP Workflow Users' Group
> > > >>>>> > > *Subject:* How to attach a document stored in Archive link
> in a
> > > >>>>> > > notification
> > > >>>>> > >
> > > >>>>> > >  Hi Friends,
> > > >>>>> > >  Is it possible to get the PDF file stored in Archive link
> and
> > > make
> > > >>>>> it
> > > >>>>> > as
> > > >>>>> > > an attachment in a notification. I think we need to get this
> > PDF
> > > >>>>> > attachment
> > > >>>>> > > and convert it into SOFM instance, then only we can make it
> as
> > > an
> > > >>>>> > attachment
> > > >>>>> > > in notification  becoz notification can accept only SOFM
> > > instance
> > > >>>>> right?
> > > >>>>> > > Please let me know how to do this or is there any other
> simple
> > > way
> > > >>>>> to
> > > >>>>> > > convert this attachment to SOFM instance.
> > > >>>>> > >
> > > >>>>> > > * Please do not print this email unless it is absolutely
> > > necessary.
> > > >>>>> *
> > > >>>>> > >
> > > >>>>> > > The information contained in this electronic message and any
> > > >>>>> attachments
> > > >>>>> > to
> > > >>>>> > > this message are intended for the exclusive use of the
> > > addressee(s)
> > > >>>>> and
> > > >>>>> > may
> > > >>>>> > > contain proprietary, confidential or privileged information.
> If
> > > you
> > > >>>>> are
> > > >>>>> > not
> > > >>>>> > > the intended recipient, you should not disseminate,
> distribute
> > > or
> > > >>>>> copy
> > > >>>>> > this
> > > >>>>> > > e-mail. Please notify the sender immediately and destroy all
> > > copies
> > > >>>>> of
> > > >>>>> > this
> > > >>>>> > > message and any attachments.
> > > >>>>> > >
> > > >>>>> > > WARNING: Computer viruses can be transmitted via email. The
> > > >>>>> recipient
> > > >>>>> > > should check this email and any attachments for the presence
> of
> > > >>>>> viruses.
> > > >>>>> > The
> > > >>>>> > > company accepts no liability for any damage caused by any
> virus
> > > >>>>> > transmitted
> > > >>>>> > > by this email.
> > > >>>>> > >
> > > >>>>> > > www.wipro.com
> > > >>>>> > >
> > > >>>>> > > _______________________________________________
> > > >>>>> > > SAP-WUG mailing list
> > > >>>>> > > SAP-WUG at mit.edu
> > > >>>>> > > http://mailman.mit.edu/mailman/listinfo/sap-wug
> > > >>>>> > >
> > > >>>>> > >
> > > >>>>> _______________________________________________
> > > >>>>> SAP-WUG mailing list
> > > >>>>> SAP-WUG at mit.edu
> > > >>>>> http://mailman.mit.edu/mailman/listinfo/sap-wug
> > > >>>>>
> > > >>>>
> > > >>>>
> > > >>>> _______________________________________________
> > > >>>> SAP-WUG mailing list
> > > >>>> SAP-WUG at mit.edu
> > > >>>> http://mailman.mit.edu/mailman/listinfo/sap-wug
> > > >>>>
> > > >>>>
> > > >>>
> > > >>> _______________________________________________
> > > >>> SAP-WUG mailing list
> > > >>> SAP-WUG at mit.edu
> > > >>> http://mailman.mit.edu/mailman/listinfo/sap-wug
> > > >>>
> > > >>>
> > > >>
> > > >
> > _______________________________________________
> > SAP-WUG mailing list
> > SAP-WUG at mit.edu
> > http://mailman.mit.edu/mailman/listinfo/sap-wug
> >



More information about the SAP-WUG mailing list