Skip to Content
Technical Articles

Validation check for notes of Dispute CASE

SAP FSCM dispute management provides Notes Functionality to let user can insert Internal Note, Description, Remark, or Reply accordingly. Sometimes, it’s required to validate the contents of the notes, for example, to make sure appropriate key words been updated at specific notes type.It’s clear that BADI SCMG_VLDT_BFR_STR_C should be used to perform customer-defined validation before dispute case saving(you can check this SAP help). But the tricky part is how to fetch the notes from the front end of a dispute case which hasn’t been saved. In this article, I’ll introduce how to validate the notes of the dispute case by using this BADI.

I google and find out this article contains some hints. It’s true that we can get all attributes by use of interface IF_SCMG_CASE, but it’s easy to fetch saved&existed data but not straight forward for temporary data that haven’t been recorded at table level. Many thanks to Pragya Pande give me the below useful advice which includes the key approach to fetch notes from the case and also becomes the backbone of this article.

“Dear Jimmy, there is a method to get the subcomponents of the case. Whichever BADI you implement, there would be the instance of the case provided as an input to it. Please cast it to IF_SCMG_CASE_API and you would get a method to access the subcomponents. These subcomponents are also instances of the various classes for those subcomponents. For note subcomponent, there will be an interface that will have methods like get a note or get texts. I don’t remember further details as I am out of this for some years now. However, please put a breakpoint in the BADI you are implementing and check the attributes of the case provided to the BADI. If you use the new debugger then it is easier to view class instances in debugging. Hope this helps…I had also written a blog on how to use case API. Perhaps that can help you with some details on the API”

I get the map then let’s start the journey to fetch the new inserted noted.

1. Input signature IM_CASE

which refers to IF_SCMG_CASE. Get front end data by using its method IF_SCMG_CASE_READ~MISC_OBJECTS. The first row with ‘FRONTEND’ as ID contains everything we needed at the dispute window.

2.Class cl_scmg_case_visualization_win

Then we can see it’s object type refer to class cl_scmg_case_visualization_win. So we need to create an object using the same type to get data from im_case->if_scmg_case_read~misc_objects by OO casting.

We can see the three main attributes of the case been stored here separately as objects. Again, we need to create an object using the same type used here to get Notes data with FCODE = ‘SUBCOMPONENT_NOTES’.

3. Class CL_SCMG_SUBCOMPONENT_NOTES

Now we go deep to class {O:1174*\CLASS=CL_SCMG_SUBCOMPONENT_NOTES} which contains the real treasure by using OO casting again.
Where are we now? It’s really a big matryoshka doll (just using google translate this word~)

4. Class CL_SRM_POID

The same trick, get LO_POID from the object from casting. But still, it’s not the real pearl we want. I almost give up at this step. Go deep into SRM_ROOT.

5.Class CL_SRM

Here we can’t use casting again as it’s a private attribute. Have to get access into it by its own class’s method IF_SRM~GET_RELATED_OBJECT with class_role = ‘IS_SP_CONTENT_CONNECTION_CLASS’.

6.Class CL_SCMG_SP_CASE_NOTES_BACKEND

Define object refer to CL_SCMG_SP_CASE_NOTES_BACKEND and get data from object casting fetched from the last step. At attribute of cl_scmg_sp_case_notes_backend, Bingo! There’re two tables contains the old notes and new notes separately.
Again, this attributes are protected and can’t using casting anymore. So use method if_scmg_sp_case_notes_backend~get_texts of cl_scmg_sp_case_notes_backend to fetch the new_texts.

Finally, the last nesting doll inside the new texts table we can get header data of notes and its contents:

Now, do the validation whatever you want and popup some message and take a break 🙂

Conclusion:

Yes, BADI SCMG_VLDT_BFR_STR_C can be used to perform customer-defined validation before dispute case saving for sure. Just the journey to fetch temporarily saved notes is full of twists and turns which help me a better understanding  of OO objects~
Maybe I didn’t take the best route, if you have a better approach please kindly let me know. Thanks.

1 Comment
You must be Logged on to comment or reply to a post.
  • How your are getting new text.As you mentioned "Again, this attributes are protected and can’t using casting anymore. So use method if_scmg_sp_case_notes_backend~get_texts of cl_scmg_sp_case_notes_backend to fetch the new_texts"