cancel
Showing results for 
Search instead for 
Did you mean: 

Fetch details from workitem.

former_member313782
Active Participant
0 Kudos

Hi,

I have a Travel & expense workflow scenario where in i get workitem id is a rfc bapi call. Based one the wrokitem id i need to fetch the corresponding key fields like the Personal Number and the Trip Number.

How can i acheive this. Is there any FM for the same.

Regards,

Jose

Accepted Solutions (1)

Accepted Solutions (1)

bpawanchand
Active Contributor
0 Kudos

if at all all the details that you want to read are in conatiner then ,use FM SAP_WAPI_READ_CONTAINER function module to read the conatiner elements of the workflow,

Pass the workitem ID to the exporting parameters and import the table parameter from the function module...

former_member313782
Active Participant
0 Kudos

Hi Pavan,

Sorry i could not reply immediately, the net got disconnected.

Anyways, thanks for the quick reply. I think i framed the Q wrong.

The BAPI you suggested asks for the SAP system, i mean it is called from some other system to SAP system. My rewuirement is that i am getting the workitem id from the portal system to SAP so i need t process the details in SAP only using the workitem id. For this i found am FM 'SWK_WI_CONTAINER_READ'

which is giving me the necessary details in a single string concatenated. I am using that for now.

Kindly suggest if there is any other FM which would give the parameters in separate variables other than in a single string concatenated.

Regards,

Jose

former_member262279
Participant
0 Kudos

Hi,

the function module suggested (SAP_WAPI_READ_CONTAINER) is the one you should be using. It only requires the workitem id (where have you found it was asking for the system????)

The function you are using is an internal function not recommended for custom development. Always use the WAPIs where available.

Additionally, this function gives you the workflow container elements in a table with element-value pairs, much easier to process than the string you get with the other one.

bpawanchand
Active Contributor
0 Kudos

I don't think it must be called from other system's , As I accept that it is a RFC function module.

All you have to do is simply pass the workitem ID that your are getting from the portal and pass it to the above FM it will work

and in the tables parameter passs the table of type

SIMPLE_CONTAINER LIKE SWR_CONT Single Container (Name-Value-Pair)

former_member313782
Active Participant
0 Kudos

Hi Rui, Hi Pavan,

Thanks for your replies.

One more thing, When using the Wrapper Bapi also, I am not getting the trip number and emp no details separately in their fields of the structure simple container but still getting them as a string in TRIP field.

Is their something ican do here.

Regards,

Jose

bpawanchand
Active Contributor
0 Kudos

what is the FM that you are using to get the details , I mean you are talking about a WRAPPER BAPI what it is ?

if the values are stored in TRIP field I think by using OFFSET you can get the information into the relevant variables

Can you be more clear on the issue?

former_member313782
Active Participant
0 Kudos

Hi Pavan,

The FM i am using is 'SAP_WAPI_READ_CONTAINER', The SAP_WAPI_.. is a notation for wrapper BAPI. Yes, i got that.. i can get the necessary details from TRIP field using OFFSET, but is there a way to get the emp no and trip no separately? I found that they are also separate fields in the structure but are not getting filled.

Regards,

Jose

former_member262279
Participant
0 Kudos

Hi,

Actually it's Workflow API.

Are you using the standard workflow for expense approval (WS20000040)?

The WI id you have is for the workflow or for the task? Is it task TS20000135 you are using?

vijy_mukunthan
Active Contributor
0 Kudos

Hi jose

I think your doing some wrong think to get around. Even i have worked on Travel expense workflow i never used the way what your are saying. When travel expanse is raised all the trip details is got in the business object BUS2089 itslef. why your exclusively using some FM to get the details?. This business object itslef retrive all the necessary details regarding the trip. In what way ur proceeding triggering event based or what?.

Regards

vijay

Answers (1)

Answers (1)

former_member313782
Active Participant
0 Kudos

Hi all,

Thanks for your support, the issue got solved.

Sorry, my net was not working so i could not reply you all immediately.

Thanks you all once again.