cancel
Showing results for 
Search instead for 
Did you mean: 

How to validate Extra Fields in Journals

Former Member
0 Kudos

Hi all.

We are working with journals in SAP EPM 10, and we have created several extra fields as a part of the process. as you already know, the extra fields are dummy fields, and we would need to perform some validation when the user save or post the journal.

Is there any way to do it? any badi or something similar?

Thanks in advanced.

Regards

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Look on UJJ_CALCULATED_AMOUNT...

Vadim

Answers (2)

Answers (2)

ivan_blatnik2
Participant
0 Kudos

Hi Alberto!

I am trying to activate this BADI. I copied it from CALCULATED_AMOUNT_SAMPLE_IMPL. I put a hard break-point in the code (see below), but it seems, the code is not executed at all when I post the journal. Is there anything else I have to do to activate this BADI?

Thank you!

Ivan

  DATA: lv_stop TYPE boolean.
    WHILE lv_stop = abap_false.
    ENDWHILE.

Former Member
0 Kudos

Hi Ivan.

the code should be included in the method IF_UJJ_CALCULATED_AMOUNT~CALCULATE_AMOUNTS, and also, you have to add the corresponding filter value with the APPLICATION_ID and APPSET_ID in the enhancement Implementation.

The code should work after performing the Save operation....I don´t remember if it´s also working during the posting.

Hope this help.

Regards.

ivan_blatnik2
Participant
0 Kudos

Hi Alberto,

I did all that you mentioned, but it simply does not work. Is the filter definition important? I did it with following values (FI/PS_RDS is my model/environment):

Regards, Ivan

Former Member
0 Kudos

First of all and just to avoid misunderstandings. For my purpose which was to check the values in the additional fields added into a journal template, I´ve implemented the BADI UJJ_CALCULATED_AMOUNT.

Then, I´ve added the code into the method IF_UJJ_CALCULATED_AMOUNT~CALCULATE_AMOUNTS. That code should work when the user is saving the journal.

If by adding a breakpoint, you are still having problems to debug this piece of code, what you can do  is to add an ABAP code at the beginning of the mentioned method like this:

  DATA:lv.
  lv = 1.
  IF sy-uname EQ 'YOURUSERNAME'.
    WHILE ( lv = 1 ).
      lv = 1.
    ENDWHILE.
  ENDIF.


And after that, in the transaction sm50, you should be able to select and debug the process.


Please let me know if you are ok after that.

Regards.

ivan_blatnik2
Participant
0 Kudos

This is exactly what I've done:

  • implemented BADI
  • put endloop to the code of method IF_UJJ_CALCULATED_AMOUNT~CALCULATE_AMOUNTS
  • saved/posted journal

Save/post was done so it seems BADI was not started, otherways it should be waiting that endloop is finished.

What did you put into filter?

Regards

Ivan

former_member186338
Active Contributor
0 Kudos

What about MODULE_ID: JRN? Not sure...

ivan_blatnik2
Participant
0 Kudos

Sorry Vadim, I don't understand your answer. Could you elaborate pls.

Regards, Ivan

former_member186338
Active Contributor
0 Kudos

Just another filter condition...

ivan_blatnik2
Participant
0 Kudos

Ou, it was the filter - I put wrong model name. Now it works! Thank you.

Former Member
0 Kudos

Thanks a lot Vadim...Yesterday I was blind....

You´re right. In the UJJ_CALCULATED_AMOUNT we have the extra fields available.

Only one problem about it....If I´m not wrong, inside of this BADI, we can´t trigger any message in case something is wrong with some value in the EXTRA FIELDS:

My solution was to create an Custom ABAP class with an static attribute type table UJ0_T_MESSAGE, to store all the messages generated during the checking process and two public methods to save or read the messages.

After that, and using the BADI_UJ_VALIDATION_RULE_LOGIC combined with the method in the custom ABAP class to read the messages, I´m able to publish the error messages generated in order to stop the saving process.

Regards.

former_member186338
Active Contributor
0 Kudos

Hi Alberto,

Look also on:

raise exception type cx_ujj_exception


inside UJJ_CALCULATED_AMOUNT


Vadim

Former Member
0 Kudos

Hi Vadim.

But if you trigger an exception, you can´t specify the error....I mean, if there is a wrong value in one of the extra fields, the final users would not know where is the error, right?

Regards

former_member186338
Active Contributor
0 Kudos

Just check! I don't have now access to the ABAP development...

Vadim