Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
RiccardoEscher
Active Participant
0 Kudos

Preamble

The history of this blog series:
Pep Up Your ChaRM - Part 1: HowTo Create a Smart e-Mail Action
Pep Up Your ChaRM - Part 2: a CRMD_ORDER Slimming Cure
Pep Up Your ChaRM - Part 3: Turn Cinderella PDF-Mails into Pretty&Usefull Ones

This time we will present a small and lightweight blog. The next weekend we will refresh via system copy our Q systems, so we have to push the colleagues to finish and close the ChaRMs they left lying around. Obviously praying to the fishes is more effective than our appeals, so probably we will have to do the closing ourselves.

Many ChaRMs can be closed via the service report, but not all.  So we will get repeatedly this brain dead nag screen:


Sometimes this screen appears more than one time when doing a status change.

Do you love it too?

A pestilent dialog!

By the way, this nag screen is also really dangerous! Two years ago our hotline became incandescent because nobody could create a hotfix.

Finally they found my hideout; I analysed the situation: A user was owning four locks, one of them locking the maintenance plan itself. The user was not responding to my calls so I closed his session. I tried then to reproduce the locks but I didn't succeed in creating such a long during lock of the maintenance plan itself. So I asked the user by mail what the hell he was doing to be able to lock the ChaRM for hours and when he came back from his meeting he sent me in his candour this screen shot:

You probably have already noticed that the nag screen appears when it wants; in this case the nag screen decided to attack the user only after he started the status change to "In development".
First the user confirmed the creation of the transport requests. As he was short of time, he hurried to a meeting without waiting for this status change to be finished. So when the nag screen appeared he was not there to quit it.
Murphey rules! The change document he was asked to accept was the SDMN of the maintenance plan itself! (This happened during the status dependand action SET_BO_LINK_TO_CHANGE_DOC).

I opened a customer message hoping to get a note which eliminates this pestilent screen, but pitifully I received only a workaround: Go into the IMG SAP Solution Manager -> Scenario-Specific Settings -> Change Request Management -> Extended Configuration -> Change Transaction -> Change Transaction Types -> Make Settings for Change Transaction Types (Id SOCM_MAIN_001) and delete the existing entry (marked in red):

Did you wonder why the nag screen appears sometimes twice? Now you know it: You have also to accept changes to predecessor documents.

I cannot immagine which deeper sense it might have to have every ChaRM user to accept (or not) the maintenance plan. So I can only suggest to all to use this workaround!

In my understanding the only feature of this dialog is to decide if you want to appear as the Current User (partner function SDCD0004) of the ChaRM. There is a Condition CHECK_PROCESSOR, that generates a warning message 020(SOCM_ACTION_LOG). And there is the transaction S_DMC_47000022 "Changes to be Processed by Me" which uses this partner function for selection.

We have the policy that users should always answer YES to the question. So why bother them? The ony one who would answer NO to the nag screen question is an amministrator who needs to help a user and doesn't want to touch the actual assignment.

Best would have been if the pop up dialog offered the additional choice: "Answer always yes" plus a check-box "Never ask me again", but this simple ergonomic feature is not provided by the standard. So we have to code our own solution.

Disinfection

To make both the administrator and the user happy we will create a new user parameter which gives the user the chance to choose what he wants: automatic yes, automatic no or please ask.

The screen itself is called inside the call back function module SOCM_CRM_PA_ACTUAL_PARTNER. You can see it with transaction CRMV_EVENT (Selections: BUS2000116 - 1 Immediately - STATUS- BEFORE_CHANGE). We will have to enhance this function module. We prefer this over the replacement with a customer function module because so we participate to further development if any.

First we create with SE80 in one of our customer packages the user parameter (SPA/GPA Parameter) ID ZSV2I_CHARM_AUTO_ACC "Charm: autom. accept CD (X=Yes, -=No, else ask)".

To enhance SOCM_CRM_PA_ACTUAL_PARTNER we need to insert an enhancement-section around the call of the loved pop-up (before you start coding, please have a look if SAP note 1334845 "SE38: Dump when creating an enhancement section" needs to be implemented).

First open in SE37 the function module in change mode, then select the call of the popup:

Then go to Menu -> Edit -> Enhancement Operations -> Create Enhancement. You will get a new dialog "Create Enhancement Option", the radio button "Enhancement Section" is already selected.
Please do not press ENTER, but first insert the ID of the Enhancement Section (we choose "POP_TO_CONFIRM_TURNOUT"), then press the button "append new row" to create a new enhancement spot and insert all needed values for this spot before pressing ENTER:

Save and generate. Now we are ready to change the behaviour of the coding by replacing the coding embraced by the enhancement section with our own one.

First we leave the change mode of the function module. Then we call Menu -> Function Module -> Enhance Source Code (or press the button with the helix), then we put the cursor in the line with the ENHANCEMENT-SECTION selecting it and call context menu -> Enhancement Implementation -> Create Implementation.

We get a small dialog asking us for a name and a short text. We insert ZSV2I_EICM42 "ChaRM Enhance SOCM_CRM_PA_ACTUAL_PARTNER" and select the same package when saving (if we have before created a switch in this package we can also connect the enhancement implementation to this switch, so that the implementation itself can be switched on and off).

The system creates the ENHANCEMENT as a new edit section under the section and copies the old coding of the section into it. We edit now our coding and then save & activate the enhancement.

SOCM_CRM_PA_ACTUA_PARTNERS will finally appear like this:


IF lv_partner_guid <> lv_partner_guid1.
IF lv_partner_guid IS NOT INITIAL.
*{ REPLACE C2IK901968 1
* CALL FUNCTION 'POPUP_TO_CONFIRM'
* EXPORTING
* titlebar = text-001
* text_question = text-002
* text_button_1 = text-003
* text_button_2 = text-004
* display_cancel_button = 'X'
* IMPORTING
* answer = lv_answer
* EXCEPTIONS
* text_not_found = 1
* OTHERS = 2.
ENHANCEMENT-SECTION POPUP_TO_CONFIRM_TURNOUT SPOTS ZSV2I_ESCM14 .
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = text-001
text_question = text-002
text_button_1 = text-003
text_button_2 = text-004
display_cancel_button = 'X'
IMPORTING
answer = lv_answer
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
END-ENHANCEMENT-SECTION.
*$*$-Start: POPUP_TO_CONFIRM_TURNOUT------------------------------------------------------------$*$*
ENHANCEMENT 1 ZSV2I_EICM43. "active version
* 2009/10/23 Escher Call pop up "Accept document" only
* when the user likes it
DATA:
zlv_param TYPE boolean.

GET PARAMETER ID 'ZSV2I_CHARM_AUTO_ACC' FIELD zlv_param.
IF sy-subrc > 0 OR
( sy-subrc = 0 AND zlv_param NA 'X-' ). "X = Yes, - = no
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = TEXT-001
text_question = TEXT-002
text_button_1 = TEXT-003
text_button_2 = TEXT-004
display_cancel_button = 'X'
IMPORTING
answer = lv_answer
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
ELSE.
IF zlv_param = 'X'.
lv_answer = '1'. "simulate YES, accept
ELSE.
lv_answer = '2'. "simulate NO, do not accept
ENDIF.
ENDIF.
ENDENHANCEMENT.

*$*$-End: POPUP_TO_CONFIRM_TURNOUT------------------------------------------------------------$*$*
*} REPLACE
IF ( lv_answer = '2' ) OR
( lv_answer = 'A' ).
Enjoy!