SO_DOCUMENT_INSERT_API1(suggested a while ago by Jocelyn Dart )

M Doe monica_sap at hotmail.com
Thu Feb 26 14:14:54 EST 2004


Hi Jocelyn,
 
Thanks for being so patient- you explain things so well that I got the
process working but still having some problems in the next step.
 
I have created an instance of SOFM.  I have an export parameter called
RESULT which is of type object reference and shows the key of SOFM eg.
fol280000xxxxxxxx.
 
So now in my next step in the workflow which is using the
selfitem/sendtaskdescription I am binding the RESULT with ATTACHMENTS(not
_attach_objects).
 
When I test my workflow I get an error saying "method sendtaskdescription
cannot be executed.  Attachment 1 could not be added to the mail.  What am I
doing wrong.  I have the entire "result " in the binding definition- do I
need a part of the key not the entire key?
 
Also another problem is that when I go in SWO1 and run my method the
document is created in my outbox folder which is what I want but when I use
the method in the workflow then the document is created in "wf-batch's "
outbox.     This inspite the fact that I  am actually populating the field
s_user-sapname with my userid before calling the function module -
SO_USER_READ_API1 where I am exporting s_user = s_user.  But somehow it
still puts the document in wf-batch's outbox.
 
Can you please shed some light on this.
 
Thanks in advance for your help.
 
Regards,
Monica
 
 
 
>From: "Dart, Jocelyn" <jocelyn.dart at sap.com>
>Reply-To: SAP Workflow Users' Group <SAP-WUG at MITVMA.MIT.EDU>
>To: SAP-WUG at MITVMA.MIT.EDU
>Subject: Re: SO_DOCUMENT_INSERT_API1(suggested a while ago by Jocelyn Dart
>)
>Date: Fri, 20 Feb 2004 03:52:51 +0100
>
>Hi Monica,
>Creating an instance of SOFM is NOT the same as creating a new document.
>What you want to do is take the existing document that you have just
>created and
>instantiate it - i.e. essentially make it accessible as a business object
>by setting up
>a handle in business object key format to your existing document.
>
>So what you need is the FULL key of your new document so that you can put
>that key
>into business object SOFM format so you can access the attributes, methods,
>etc. of SOFM
>using the document you created earlier.
>
>When you created the document, you specified the folder id to create it in
>and
>the function module returned the document id.   When you called
>SO_USER_READ_API1 it returned the
>details of the folder to put the document in.   So you should have most of
>the key details
>based on the two function modules you called.
>
>It might help to use your code to create a document against your own user
>id, then try using the "Test" option in SWO1 for object type SOFM to
>"Create Instance" of the document - see if you can use the "Find" icon to
>pick your own outbox and find the document you created.  That should help
>you match the key information to the information returned by the two
>function modules.
>
>Hope that helps a little.
>Regards,
>Jocelyn
>
>-----Original Message-----
>From: SAP Workflow [mailto:Owner-SAP-WUG at MITVMA.MIT.EDU] On Behalf Of M Doe
>Sent: Friday,20 February 2004 5:57 AM
>To: SAP-WUG at MITVMA.MIT.EDU
>Subject: Re: SO_DOCUMENT_INSERT_API1(suggested a while ago by Jocelyn Dart
>)
>
>
>Hi Jocelyn,
>
>This is the first time I am working with the "SOFM" object type so I want
>to
>make sure I am understanding the process.  First I use the function module
>"SO_USER_READ_API1" to get info on a SAPoffice user.  Then I use function
>module "SO_DOCUMENT_INSERT_API1" to create a new document of type OBJ in
>the
>folder.  This has been done correctly.
>
>Now I want to create an instance of SOFM an office document.  This is a new
>office document I am creating right?  So this info should not be taken from
>any tables since this is a new instance of SOFM right?  What should the
>folder type be?- how do I know what the folder number should be if this is
>a
>new folder?
>
>Sergery had mentioned to get the folder type , folder yr and folder number
>from s_user_dats which is type soudatai1.  But when I look at that
>structure
>I do not know exactly which is folder type , folder yr  or  number.
>
>Also the document id which is being imported from the function moudule- is
>that part of the key when I create an instance of SOFM or is the doc id
>something I insert in this office document after I create an instance of
>it.
>   If the doc id is part of the key -is it the object number of the key?
>
>Thanks in advance for looking at all these questions- I need to get a clear
>idea of what I am doing. I am getting very confused with this.
>
>Thanks.
>
>Regards,
>Monica
>
>
> >From: "Dart, Jocelyn" <jocelyn.dart at sap.com>
> >Reply-To: SAP Workflow Users' Group <SAP-WUG at MITVMA.MIT.EDU>
> >To: SAP-WUG at MITVMA.MIT.EDU
> >Subject: Re: SO_DOCUMENT_INSERT_API1(suggested a while ago by Jocelyn
>Dart
> >)
> >Date: Wed, 18 Feb 2004 02:00:50 +0100
> >
> >Hi Monica,
> >Take another look at object SOFM - the key is not just DOCID. It has
>about
> >6 parts to it including the
> >folder reference.  So you need to build the full key and then use that
>when
> >creating the SOFM object.
> >Regards,
> >Jocelyn
> >
> >-----Original Message-----
> >From: SAP Workflow [mailto:Owner-SAP-WUG at MITVMA.MIT.EDU] On Behalf Of M
>Doe
> >Sent: Wednesday,18 February 2004 7:47 AM
> >To: SAP-WUG at MITVMA.MIT.EDU
> >Subject: Re: SO_DOCUMENT_INSERT_API1(suggested a while ago by Jocelyn
>Dart
> >)
> >
> >
> >Hi Sergery and Jocelyn,
> >
> >This is what I have so far.  Please tell me what is missing:
> >
> >data: docid type swc_object.
> >DATA: OBJCONT LIKE SOLISTI1 OCCURS 5 WITH HEADER LINE.
> >DATA: SOXOBJCONT LIKE SOXOBJ OCCURS 0 WITH HEADER LINE.
> >DATA: OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
> >DATA: DOC_INFO LIKE SOFOLENTI1.
> >DATA: USER_DATA LIKE SOUDATAI1.
> >DATA: DOC_ID LIKE SOFOLENTI1-DOC_ID.
> >DATA: S_USER_DATS TYPE SOUDATAI1.
> >DATA: DOC_CHNG LIKE SODOCCHGI1.
> >data: folder_id         like soodk.
> >data: s_user type soudnamei1.
> >
> >
> >CALL FUNCTION 'SO_USER_READ_API1'
> >exporting
> >user = s_user
> >IMPORTING
> >
> >USER_DATA = S_USER_DATS
> >
> >EXCEPTIONS
> >
> >OTHERS = 1.
> >SOXOBJCONT-OBJTYPE = 'ZBUS2089'.
> >SOXOBJCONT-OBJKEY = '000104590000000216'.
> >SOXOBJCONT-METHOD = 'DisplayExpenseForm'.
> >append soxobjcont TO OBJECT_HEADER.
> >
> >
> >CALL FUNCTION 'SO_DOCUMENT_INSERT_API1'
> >
> >EXPORTING
> >
> >FOLDER_ID = S_USER_DATS-OUTBOXFOL
> >
> >DOCUMENT_TYPE = 'OBJ'
> >
> >DOCUMENT_DATA = 'TITLE'
> >IMPORTING
> >document_info = doc_info
> >
> >TABLES
> >OBJECT_HEADER = OBJECT_HEADER
> >EXCEPTIONS
> >OTHERS = 1.
> >DOC_ID = DOC_INFO-DOC_ID.
> >swc_set_element container 'doc_info' doc_info.
> >swc_create_object docid 'SOFM' doc_id.
> >
> >
> >
> >When I test the method from SWO1 - I get the following in the export
> >parameters(result) :
> >
> >DOCID <nothing> with object reference icon.
> >
> >Thanks.
> >
> >Regards,
> >Monica
> >
> >
> >
> >
> >
> > >From: Sergey Breslavets <sergey.breslavets at epstechnology.com>
> > >Reply-To: SAP Workflow Users' Group <SAP-WUG at MITVMA.MIT.EDU>
> > >To: SAP-WUG at MITVMA.MIT.EDU
> > >Subject: Re: SO_DOCUMENT_INSERT_API1(suggested a while ago by Jocelyn
> >Dart
> > >)
> > >Date: Thu, 12 Feb 2004 14:13:18 -0600
> > >
> > >Hi Monica,
> > >
> > >1. foldertype (FOL), folderyear and foldernumber should be in the
> > >S_USER_DATS?
> > >2. documenttype, documentyear and documentnumber - from DOC_INFO?
> > >2. you pass SOFM object instance that you've created as the export
> > >parameter
> > >
> > >regards,
> > >Sergey
> > >
> > >
> > >-----Original Message-----
> > >From: M Doe [mailto:monica_sap at hotmail.com]
> > >Sent: Thursday, February 12, 2004 1:46 PM
> > >To: SAP-WUG at MITVMA.MIT.EDU
> > >Subject: Re: SO_DOCUMENT_INSERT_API1(suggested a while ago by Jocelyn
> > >Dart )
> > >
> > >
> > >Hi Jocelyn,
> > >
> > >I did create a subtype to SOFM and added a method to it.  In my method
>I
> > >have the following code:
> > >
> > >DATA: DOCID TYPE SWC_OBJECT.
> > >--
> > >--
> > >
> > >CALL FUNCTION 'SO_DOCUMENT_INSERT_API1'
> > >
> > >EXPORTING
> > >FOLDER_ID = S_USER_DATS-OUTBOXFOL
> > >DOCUMENT_TYPE = 'OBJ'
> > >
> > >IMPORTING
> > >DOCUMENT_INFO = DOC_INFO
> > >
> > >TABLES
> > >OBJECT_HEADER = OBJECT_HEADER
> > >
> > >EXCEPTIONS
> > >OTHERS = 1.
> > >
> > >(then I am extracting the document-id out of the doc info)
> > >DOC_ID = DOC_INFO-DOC_ID.
> > >
> > >(then I want to instantiate a SOFM object reference from the document
>id)
> > >SWC_CREATE_OBJECT DOCID 'SOFM' DOC_ID.
> > >
> > >
> > >Does this instantiate an SOFM object reference only with DOC_ID.
> >Normally
> > >I
> > >know that you need to put the key values of the object.  In this case
> >SOFM
> > >has key values- foldertype, folderyear, foldernumber , type , year,
> >number
> > >and forwardername.  How do I get all these values if I need to specify
> >it.
> > >
> > >Also when I do the above- do I also have to create DOCID as an export
> > >parameter for this method so that I can pass it to the "attachments"
> > >element
> > >of the selfitem-sendtaskdesctiption step.
> > >
> > >I am a little confused.  Please advise.
> > >
> > >Thanks.
> > >
> > >Regards,
> > >Monica
> > >
> > >
> > >
> > >
> > >
> > > >From: "Dart, Jocelyn" <jocelyn.dart at sap.com>
> > > >Reply-To: SAP Workflow Users' Group <SAP-WUG at MITVMA.MIT.EDU>
> > > >To: SAP-WUG at MITVMA.MIT.EDU
> > > >Subject: Re: SO_DOCUMENT_INSERT_API1(suggested a while ago by Jocelyn
> > >Dart
> > > >)
> > > >Date: Thu, 12 Feb 2004 01:14:15 +0100
> > > >
> > > >Hi Monica,
> > > >You need to create a task and method to instantiate a SOFM object
> > >reference
> > > >from
> > > >the folder number, document id, etc.  E.g. you could add a method to
>a
> > > >delegated subtype of SOFM.
> > > >
> > > >Then you can pass it to the "attachments" element of the
> > > >selfitem.sendtaskdescription step.
> > > >Regards,
> > > >Jocelyn
> > > >
> > > >-----Original Message-----
> > > >From: SAP Workflow [mailto:Owner-SAP-WUG at MITVMA.MIT.EDU] On Behalf Of
>M
> > >Doe
> > > >Sent: Thursday,12 February 2004 6:08 AM
> > > >To: SAP-WUG at MITVMA.MIT.EDU
> > > >Subject: Re: SO_DOCUMENT_INSERT_API1(suggested a while ago by Jocelyn
> > >Dart)
> > > >
> > > >
> > > >Hello all,
> > > >
> > > >The mystery is solved- the reason I was not seeing the folder and the
> > > >documents with the workflow is because the task was background and
>the
> > > >workflow user then becomes  wf-batch and therefore the folder was
> >created
> > > >in
> > > >the wf-batch's inbox instead of mine.
> > > >
> > > >When I was running the pgm - I was the user and I could see the
>folder
> >in
> > > >my
> > > >inbox.  Even though in my code, I enter the user name as myself - but
> >for
> > > >some reason it takes wf-batch as the user when the code is part of
>the
> > > >workflow.
> > > >
> > > >Now I need to move on to the next step.  Let me explain why I am
>doing
> > >all
> > > >this- I need to send an object as an attachment with the
> > > >selfitem-sendtaskdescription method.  I looked at the archives to
>find
> > >the
> > > >answer and some time ago Jocelyn Dart had suggested that you can
>insert
> > >the
> > > >document in the folder using the function module
> >"SO_DOCUMENT_INSERT_API"
> > > >and then return the resulting document id as a SOFM object and pass
>it
> >to
> > > >the sendtaskdescription step.
> > > >
> > > >I am able to put the document in the folder as object in my outbox or
> > >inbox
> > > >but how do I return the resulting document id as a SOFM object.   In
>my
> > > >code
> > > >I am importing the document_info into doc_info.  I am then getting
>the
> > > >doc_id out of doc_info.  But my question is how do I make this a SOFM
> > > >OBJECT
> > > >and when I pass it to the sendtaskdescription step do I do the
>binding
> > >with
> > > >the attachment element.
> > > >
> > > >CALL FUNCTION 'SO_DOCUMENT_INSERT_API1'
> > > >-------
> > > >IMPORTING
> > > >document_info = doc_info
> > > >----
> > > >-----
> > > >DOC_ID = DOC_INFO-DOC_ID.
> > > >
> > > >
> > > >Any help would be appreciated.  If you are reading this Jocelyn -
>then
> > > >please explain the final step.  You had suggested this solution in
>2002
> > >so
> > > >it is going back a while.
> > > >
> > > >Thanks.
> > > >
> > > >
> > > >Regards,
> > > >Monica
> > > >
> > > >
> > > >
> > > > >From: Sergey Breslavets <sergey.breslavets at epstechnology.com>
> > > > >Reply-To: SAP Workflow Users' Group <SAP-WUG at MITVMA.MIT.EDU>
> > > > >To: SAP-WUG at MITVMA.MIT.EDU
> > > > >Subject: Re: SO_DOCUMENT_INSERT_API1
> > > > >Date: Tue, 10 Feb 2004 11:11:30 -0600
> > > > >
> > > > >Monica, i came accross the issue with SO documents before - in my
> >case
> > > >the
> > > > >problem was with using the wrong folder (wf-batch tried to create
> > > >document
> > > > >in my private folder) - I think i have switched it to using shared
> > > >folders
> > > > >and it worked. Unfortunately, i don't have immediate SAP access to
> > >check
> > > > >that... do security trace when executing your workflow, if there's
> > >access
> > > > >control problems you'll see it. Also double check parameters for
>the
> >FM
> > > >to
> > > > >make sure you use correct folders.
> > > > >
> > > > >god luck,
> > > > >Sergey
> > > > >
> > > > >
> > > > >-----Original Message-----
> > > > >From: M Doe [mailto:monica_sap at hotmail.com]
> > > > >Sent: Tuesday, February 10, 2004 10:32 AM
> > > > >To: SAP-WUG at MITVMA.MIT.EDU
> > > > >Subject: Re: SO_DOCUMENT_INSERT_API1
> > > > >
> > > > >
> > > > >Hi Stephan,
> > > > >
> > > > >I tried putting the "commit work" statement in my pgm.  It did not
> >make
> > >a
> > > > >difference.
> > > > >
> > > > >The pgm works and creates a folder in my outbox with the document
>as
> >it
> > > >was
> > > > >doing before.  But the workflow even though it says completed does
> >not
> > > > >create a folder in the outbox.  I am using the same pgm behind the
> > >method
> > > > >in
> > > > >the workflow.
> > > > >
> > > > >If the workflow did not create the folder- how do I debug it to
>find
> > >out
> > > > >what went wrong?
> > > > >
> > > > >Regards,
> > > > >Monica
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > >From: "Becker, Stephan" <stephan_becker.ext at siemens.com>
> > > > > >Reply-To: SAP Workflow Users' Group <SAP-WUG at MITVMA.MIT.EDU>
> > > > > >To: SAP-WUG at MITVMA.MIT.EDU
> > > > > >Subject: Re: SO_DOCUMENT_INSERT_API1
> > > > > >Date: Tue, 10 Feb 2004 16:05:45 +0100
> > > > > >
> > > > > >Seems you're lacking a commit work.
> > > > > >Stephan
> > > > > >
> > > > > >-----Mensaje original-----
> > > > > >De: M Doe [mailto:monica_sap at hotmail.com]
> > > > > >Enviado el: 10 February 2004 15:59
> > > > > >Para: SAP-WUG at MITVMA.MIT.EDU
> > > > > >Asunto: Re: SO_DOCUMENT_INSERT_API1
> > > > > >
> > > > > >Hi Sergey,
> > > > > >
> > > > > >Thanks for your response.  I checked the authorization for
> >wf-batch.
> > > >It
> > > > > >has
> > > > > >SAP_ALL and SAP_NEW in the proflie.
> > > > > >
> > > > > >What could be wrong here?
> > > > > >
> > > > > >Regards,
> > > > > >Monica
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > >From: Sergey Breslavets <sergey.breslavets at epstechnology.com>
> > > > > > >Reply-To: SAP Workflow Users' Group <SAP-WUG at MITVMA.MIT.EDU>
> > > > > > >To: SAP-WUG at MITVMA.MIT.EDU
> > > > > > >Subject: Re: SO_DOCUMENT_INSERT_API1
> > > > > > >Date: Mon, 9 Feb 2004 15:48:27 -0600
> > > > > > >
> > > > > > >check authorization for wf-batch
> > > > > > >
> > > > > > >-----Original Message-----
> > > > > > >From: M Doe [mailto:monica_sap at hotmail.com]
> > > > > > >Sent: Monday, February 09, 2004 3:40 PM
> > > > > > >To: SAP-WUG at MITVMA.MIT.EDU
> > > > > > >Subject: SO_DOCUMENT_INSERT_API1
> > > > > > >
> > > > > > >
> > > > > > >Hello all,
> > > > > > >
> > > > > > >I am trying to insert a document in a user's outbox using the
> > > >function
> > > > > > >module "SO_DOCUMENT_INSERT_API1" .  I created a subtype to SOFM
> >and
> > > > > >coded
> > > > > > >this method.  This  works fine( I see the document in the
>user's
> > > > >outbox)
> > > > > > >when I execute the method from swo1 but when I use this method
>in
> >a
> > > > >task
> > > > > > >nothing happens.
> > > > > > >
> > > > > > >I also wrote a pgm with the same code and executed the pgm and
>it
> > > >works
> > > > > >but
> > > > > > >the same code does not work when it is used in the workflow.
> > > > > > >
> > > > > > >Can someone explain why?  I just don't understand what could be
> > > >wrong.
> > > > > >The
> > > > > > >underlying code works so why does it not do anything when I
>have
> >a
> > > >task
> > > > > > >that
> > > > > > >uses this method.
> > > > > > >
> > > > > > >Thanks.
> > > > > > >Monica
> > > > > > >
> > > > > >
> >_________________________________________________________________
> > > > > > >Let the advanced features & services of MSN Internet Software
> > > >maximize
> > > > > >your
> > > > > > >online time.
> > >http://click.atdmt.com/AVE/go/onm00200363ave/direct/01/
> > > > > >
> > > > > >_________________________________________________________________
> > > > > >Let the advanced features & services of MSN Internet Software
> > >maximize
> > > > >your
> > > > > >online time.
> >http://click.atdmt.com/AVE/go/onm00200363ave/direct/01/
> > > > >
> > > > >_________________________________________________________________
> > > > >Click here for a FREE online computer virus scan from McAfee.
> > > > >http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> > > >
> > > >_________________________________________________________________
> > > >Keep up with high-tech trends here at "Hook'd on Technology."
> > > >http://special.msn.com/msnbc/hookedontech.armx
> > >
> > >_________________________________________________________________
> > >Optimize your Internet experience to the max with the new MSN Premium
> > >Internet Software.
> >http://click.atdmt.com/AVE/go/onm00200359ave/direct/01/
> >
> >_________________________________________________________________
> >Store more e-mails with MSN Hotmail Extra Storage   4 plans to choose
>from!
> >http://click.atdmt.com/AVE/go/onm00200362ave/direct/01/
>
>_________________________________________________________________
>Take off on a romantic weekend or a family adventure to these great U.S.
>locations. http://special.msn.com/local/hotdestinations.armx
 
_________________________________________________________________
Say  good-bye  to spam, viruses and pop-ups with MSN Premium -- free trial
offer! http://click.atdmt.com/AVE/go/onm00200359ave/direct/01/
 


More information about the SAP-WUG mailing list