Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhancement in MB1B

former_member355168
Participant
0 Kudos
343

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

1 ACCEPTED SOLUTION

former_member355168
Participant
0 Kudos
140

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.

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.

10 REPLIES 10

kesavadas_thekkillath
Active Contributor
0 Kudos
140

Try validating it in the badi MB_CHECK_LINE_BADI

former_member213851
Active Contributor
0 Kudos
140

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

0 Kudos
140

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

0 Kudos
140

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.

0 Kudos
140

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.

0 Kudos
140

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.

0 Kudos
140

Hi Kesavadas Thekkillath

Thanks for ur reply.

Itried ur suggestion also. I inserted break-point in badi. but it does not getting hit.

any other suggestion.

Jaspal

0 Kudos
140

Hi Jaspal,

Please replace screen-active with screen-input and check.

Regards

Sachin

0 Kudos
140

Hi Jaspal,

Please replace screen-active with screen-input and check.

Regards

Sachin

former_member355168
Participant
0 Kudos
141

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.

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.