Skip to Content
avatar image
Former Member

provide custom error in MB1A and change G/L account change in MB1A

Hi,

I have a requirement where in MB1A t-code for movement type 201/202 any G/L account is accepted currently. User wants to restrict this G/L account to one value say 123.

Now since movement 201 can be used in many scenarios we thought of creating new reason for movement (as 004) and check based on t-code + movement type (201/202) + reason of movement (004).

If G/L account is not 123, we want either of the one to be achieved:

1. Provide an error message to user and user can change the value of G/L account to 123.

- I tried to give error message in user exit

ZXMBCU02

but it greys out all the field, in that user cannot proceed further.

2. Another option I am trying now is to change the G/L account value to 123 (in

ZXMBCU02 and changing value MSEG-SAKTO = 123 (using field symbols as MSEG is a importing parameter here) and provide a pop-up (display) to inform user that G/L account is changed.

But I G/L account is getting replaced to the original value on screen despite all these. Please help me on how G/L account can be changed in MB1A based on certain conditions?

code:

FIELD-SYMBOLS: <SAKTO> TYPE any,

<SAKTO1> TYPE any.


ASSIGN '(SAPMM07M)MSEG-SAKTO' TO <sakto>.

assign (<sakto>) to <sakto1>.


<sakto1> = '0005061020'.

CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Information on G/L account change'
txt1 = 'For movement type 201/202 and reason of movement 004'
txt2 = 'G/L account is defaulted to 5061020'.

I have tried below also, none worked:

MB_DOCUMENT_BADI

(BADI documentation says not to use it to change values)

MM07MFF0_FCODE_BEARBEITEN

(tried a enhancement spot here but it will not here during save in MB1A)

Regards,

Shilpa

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers