cancel
Showing results for 
Search instead for 
Did you mean: 

How to capture Action Name triggered at NWBC in SAP TM

Former Member
0 Kudos

Dear TM Experts,

We had written a custom logic at Freight order determination level after SAVE action.

Our requirement is to restrict this custom logic only at SAVE action but currently this is also getting triggered while creating a delivery.

Is their any way to capture Action details at run time at determination level which user clicks on NWBC. I mean to say similar to the way how we can restrict in normal ABAP using SY-UCOMM system field.

Thanks in advance.

Regards,

Md.Rafi

Accepted Solutions (1)

Accepted Solutions (1)

bharath_k6
Active Participant
0 Kudos

Dear Rafi,

Before your custom logic is triggered, retrieve the TOR root data (sample code below).

Put a condition based on the TOR_TYPE and TOR_CAT.

If the TOR_TYPE is Freight order related then continue else return.

  "Retrieve TOR Data

  CLEAR:lt_root.

  CALL METHOD io_read->retrieve

    EXPORTING

      iv_node         = /scmtms/if_tor_c=>sc_node-root

      it_key          = it_key

      iv_fill_data    = abap_true

      iv_before_image = abap_false

    IMPORTING

      et_data         = lt_root.

  READ TABLE lt_root INTO is_root WITH KEY tor_cat COMPONENTS

  tor_cat = /scmtms/if_tor_const=>sc_tor_cat_to

tor_type = ''Freight Order''.

  IF sy-subrc <> 0.

    RETURN.

  ENDIF.

Thanks,

Bharath.K

Former Member
0 Kudos

Hi Bharat,

Thanks for the reply.

I tried with your approach and compared in debug while creation of freight order and creation of delivery. For both cases TOR_TYPE and TOR_CAT are same so it will get executed for both these cases. I want to restrict my code during creation of delivery which will be created from NWBC using FOLLOWUP menu selecting Send delivery proposals to ERP.

Is their any option to avoid custom code while creation of delivery.

Regards,

Md.Rafi

bharath_k6
Active Participant
0 Kudos

Dear Rafi,

You can put a condition based on the  node key like below. and you can also try EXECTIME.

if is_ctx-node_key = /tmpan/if_tor_c=>sc_node-''node name''.


endif.


Thanks,

Bharath.K



Former Member
0 Kudos

HI Bharath and Oliver,

Thanks for the reply.

I checked at both instance 1. While creation of FO 2. Creating delivery with reference to FO. At both cases IS_CTX-EXECTIME = 'H' and node key = 80E0ED0A0C021DDE8CE07DB5DFAD0818.

Is their any way to capture value of user action at NWBC screen with that I can control my requirements similar t the way of sy-ucomm in normal ABAP coding.

Regards,

Md.Rafi

bharath_k6
Active Participant
0 Kudos

Dear Rafi,

Probably you can create pass a dummy and unique parameter in the importing structure of the determination using which you can differentiate what u have triggered.

Try this.

If you want detail coding, let me know.

Pls let me know what is the determination class name. Then i will give you more details.

Thanks,

Bharath.K

Former Member
0 Kudos

Hi Bharat,

My Interface is /BOBF/IF_FRW_DETERMINATION and method is /BOBF/IF_FRW_DETERMINATION~EXECUTE. I am new to BOPF are and I will be very thankful if you can share me sample code to achieve this.

Thanks in advance.

Regards,

Md.Rafi

bharath_k6
Active Participant
0 Kudos

Dear Rafi,

It is not clear how do u create delivery from NWBC in TM system.

But still looking at your requirement to establish a restriction logic, you can try below ways.

It can be done other way around which i call may be dirty 🙂

Check class - /SCMTMS/CL_UI_CONTROLLER_CMN and method - OVERRIDE_EVENT_OVP / TM_TOOLBAR_PE methods. Keep a breakpoint and check whether these are getting executed when your action is performed.

If you look at the code inside the method,  LO_EVENT->MV_EVENT_ID has the FPM event that records what you have triggered in NWBC or POWL or in the application. This FPM Event is unique for each action that you perform.

1. Enhance the class - /SCMTMS/CL_UI_CONTROLLER_CMN  to accommodate global attribute say MV_ACTION_PERF as static attribute.           Either you can create implicit enhancement or pre-exit.

2. You can differentiate what action you have performed based on this FPM Event.

3.Then store some uniuqe value in to MV_ACTION_PERF

4  You can access this global variable MV_ACTION_PERF within your determination to differentiate whether you are trying to process Freight order or delivery.

I am sure this should work, but if not you can try the similar kind of approach in Viewexit classes as well.

Thanks,

Bharath.K

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Rafi,

Create a determination with the property after_save.

This determination will be triggered only when a SAVE is performed. This SAVE may necessarily not be from FPM_SAVE button, it may be triggered from other determination or action as well.

If you want to restrict on ACTION_SAVE, check for the feeder class beneath the FPM and in PROCESS_EVENT the action/event can be checked and accordingly your code can be executed.

Hope this helps you.

Regards,
Sanket.


former_member182889
Active Participant
0 Kudos

A determination never triggers a save.

former_member182889
Active Participant
0 Kudos

Dear Rafi,

I still did not fully get your requirement. Also, I don't know TM (but only BOPF). From a model perspective, da Determination is completely independent of an action: A Determination is triggered implicitly after a certain modification at a defined point in time.

Above, you wrote about two different actions of which on is of interest for your custom logic.

Thus, I wonder why you did not implement your custom logic in an enhancement to this action? Do you really need to enhance the Determination which runs on save? If so, please explain why.

Cheers,

Oliver

former_member182889
Active Participant
0 Kudos

Dear Rafi,

a determination knows from the context at which point in time it is getting triggered from its context (IS_CTX-EXECTIME). SAVE itself is split into multiple phases. Most probably, the determination is configured to run on finalize, so you can have your logic check for the context-value (/BOBF/IF_CONF_C=>SC_TIME_BEFORE_SAVE).

However, if there's a dedicated custom logic which runs only on finalize, I'd recommend to model and implement a custom determination (instead of enhancing the existing one).

Cheers,

Oliver