on 02-21-2013 6:32 AM
Hi,
I want to show some Validation Messages.
I did the calculation in a Custome Logic BAdI.
To show the message I wrote :
Data : l_log TYPE String.
IF tot_percent > 1.
l_log = |'Warning : Total Percentage exceeds 100%'|.
cl_ujk_logger=>log( i_object = l_log ).
ENDIF.
Please suggest How to achieve this.
Thanks.
Hi Shubhranshu,
This kind of messages are better handled handled by Validation rules. Check transaction UJ_VALIDATION.
Gersh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If restricting users from entering total percentage more than 100% is what you are looking for, why cannot this be handled in the input form itself, by using the combination of excel formula and simple macro.
Regards,
Sumanth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can add some messages only in write back badi, not in the custom logic badi.
B.R. Vadim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I will show some working code in the write back badi. This code will test if the current member of the account dimension has property IS_INPUT set to Y, and if not set to Y then reject the record and show error in the excel popup message.
ASSIGN COMPONENT 'IS_INPUT' OF STRUCTURE <ls_account_mbr> TO <lf_input>.
IF sy-subrc = 0.
"Disallow writing to members of account dimension with property IS_INPUT<>Y from input schedule or journal (allow for DM only)
IF ( <lf_input> <> 'Y' ) AND ( I_MODULE_ID <> 'DM' ).
CONCATENATE '>> Dimension' <l_account> 'has property IS_INPUT<>"Y". Record rejected.' INTO log_msg SEPARATED BY SPACE.
cl_ujk_logger=>log( log_msg ).
CONVERT_CTDATA2STR( exporting PT_DATA = <ls_record>
PT_DIM_OBJ = IT_DIM_OBJ
importing PT_STR = log_msg ).
CONCATENATE 'IS_INPUT<>"Y">' log_msg INTO log_msg.
ls_message-MSGID = 'ZBPC'.
ls_message-MSGNO = '042'.
ls_message-MSGTY = 'E'.
ls_message-MESSAGE = log_msg.
ls_message-RECNO = sy-TABIX.
APPEND ls_message TO ET_MESSAGE.
APPEND <ls_record> TO ET_ERROR_RECORDS. " Rejected records +1.
DELETE ct_array. "Delete current record
CONTINUE.
ENDIF.
ENDIF.
The message is like this:
Vadim
P.S. The same code can be written in UJ_VALIDATION...
Hi Vadim,
Q 1. How you determine the below values
ls_message-MSGID = 'ZBCP'
ls_message-MSGNO = '042'.
ls_message-MSGTY = 'E'.
Q 2. If you are showing the Error message with the help of ET_MESSAGE,
then you are using " cl_ujk_logger=>log( log_msg ). " statement. What is the use of this line.
Q 3. ET_MESSAGE Parameter is available for Custom Logic also, then why we can't show our Own message from Custom BAdI ?
Thank You
1. I don't remember - from this forum, from How-To guides, debugging the original BPC ABAP code...
2. The log will be written to the log file independent from ET_MESSAGE. It's possible to find this log in UJFS and see this text.
3. As far as I remember the ET_MESSAGE of custom logic badi will not be shown in the Excel popup.
Vadim
Hi Shubhranshu,
Short explanation to Q 1. above.
SAP has a standard way of reporting messages back to user. Message templates are stored in message classes (t/a SE91). So, MSGID is Message Class. Custom message classes start form Z.
Each message has a unique numeric ID - message number. So, MSGNO - is message number.
There is a number of message types that SAP supports - E for error, W for warning, etc.
Usually message also has parameters that are &1, &2, etc in the message and VAR1, VAR2, etc when message is called. Alternatively one can use field MESSAGE, but this makes translation much more difficult.
Hope this helps,
Gersh
I just tried implement the TRIC you talked in your 1st post.
Means,
I just poulated some data in CT_DATA in Custome logic,
then inside Write Back, I am trying to read that data from CT_ARRAY.
and populating the ET_MESSAGE and ET_ERROR_RECORDS.
It's not working.
Can you tell me which part of Code is responsible to write the Data to Output screen?
Thanks
First: create a write back badi and test my code with some modifications to test some condition to ensure that you can see message in excel. The code to write data to output screen is internal BPC code, I only prepare the ET_MESSAGE: APPEND ls_message TO ET_MESSAGE.
Then continue with experiments.
In general:
If you want to validate input and reject records send by user (if something > 100 then reject) - then use badi in validation rule.
If you want to do some calculation like multiply 2 input members and store the result in the 3rd member, but you want also to validate the result - then you can combine both things in write back badi.
Vadim
User | Count |
---|---|
16 | |
3 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.