cancel
Showing results for 
Search instead for 
Did you mean: 

service call to function module not fetching updated data

Harsh9
Participant
0 Kudos

Hello Experts,

I have developed one web dynpro application from which I am making a service call to Z function module. This function module call is triggered on click of a button from user interface.

Now, suppose my web dynpro application is loaded in the browser. At the very same time, SAP user updates the relevant data to function module, using the standard transaction in system. Now if function module is executed using tcode SE37, it returns updated data.

But when same function module is triggered on the click of button from the application which is loaded in browser, data values returned are not updated.

I am very surprised by the behavior of this. Help me get through this.

Regards,

Harsh

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Harsh,

That is weird situation. May be data is not committed while saving. Try to come out of standard t-code after performing required transaction.

Try to debug the function module when you trigger from WD and check what is the data stored and fetched at runtime.

Regards,

Rama

Harsh9
Participant
0 Kudos

Hello,

I don't think there is any issue related to data being committed because if I execute the same function module using the tcode SE37, it gives just updated data.

Only when I trigger a service call to function module on the click of a button from the already loaded web dynpro application, it does not return just updated data.

If I refresh the URL of already loaded web dynpro application, then it will fetch updated data on the click of a button.

Regards,

Harsh

Former Member
0 Kudos

If I refresh the URL of already loaded web dynpro application, then it will fetch updated data on the click of a button.

Hi,

There might be issue in passing any exporting parameters(if any) to the FM while you the lauch the screen and clicking the button.

As you mentioned that it is fetching data on refreshing already loaded screen. Try to debug the FM and check where it is failing.

Thanks

KH

Harsh9
Participant
0 Kudos

Hello,

Parameters that I am passing from the code and in SE37 screen are identical. I debugged it and it runs successfully.

Only when transaction is carried out on SAP system while my web dynpro application is loaded in browser, and if I click the SEARCH button on web dynpro application, it does not fetch just updated data. At the very same moment, if I execute the same function module using tcode SE37, it fetches updated data.

Then, when I refresh the URL of my already loaded web dynpro application, then click on SEARCH button, it fetches the updated data.

I am still surprised by this unusual behavior.

Regards,

Harsh

Former Member
0 Kudos

Hi,

Check the FM behaviour in debugging. I.e debug it on the click of search button and check why is failing to show the updated data.

If your FM has any returning parameter namely LT_RETURN, check if it is returning any error.

Thanks

KH

Harsh9
Participant
0 Kudos

Hello Katrice,

Thanks for your prompt reply.

I debugged it on the click of button. My Z function module is calling to a standard function module which in turn fetches data from table. Though the data at table level is updated, call to standard function returns the old value to that record. LT_RETURN is being returned empty.

Has it anything to do with buffer?

Regards,

Harsh

ramakrishnappa
Active Contributor
0 Kudos

Hi Harsh,

Could you share the name of standard FM? Lets us check the available options.

You try the below scenarios

scenario 1:

          Open WD application and do not click BUTTON to fetch data,

          update the data parallel to it and now click the button ( first time click after the data update )

          Now, check if FM loads UPDATED data into buffer and gets to you.

Scenario 2:

          Open WD application and click on button to fetch data

          Now, FM gives you the existing data

          Update data using standard t-code

          Again click button ( 2nd time ) to get the data, if it gets you the old data / new data

Regards,

Rama

Harsh9
Participant
0 Kudos

Hello,

Thanks for your reply.

Your direction towards scenario 1 help me encountering the new behavior.

If I load my application, then update data using the SAP transaction, then click on search button, it gives updated data.

But in scenario 2, it fetches the old data if called from web dynpro code but gives updated data if executed from tcode SE37.

Regards,

Harsh

Former Member
0 Kudos

I think it might be due to data in a buffer. Try to clear the variables initially and check.

Thanks

KH

ramakrishnappa
Active Contributor
0 Kudos

Hi Harsh,

Okay, then something to do with FM parameters.

Please share the name of standard FM, let us see the options.

Regards,

Rama

Harsh9
Participant
0 Kudos

Hello,

If it is about data in buffer, I would like to make a point that buffering is done on application server.

Here, in this case, if I make a call to function module using SE37, it gives me updated data (so we can say it is not using any buffer).

But if I call using the click on the button, it gives me old data (so it is using buffered data).

Is it possible? Please throw some light on this.

Thanks and Regards,

Harsh

Harsh9
Participant
0 Kudos

Hello,

Parameters to Z function module in any case are same, let it be from web dynpro or directly using SE37.

Call to standard FM "CRM_ORDER_READ" is made from Z function module.

Thanks & Regards,

Harsh

Former Member
0 Kudos

Hi,

Check this blog if it can help you.

CRM_ORDER_READ simple example (for those new to CRM and/or ABAP)

Thanks

KH

ramakrishnappa
Active Contributor
0 Kudos

Hi Harsh,

You need to initialize the buffer before calling FM : crm_ORDER_READ.

Try the below FM to initialize: CRM_ORDER_INITIALIZE  or check if any best FM available for buffer comparison CRM_ORDER_*

Hope this helps you.

Regards,

Rama

Harsh9
Participant
0 Kudos

Hello,

After you pointed towards CRM_ORDER_INITIALIZE, I analysed it and it is now working absolutely fine

Thanks & Regards,

Harsh

ramakrishnappa
Active Contributor
0 Kudos

Thats great

Answers (0)