Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with Update function module

Former Member
0 Likes
4,156

Hello All,

We implemented BADI 'BADI_SD_BILLING' and an update function module will be called with update task mode in the method 'INVOICE_DOCUMENT_ADD' .

Initially, a global internal table will be populated in another function module of the same function group and it will be exported.   But when we tried to use that table data in update function module, it is not available.  We tried with SET PARAMETER ID, EXPORT & IMPORT TO MEMORY ID and other options. But none of them are useful. We cannot use shared memory as it will be accessible for all users. We would need to access this data only to a specific user and that too for that specific session. Could you please suggest us the possible approach to access this global table.

Thank you very much.

Regards,

Sri

10 REPLIES 10
Read only

Private_Member_49934
Product and Topic Expert
Product and Topic Expert
0 Likes
2,258

Well Update function module execution is controlled by update work process and not the dialog work procees. So, you are not getting the values.

Can't you modify the function module interface ( I am assuming the update function module is a Z-fm ) to pass the table data while calling the Update FM itself( registering it with IN UPDATE TASK)?

Read only

0 Likes
2,258

We tried by sending that global table as an importing parameter for Update FM. But it was also failed. Any more possible options?

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,258

When the function module will be submitted it will not use the values of the function group in the current luw. You could try using a perform at commit, in the form, read the data stored by the firszt function module, use a "read" fonction module for that, and call in update task the actual update tasl function module.

* somewhere during transaction
CALL FUNCION "Z_CALCULATE_DATA'. " store data in FG TOP
* somewhere (else) during transaction
PERFORM FORM_AT_COMMIT ON COMMIT.

* Transaction validation
COMMIT WORK.

* Form
FORM FORM AT COMMIT.
CALL FUNCTION 'Z_READ_DATA'. " read data back from FG
CALL FUNCTION 'Z_UPDATE_DATA' IN UPDATE TASK. " pass the data in parameters

Regards,
Raymond

Read only

0 Likes
2,258

After the update task FM  call, the COMMIT WORK will be called in the standard code. Do you want me to call it before the update FM call too?

Read only

0 Likes
2,258

No, the COMMIT WORK I mentionned is the COMMIT WORK of the transaction.

Read only

gaurab_banerji
Active Participant
0 Likes
2,258

you need to declare the variable correctly in the function group..

in the function module menu Goto -> Global data .. you will reach the top include for both the FMs..

make sure they both are pointing to the same location and having same variable names...

see simple example here

Read only

0 Likes
2,258

Yes, I have declared in top include itself. But the table does not contain the data in update FM.

Read only

Former Member
0 Likes
2,258

Hi

The functions in update task can not read data from the transaction LUW. Try to export and import the data into shared memory or shared buffer or in better way you can use shared objects technology

Check this link http://help.sap.com/erp2005_ehp_02/helpdata//EN/14/dafc3e9d3b6927e10000000a114084/frameset.htm

Read only

0 Likes
2,258

Hello All,

Solved the issue by creating one normal function module and exporting the relevant table from it. Then enhanced the update FM with one more paramter in Tables so that the same data is available within Update FM.

Regards,

Sri

Read only

adam_krawczyk1
Contributor
0 Likes
2,258

As it was mentioned earlier, the update task does not see memory from LUW.

The best solution is to add parameter to function module called in update.

If that is not an option you may also try to create own function module that exports parameters to memory. If this custom function module is called first, in update mode, then in your destination update function module you will be able to useIMPORT FROM MEMORY ID, data will be there.