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

How to execute Update Module FM after final commit work for a T-code.

Former Member
0 Likes
855

Hello Folks,

I have a bit complex issue with my current object.

We have modified MM41/MM42 transactions and added a subscreen to fulfill the requirement.

We have designed the subscreen and embedded the same to MM41/MM42 through SPRO configuration.

Now for update business logic,i am trying to execute one Function module(Update Module) in update Task...so that it will be executed once after the final commit work will be done for MM41/MM42.

But its not executing.

To fulfill my requirement i need to execute the FM only after Final Commit work for MM41/MM42.

Please suggest in this regard.

Even i can see few BADI's which are triggering through MM01/MM02 but not through MM41/MM42.

BADI_ARTICLE_REF_RT

BADI_MATERIAL_CHECK

BADI_MAT_F_SPEC_SEL

Code with which i am trying is given below.

After PAI event of the subscreen---

1: MODULE USER_COMMAND_9001.

2: MODULE user_command_9001 INPUT.

PERFORM sub_save_mara ON COMMIT.

ENDMODULE.

3: FORM sub_save_mara.

CALL FUNCTION 'ZMMUPDATE_MARA_APPEND_STRUCT' "IN UPDATE TASK

EXPORTING

materialno = gv_matnr

appendmara = ty_zzmara.

ENDFORM. "sub_save_mara

4: FUNCTION zmmupdate_mara_append_struct.

  • "----------------------------------------------------------------------

""Update Function Module:

*"

""Local Interface:

*" IMPORTING

*" VALUE(MATERIALNO) TYPE MATNR

*" VALUE(APPENDMARA) TYPE ZZMARA

*"----


  • Data Declaration for Local use

DATA : w_mara TYPE mara.

  • Selecting the latest values for the material.

SELECT SINGLE * FROM mara INTO w_mara WHERE matnr = materialno.

IF sy-subrc = 0.

  • Move the ZZMARA values to structure MARA

MOVE-CORRESPONDING appendmara TO w_mara.

  • Update the values in table MARA.

MODIFY mara FROM w_mara.

ENDIF.

ENDFUNCTION.

Kindly suggest.Thanks in advance.

Regards

Ansumesh

4 REPLIES 4
Read only

Former Member
0 Likes
746

answered

Read only

0 Likes
746

Could tell us how you resolve it? It could be useful for others.

Greetings,

Blag.

Read only

0 Likes
746

Hi..

The code given by me will work fine provided the Final commit should happen.

Because to execute FM with update task,final commit work should happen which is mandatory and after that it will call the update task.

In my case final commit work was not happeneing because..SAP standard program was not able to detect wether there is any change in my sub-screen or not as the standard program & my custom program,subscreens are different.

As it was not able to detect the change,so final commit was not happening and hence update task also.

To provide the reference of change in my subscreen to standard program ,i set a flag as per the change in the subscreen

And exported the same to memory.

Then Implemented one enhacement spot in MATERIAL_CHANGE_CHECK_RETAIL Fm where i have Imported the flag value.

Based on my custom flag value,i have set one standard flag FLG_AENDERUNG_GES which tells SAP standard program for MM42 wether any change has happened or not.

The above solved my purpose.

Regards

Ansumesh

Read only

0 Likes
746

Thanks a lot! -:) Very appreciated -;)

Greetings,

Blag.