Application Development and Automation 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: 
Read only

Back to previous screen with data after error message

Former Member
0 Likes
3,326

Dear Experts,

I have to give error message in BADI - 'ZMB_DOCUMENT_BADI' if some criteria is not satisfied while using MB1B T-Code.

My Requirement is to come back to the previous screen with all the data entered (Vendor , Material, Quantity, Location )and it should allow to edit or enter new record.

Thanks.

17 REPLIES 17
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
2,518

Try to set sy-dynnr screen value before error message and see if it works...but are you throwing error message in it it will disable the screen input please try to use parameters for error log...

Nabheet

Read only

Former Member
0 Likes
2,518

I remember to have used badi for MB1a transaction. mb_check_line_badi~check_line.

But after givin error i was not able to come back to the screen with all inputs enabled.

I guess this is the limitation of this BADI for MB transaction.

Thanks,

Lalit

Read only

0 Likes
2,518

Thanks Lalit/nabheet,

If i use S or I message type and leave to screen sy-dynnr

it ll be back to the same screen and entered data ll be lost.

if we provide data on the same screen again it will giv error again.

Any how could it be possibe to return to the same screen without loosing the data on it

and after editing data it processes.....

Read only

0 Likes
2,518

Dont use leave to screen bro...Just set sy-DYNNR before throwing I/S message and then after message try with return statment.

Nabh

Read only

Former Member
0 Likes
2,518

Try Message E display like I

Read only

0 Likes
2,518

Hi,

'Display like' doesnt work in 4.6c v

and i dint get how return could help for coming back to previous screen.

If any other type of message is used without using leave to screen/transation it process the flow

and document is posted.

I want to remain to the previous screen and process to stop there,

the document not to be posted.

so that after editing the data we can post it.

Thanks.

Read only

0 Likes
2,518

Hi

Try with SET SCREEN ..

LEAVE SCREEN.

Thanks,

Renuka

Read only

0 Likes
2,518

Hi friend,

Try like this move the values to an structure as in the first screen.

Then in the second screen when the error message triggers just fill the first screen values with the values from that structure.

Use status or information message because error message stops the execution of the program at that point and demands for input.

Try this i think this will solve your issue.

If you still have queries please revert back to me i will help you.

Thanks,

Sri Hari

Read only

0 Likes
2,518

Thanks Renuka/ Sri Hari,

Leave screen dosent seem working for it as in MB1B we are provinding dates, plant and movement type

on second screen we are giving the material detail, so set and leave screen will loose the data of first screen and when we save again it ll giv error and wont allow.

Sri , thanks for the idea,

we have structures xmseg, xmkpf in the badi itself where the data is stored

even after giving S/I message we can get data from them.

Please help me in implementing it.

like what can i do after giving message. (MESSAGE S000(YM) TEXT.)

Read only

0 Likes
2,518

Have you tried return statement after message?

Nabheet

Read only

Former Member
0 Likes
2,518

You can set the memory id for each field on the screen and try once. that should work

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,518

This is perhaps not possible, read [Note 1315985 - FAQ: BAdI MB_DOCUMENT_BADI|https://service.sap.com/sap/support/notes/1315985]

Question:

Can you use the BAdI MB_DOCUMENT_BADI to carry out checks during goods movements?

Answer:

Generally speaking, the BAdI MB_DOCUMENT_BADI is not designed to check the entries for a goods movement. Therefore, there are no parameters to return messages from the BAdI (for example). You can still use the method MB_DOCUMENT_BEFORE_UPDATE to check the data. However, error messages that occur in the BAdI lead to a dump. See Note 385830 for further information about this.

- If you were in a more recent version you could have tried MB_CHECK_LINE_BADI, which was not available in 46c.

- In an old version like 46c, you could try to divert the EXIT_SAPMM07M_001 (MBCF0002) to raise an error message.

Regards,

Raymond

Read only

0 Likes
2,518

Hi Raymond,

Thanks for this usefull information.

My main concern is to come back to previous screen and process to stop at the point, the criteria is not satisfied.

If i put all the code to check the conditions in badi and the message as well, could be S/I.

Can i stop the process flow and go back to the screen with all the data maintained on it, so that the wrong data could be changed instead of writing all data again.

Any how could it be possible?

Even i had the same case while dealing with ME22N Tcode where i was to come back to previous screen but i was unable to do the same.

Please suggest.

Thanks.

Read only

0 Likes
2,518

Thanks all for your support,

I think for this particular Tcode : MB1B and badi : MB_DOCUMENT_BADI,

we can only process it once in one go.

even if we come back to previous screen by

SET SCREEN sy-dynnr.

LEAVE SCREEN.

the data will be lost and if u put material data again and SAVE,

it will go in DUMP.

Because standard code is allowing mb1b in one go only.

-


FORM buchen_ausfuehren.

DATA:

ls_dm07m TYPE dm07m, "N_763381

ls_vm07m TYPE vm07m.

STATICS: statics_lock TYPE char1. "note 446057

def_break 'BUCHEN_AUSFUEHREN'. "#EC *

  • statics_lock secures that BUCHEN_AUSFUEHREN is only processed once!

IF statics_lock = x. "note 446057

MESSAGE x372(m7). "note 446057

ENDIF. "note 446057

statics_lock = x. "note 446057

-


But i ll try to get its general solution,

That if we want to break the flow at particular point and agin to start from the same point.

Help me if you get any such scenario.

Thanks.

Read only

former_member209920
Active Participant
0 Likes
2,518

try using

Message I000(msg_class) Disply Like 'E'.

Read only

0 Likes
2,518

Hi,

Display like dosent work in 4.6c v.

Read only

Former Member
0 Likes
2,518

For this particular BADI, it could pe processed only once.