cancel
Showing results for 
Search instead for 
Did you mean: 

SRM 7.0 Process Approval Workflow

0 Kudos

Hi

I have configured the schema ok (using RR_Employee to test the names) and the various process levels are being correctly used ok.

Now, i am trying to create a Badi copy to provide the correct approver names.

I need to grab the cost center from the shopping cart line item detail, and then using that value, will go across to ECC and find the approver from a custom table of approvers and cost centers.

My problem is that if i create a shopping cart and then 'Save', then 'Order', the cost center is found ok for the GUID, but if i create the SC and go straight to 'Next' and then 'Order' (without the intermediate 'Save' step) the cost center comes back as not found for the GUID, I think because at the time I examine the GUID table entry, there isnt one, and so no cost center found,  its not yet been updated, could anyone offer some advice?

Thanks

John

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi

Thanks for your answer, does this approach ensure that the problem I was seeing, i.e.the table entry not being available when the badi ran, is prevented?

From your code above, How would i then extract the value of the Cost Center?

Thanks

John

Former Member
0 Kudos

Hi John,

I am facing the same issue like you had with the "Migration on SAP HR of document hosted on IXOS" (see your post http://scn.sap.com/thread/1104461). Did you manage to work around that? Could you please help me on that, I am stuck and can´t figure out how to successfully migrate the multipage documents.

Thanks a lot in advance!

Wojtek

konstantin_anikeev
Active Contributor
0 Kudos

Hi John,

You will not see shopping cart in DB until you save or order it. Data storen in memory. With the sc object you can get acces to this buffer via /sapsrm/cl_pdo_factory_sc_adv=>get_buffered_instance() or (in nothing buffered) to db-instance via /sapsrm/cl_pdo_factory_sc_adv=>get_instance()

But always first from memory. For example, yuo ordered a SC, approver opens it and changes cost center, without saving to database, then click on approval preview. Your logic will read wrong (old) data from database.

After you got instance on shopping cart - you can call it's methods.

1. Get guids for not deleted items

2. Get accounting data for selected guids

Regards

Konstantin

0 Kudos

Hi

Thanks for your reply.

I added the code as you suggest and have the break point kicks in, but i still cant see the accounting data, any more code help would be very helpful, how do i call the accounting data method on the instance? to return the cost center?

John

konstantin_anikeev
Active Contributor
0 Kudos

Hi John,

something like...

lo_sc~/SAPSRM/IF_PDO_DO_ACCT_ASSGMNT~GET_ACCOUNT_ASSIGNMENT

IV_PARENT should be position guid

Regards

Konstantin

0 Kudos

Hi

That was all a great help. Thanks.

One more question, do you know the FM name that i could use, to examine a SRM Authorization Role to see what the value of some of the personalisation / parameter values are? (its not allocated to a user, so i cant use the BADI get user ...

Thanks

John

konstantin_anikeev
Active Contributor
0 Kudos

Hi John,

depends on personalization, you want to read.

In general you have CL_PERS_ADMIN class for personalization settings...

cl_pers_admin=>get_data

or

cl_pers_admin=>get_data_role

But some personalizations are already wrapped into function modules: like BBP_SPERS_WFL_SECURITY    

Regards

Konstantin

0 Kudos

Hi

In the schema, If the process level logic is true, and the new Badi runs to bring back an Approver, eg a cost center responsible person, but the cost center hasnt been maintained fully, and no responsible person has been added.

What is the correct way, and how would I implement it, to trap the error, and send error back to the SC creator, saying No Approver' has been found.

Thanks John

konstantin_anikeev
Active Contributor
0 Kudos

Hi John,

Normally, if responsible approver can not be determined, the method /SAPSRM/IF_EX_WF_RESP_RESOLVER~GET_FALLBACK_AGENTS is used to route the Workflow to support user, which can reject shopping cart w/o correct approver or route it the responsible person.    

Regards

Konstantin

0 Kudos

Ok thanks for that.

I have most of the approval working now, thanks to your invaluable help.

Two other areas that aren't working yet are, which you may be able to help with , are:

1/  the use of program RSWUWFMLEC to send email notifications. Debugging shows that new tasks are being identified, but then there is a compare against table entries in /SAPSRM/C_WF_100, which all show as Approval Process Framework type  = PC (which is correct) but then because of this value, all the new tasks picked up are deleted.

Is this program only for Application controlled tasks? is there another program i should use for sending out emails.

2/ When the SC is Approved or Rejected, no message is sent to the SC requester

Regards

John

konstantin_anikeev
Active Contributor
0 Kudos

Hi John,

1. /SASRM/OFFLINEAPPROVALSEND

2. You sould use Alert/Notification schema.

Please create new discussion for new questions - it will be more easy to find later with key key words.

Regards

Konstantin

Answers (1)

Answers (1)

konstantin_anikeev
Active Contributor
0 Kudos

Hi John,

I would say - never read standard tables from database. Use classes for that.

Example see here

  1.       lo_sc = /sapsrm/cl_pdo_factory_sc_adv=>get_buffered_instance( is_document-document_guid ). 
  2.       IF lo_sc IS NOT BOUND. 
  3.         lo_sc = /sapsrm/cl_pdo_factory_sc_adv=>get_instance( iv_header_guid   =     is_document-document_guid 
  4.                                                              iv_mode          =     /sapsrm/if_pdo_constants_gen_c=>gc_mode_display ). 
  5.       ENDIF. 

Regards

Konstantin