cancel
Showing results for 
Search instead for 
Did you mean: 

Selection popup for print preview in SAP SRM 7

matteo_montalto
Contributor
0 Kudos

Hello gurus,

I'm facing a task for a desired specification on SRM 7.0.

On Purchase Order and Contracts WD views, there's a button called "Print Preview" which triggers a smartform-generated function module.

In our scenario, a specific BADi implementation contains the logic that selects the specific smartform that will be triggered.

Now, the desiderata is as follows:

- for CERTAIN DOCUMENTS, e.g. the ones which refer to a specific organization, we should generate a selection popup in which the user can choose which type of smartform has to be triggered. This event (the selection popup) should be triggered by the pressure of the "Print Preview" button.

So far, lots of doubts... I hope someone could give an hint on the task:

- since "Print Preview" is a button that belongs to the WD "FPM_OIF_COMPONENT" (view CNR_VIEW), first of all, how can I check for condition on the document to determine whether the popup should be triggered or not? In other words: how can I check @FPM level data of the underlying document?

- what's the easiest way to trigger a popup after the button has been pressed?

I've seen that *any* button on FPM_OIF_COMPONENT triggers the method "ONACTIONBUTTON_PRESSED"; should I enhance the method by creating a pre-exit which checks against doc's data and eventually triggers a popup?

- How can I then propagate user's selection to the underlying layer? As far as I've seen, Smartform determination is performed AFTER the button has been pressed, so ... does the solution sketched above make sense, or there's another spot in which is useful to introduce my custom routines?

Thanks to anyone which would give me hints or suggestions on the task.

Kind regards,

M.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You should NOT modify or enhance the FPM standard components. Please spend some time reading the document Julia recommended and you will save yourself a LOT of time later.

For any FPM application there is a "master controlling WDA component" that you could enhance. This is NOT the FPM_OIF_COMPONENT/FPM_GAP_COMPONENT/FPM_OVP_COMPONENT.

matteo_montalto
Contributor
0 Kudos

Hello Abdullah, hello Julia,

I'm getting a bit lost on the documentation you suggested me, got some basic concepts about FPM and "how it works" but then, the Dev's Guide is quite tecnical and huge so it's not easy for me to get rid of all the information.

Hope you can direct me throu the basic steps I should perform (and also, eventually, sections of the dev guide which specifically can help me); now that something is a bit clearer, hope I can formulate the task a bit better.

SRM 7.0 shows information about Purchase Orders throu different WD Component/windows/views, but the "above" FPM toolbar has the following characterization:

/SAPSRM/WDA_L_FPM_OIF
FPM_OIF_COMPONENT
FPM_WINDOW
CNR_VIEW
/SAPSRM/WDCC_FPM_OIF_PO_PURCH

I have to modify a "standard" behaviour of the "Print preview" button:

PRINT_PREVIEW
BUTTON
STANDARD

So that, under certain assumptions based on the document's type, a popup window must be shown. User could then make his selection and press the "Ok" button, and in such a scenario, the normal "PRINT_PREVIEW" event should be processed. Obviously, if the user presses the "cancel" button, no event should be triggered.

I understood I will not have to modify/enhance directly FPM_OIF_COMPONENT, tried a bit to see FLUID but I'm a bit confused, I think I need some directions on how to proceed.

As MANY WD components share the same toolbar in the process and that one is characterized by a specific configuration_id, I presume I'll have to deal with that first.
Any suggestion/help/hint? Abdullah told there's a master controlling WDA Component that I could enhance, but I didn't understand how to locate that.

Thanks again

EDIT: this link seems interesting...

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/30d28efa-54a5-2e10-0f85-902da5c147b1&override...

Following the above link, I tried to create an enhancement for the configuration /SAPSRM/WDCC_FPM_OIF_PO_PURCH of the component FPM_OIF_INTERFACE. But.. Once in Component Configuration I cannot add a "Dialog Box", as the option is not available from the dropdown menù. Only "Variant" and "Confirmation screen" are available.

Former Member
0 Kudos

What is the main WDA component defined in the FPM application configuration?

matteo_montalto
Contributor
0 Kudos

Hi Abdullah, thanks for your support

Where can I see that? Accessing to the Component Configuration /SAPSRM/WDCC_FPM_OIF_PO_PURCH leads me to the following screen:

https://dl.dropbox.com/u/26770376/Capture.PNG

in which multiple WD components are used as UIBB, each one under a tab of the main tabstrip ("Overview", "Header", "Items" and so on).

How can I find the main WDA component in component configuration?

Once again, thank you very much for your help.

Former Member
0 Kudos

On the left-hand side, you will see two radio buttons: Initial Screen & Variant. There are three buttons right below them with the display button being the only active one. When you click that button, there should be 3 options, one of them will tell you the main WDA component.

matteo_montalto
Contributor
0 Kudos

Hello Abdullah and thanks for your support,

That "display" button shows only 2 entries. Clicking for "Global Settings" I get the following info:

Application specific parameters:

Web Dynpro Component: /SAPSRM/WDC_FPM_OIF_CONF

Configuration Name: /SAPSRM/WDCC_FPM_APPCC_PO_PURCH

Configuration Type: 00

Configuration Variant: <blank>

Transient Parameters:

Transient state: N

I guess that /SAPSRM/WDC_FPM_OIF_CONF is the main WD Component we were looking for.

So I presume a right approach should be enhancing that WD Component, for example by making a pre-exit for the COMPONENTCONTROLLER->process_event method.

I tried (just to understand the call stack) BUT it seems that that method isn't triggered.

Is this approach correct ? Am I missing something?

Thanks in advance, really appreciate your support.

Matteo

matteo_montalto
Contributor
0 Kudos

Update... first of all, happy new year to everyone!

Tried to enhance /SAPSRM/WDC_FPM_OIF_CONF and in particular, I tried to make a pre-exit on the OVERRIDE_EVENT_OIF method (which seems to be triggered by *any* event of the application).

I tried to paste the following code just to test the functionality of event suppression: e.g.

   IF io_oif->mo_event->mv_event_id = 'FPM_PRINT_PREVIEW'.

* here I will insert my popup code, but for now, just trying to stop the current event

     io_oif->cancel_event( ).

   ENDIF.

and found that the above call sets the attribute  MV_EVENT_CANCELLED to 'X', which I suppose is going to be further evaluated by the standard code. However, I tried to follow in debug mode and even though FPM_PRINT_PREVIEW has been marked as cancelled, the event is anyway triggered.

I found no similar cases on SCN, am I supposing wrong or should I search for sap notes on the argument?

EDIT: adding some spice on the mistery... ... there should be something wrong as the PROCESS_EVENT method in the COMPONENTCONTROLLER of the wd appCC /SAPSRM/WDC_FPM_OIF_CONF is never triggered. Could this be related to the first problem ( the event cannot be cancelled )? I guess these two things are strictly binded.

Former Member
0 Kudos

Happy New Year to you too. Please note that the PROCESS_EVENT is called for every single event in the event queue for every single UIBB involved in the process. Now, having said that, you might cancel one event, but that does not mean other events in the event queue won't be called. In addition to marking the event as canceled, I believe you need to fill the return result as OK (meaning that you already handled that event). If you leave the return result field blank, the system will assume it is still not handled and could process it further.

Answers (2)

Answers (2)

TusharShinde
Active Participant
0 Kudos

PLease check mail...Replied through mail, few documents on FPM for your reference.

I would recommend you to spend some time on FPM & WD Concepts to avoid any future issues because of enhancements in Standard applications.

FPM Concept is so awesome, and the best part is events wherein you can perform any custom plug-ins into standard appplications just by simply creating a Custom/Delegated Component Configuration, Introducing your own Custom UIBB for your custom process specific enhancements.

Please check the documents.

Thanks & Regards

Tushar S

julia_bender
Active Participant
0 Kudos

Hi Matteo,

I recommend our FPM starter kit for you which helps to understand the basic concepts of FPM:

There it is also described how to react when an FPM event is raised (e.g. when a button of the global toolbar has been pressed). Do not enhance the method as described above.

If you read our cookbook and search for PROCESS_EVENT, you will get a clear answer.

Best regards,

Julia

matteo_montalto
Contributor
0 Kudos

Hello Julia and thanks for your valuable help,

I didn't have the time to read the documentation you referred to, I'll check that asap.

In the meantime, I tried to sketch a bit of code by enhancing the ONACTIONBUTTON_PRESSED method of the CNR_VIEW (component FPM_OIF_COMPONENT).

I tried to create a pre-exit in which, only if "Print Preview" button has been pressed, then a popup window has to be triggered. This just to give an idea:

* try - call popup window
   DATA lo_window_manager TYPE REF TO if_wd_window_manager.
   DATA lo_api_component  TYPE REF TO if_wd_component.
   DATA lo_window         TYPE REF TO if_wd_window.

   lo_api_component  = wd_comp_controller->wd_get_api( ).
   lo_window_manager = lo_api_component->get_window_manager( ).
   lo_window         = lo_window_manager->create_window(
                      window_name            = 'POPUP_WINDOW'
*                    title                  =
*                    close_in_any_case      = abap_true
                      message_display_mode   = if_wd_window=>co_msg_display_mode_selected
                      close_button           = abap_true
                      button_kind            = if_wd_window=>co_buttons_ok
                      message_type           = if_wd_window=>co_msg_type_none
                      default_button         = if_wd_window=>co_button_ok
                      ).
* Set the height and width here
   lo_window->set_window_size( width = '30%' height = '20%' ).


   lo_window->open( ).

The above sketch works, opening a popup window (POPUP_WINDOW) in which a custom view has been created. That was EXACTLY what I was looking for, but... there's a problem.

The execution of the code that follow is not stopped by the popup execution. I'd rather expect that the main process has to wait until the user pressed "ok" on the popup view.

Tried also to assign an action to the OK button for the popup but that didn't stop the main process flow. Am I missing something?

p.s. : the popup shows a multiple radiobutton for user selection. Results of the selection should just be stored on a table, so there's no param I should pass back to the caller. Just a standalone popup

julia_bender
Active Participant
0 Kudos

Hello Matteo,

every modification you do within the FPM components directly, you influence every other FPM application and customer developments running within your system! This will lead to unforeseeable and very strange side effects and we don't recommend that at all !!! You are changing the FPM runtime and so you and others don't have any control afterwards.

FPM has so many nice concepts - give the documentation and info material a chance and use these concepts which make your life much more easier.

So my suggestion would be: Remove this modification and use our eventing concept, where you just ask which event has been raised and then you can do everything what you want.

Best regards,

Julia

matteo_montalto
Contributor
0 Kudos

Thanks Julia, thanks Abdullah,

I'm gonna give documentation a try in order to make the things right 😉 it should help me understanding FPM a bit more.

Just to clarify, however, I was enhancing with all the restriction measures in order to execute my custom code only in case of printing preview, and only when processing purchase orders or contracts.

Anyway, if I understood it right, such an enhancement way could interfere with future developments which will use FPM_OIF_COMPONENT and lead to problematic issues.

I'm going to read docs, I'll be back here to ask you in case of doubts

Thanks for your support and patience

julia_bender
Active Participant
0 Kudos

Your welcome!

Former Member
0 Kudos

You are welcome; one thing to keep in mind is that FPM is domain-independent meaning that it does not (and should never) care whether you are working with SD, MM, or any other line of business or functional area.

matteo_montalto
Contributor
0 Kudos

Hello Julia,

I'm trying to understand the eventing concept from the cookbook, in particular as you suggested for what concerns the PROCESS_EVENT.

I found that method in the COMPONENTCONTROLLER of each WD Component which is used by the application (say, each WD Comp./view which is used as UIBB for the application, as we can see from the screenshot of the Component Configurator: https://dl.dropbox.com/u/26770376/Capture.PNG ).

That's because every WD Component involved in the process implements IF_FPM_UI_BUILDING_BLOCK.

As you noticed I don't know almost anything of FPM (and find that cookbook quite difficult ), but an idea could be: I could enhance the PROCESS_EVENT method of the specific COMPONENTCONTROLLER of any WD component in order to code my logic. True that?

The problem is that the standard SRM 7 application /SAPSRM/WDA_L_FPM_OIF has a lot of WD component, so the above approach seems not 'smart', as I should replicate the code on every COMPONENTCONTROLLER -> process_event method for each WD Component.

There should be a single process_event method used by all the WD Component involved, so that my modifications should be coded once and adopted by the entire application.

Am I on the right path?