2012 May 30 7:52 AM
Dear Experts,
I need to validate that entered PO in mb1b belongs to entered vendor.
for this i hv found \PR:SAPMM07M\EX:MM07MFO0_01\EI enhancement point.
I hv written following code
{code}
IF sy-dynnr = '0421'.
IF NOT MSEGK-EBELN IS INITIAL.
DATA : w_ekko TYPE ekko.
SELECT SINGLE * FROM ekko
into w_ekko
WHERE ebeln EQ MSEGK-EBELN.
IF sy-subrc NE 0.
MESSAGE 'Purchase Order does not belongs to this vendor' TYPE E.
ENDIF.
ENDIF.
CLEAR MSEGK-EBELN.
ENDIF.
{code}.
But when i execute mb1b, it validates the po number against vendor, and display an error msg written above.
the problem is, after getting the above msg displayed, the all fields include po number fields get grayed. nothing can be entered in the screen.
Can any one have idea, how i supposed to handle the scanerio.
Thanks in advance.
Jaspal
2012 May 31 6:57 AM
Thanks alot Sachin and kesavadas.
I have done it my onw. And here is the solution.
In INCLUDE MM07MFJ1 of SAPMM07M programe, there is following subroutine
PERFORM J_1B_TEST_PO. This is particularly for Brazil Country.
I enhanced this subrouting and wrote following code.
{code}
IF MSEGK-EBELN IS NOT INITIAL.
*If the PO number don´t exist system gives an error message
SELECT SINGLE * FROM EKKO WHERE EBELN = MSEGK-EBELN.
IF SY-SUBRC <> 0.
MESSAGE E019(06) WITH MSEGK-EBELN RAISING NO_RECORDS_FOUND.
ELSEIF sy-subrc EQ 0 AND ekko-lifnr NE MSEGK-LIFNR.
MESSAGE e000(zerr) WITH MSEGK-EBELN RAISING NO_RECORDS_FOUND.
ENDIF.
ENDIF.
{code}
Thanks again both of you.
2012 May 30 8:04 AM
2012 May 30 8:38 AM
Hi Jaspal,
As you have used error message i.e Type 'E' all the fields will be grayed and you can not enter anything on screen. To make entire screen editable, you can use below code :
MESSAGE E000(ZERR) DISPLAY LIKE 'I' .
where ZERR contains ur message 'Purchase Order does not belongs to this vendor' .
If you want some fieds to be editable , you can make screen-active = '1 ' fo those fields by looping on screen.
Best Regards
Sachin
2012 May 30 10:21 AM
Hi Sachin,
Thanks for ur reply.
I tried as u suggested when the control come to the message line, it does not work. I hv added following code.
{code}
IF sy-dynnr = '0421'.
* BREAK SUNABAP02.
IF NOT MSEGK-EBELN IS INITIAL.
DATA : w_ekko TYPE ekko.
SELECT SINGLE * FROM ekko
into w_ekko
WHERE ebeln EQ MSEGK-EBELN.
IF sy-subrc NE 0.
MESSAGE E000(ZERR) DISPLAY LIKE 'I'.
MESSAGE 'Purchase Order does not belongs to this vendor' TYPE E.
LOOP AT SCREEN.
IF screen-name = MSEGK-EBELN.
screen-active = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
CLEAR MSEGK-EBELN.
ENDIF.
{code}
PO field status is not getting changed into editabl mode.
still grayed.
any suggestion.
with best regards,
jaspal
2012 May 30 11:09 AM
Hi Jaspal,
Inside message class ZERR you need to add 'Purchase Order does not belongs to this vendor' .
For that u need to create anew message class ZERR.
also comment second message line :
MESSAGE 'Purchase Order does not belongs to this vendor' TYPE E.
2012 May 30 11:19 AM
Its not the right place to raise the message. Your idea will not work
Just add the code in the method CHECK_LINE of the badi I have already mentioned.
The only doubt I have is whether it will get triggered for MB* transactions.
2012 May 30 11:51 AM
thanks for ur help.
i had done same. I created a message class. and i hv commmented second line. (By mistake copied it without comment). Its entering into loop but nothing is getting done. PO fields still grayed.
2012 May 30 11:57 AM
Thanks for ur reply.
Itried ur suggestion also. I inserted break-point in badi. but it does not getting hit.
any other suggestion.
Jaspal
2012 May 30 12:01 PM
Hi Jaspal,
Please replace screen-active with screen-input and check.
Regards
Sachin
2012 May 30 12:02 PM
Hi Jaspal,
Please replace screen-active with screen-input and check.
Regards
Sachin
2012 May 31 6:57 AM
Thanks alot Sachin and kesavadas.
I have done it my onw. And here is the solution.
In INCLUDE MM07MFJ1 of SAPMM07M programe, there is following subroutine
PERFORM J_1B_TEST_PO. This is particularly for Brazil Country.
I enhanced this subrouting and wrote following code.
{code}
IF MSEGK-EBELN IS NOT INITIAL.
*If the PO number don´t exist system gives an error message
SELECT SINGLE * FROM EKKO WHERE EBELN = MSEGK-EBELN.
IF SY-SUBRC <> 0.
MESSAGE E019(06) WITH MSEGK-EBELN RAISING NO_RECORDS_FOUND.
ELSEIF sy-subrc EQ 0 AND ekko-lifnr NE MSEGK-LIFNR.
MESSAGE e000(zerr) WITH MSEGK-EBELN RAISING NO_RECORDS_FOUND.
ENDIF.
ENDIF.
{code}
Thanks again both of you.