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: 

Error message in MB_DOCUMENT_BEFORE_UPDATE

Former Member
0 Kudos

Hi All,

I have to use a error message in MB_DOCUMENT_BEFORE UPDATE method. before error message I need to update one customize tabele.

If I used like this.

ROLLBACK WORK.

UPDATE customize table.

COMMIT WORK.

will it create any inconsistency in MM and ML even I am using COMMIT work in MB_DOCUMENT_BEFORE_UPDATE.

Please suggest me as its very urgent.

Thanks ,

sandeep.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Sandeep ,

u cannt use BADI to raise Error messages ? what u can do is u can make use of Error Log ? in that u can like this ?

    msg-vbeln  = w_lips-vbeln.
    msg-posnr  = w_lips-posnr.
    msg-msgty  = 'E'.
    msg-msgid  = 'YW2'.
    msg-msgno  = '042'.
    msg-msgv1  =
    'Avail.dt for this Item/batch is later than today'.
    msg-msgv2  = w_lips-lfimg.
    msg-msgv3  = w_lips-meins.
    msg-msgv4  = w_lips-charg.
    append msg to ct_log.

<b>in addition to RB , u cannt rollback , but what u can do is u can change data in the table which are avail at this stage ? and u can update ur Ztable with Update Command.

and coming to error message ? try @ ur end and let me know the status.</b>Regards

Prabhu

Message was edited by: Prabhu Peram

Message was edited by: Prabhu Peram

10 REPLIES 10

Former Member
0 Kudos

Hi,

You cant issue error message of type 'E' inside the BADI, you can use fm 'POPUP_TO_CONFIRM' to display the message in a popup screen,

If you dont want to update both custom & standard tables after the error message you can issue 'LEAVE PROGRAM', command to leave the control out of the program,

Hope this helps,

Rgds,

0 Kudos

Hey, I have seen in the previous implementation that some one has used the erroe message in BADI.

But if I need to roll back the work and also update the customize table then what should I do??

PLease.

Regards,

Sandeep.

0 Kudos

Hi,

Error messages are not allowed inside the BADI, you can check by giving the message of type 'E' and see,

I dont see any reason why you want to update the Custom table when the standard table is not getting updated with the 'Material document number' generated , then the integration with the custom table is not going to be proper, though this can be achievable by updating the table with the material document generated and issuing the 'roll back work' and leaving the program, it is not advisable to do so,

Rgds,

0 Kudos

Hey Sailatha,

Just let me know the functionality to you.

While performing GR(101) we need to check tolerance in BADI for produced material and in case if have tolerance error then we have to raise a error message and ROLLBACK the works. apart from this we need to maintain status to the customize table that we have failed in performing the GR in this table we dont have material doucment number field.

what could u suggest on this.??

Regards,

Sandeep

0 Kudos

Hi,

If that is the case, you can insert the entries ( With PO number, Tolerance limit with the status ) in the custom table, after the message, you can use the following,

ROLL BACK WORK.

leave program.

This will stop the standard transaction from saving the material document details in the relevant standard tables, still there will be an entry with the status maintained in the custom table,

Hope this helps,

Rgds,

Hope this helps,

0 Kudos

Hey,

as per uoer suggestion my understanding is given blow please confirm it.

UPDATE customize table.

MEssage

ROLLBACK WORK.

LEAVE Program.

if this is the case i m not sure I will be able to roll back the work after giving the error message.

Am I right?

Regards,

sandeep.

0 Kudos

Hi,

Yes, check with this logic, revert for any clarifications,

Rgds,

Former Member
0 Kudos

Sandeep ,

u cannt use BADI to raise Error messages ? what u can do is u can make use of Error Log ? in that u can like this ?

    msg-vbeln  = w_lips-vbeln.
    msg-posnr  = w_lips-posnr.
    msg-msgty  = 'E'.
    msg-msgid  = 'YW2'.
    msg-msgno  = '042'.
    msg-msgv1  =
    'Avail.dt for this Item/batch is later than today'.
    msg-msgv2  = w_lips-lfimg.
    msg-msgv3  = w_lips-meins.
    msg-msgv4  = w_lips-charg.
    append msg to ct_log.

<b>in addition to RB , u cannt rollback , but what u can do is u can change data in the table which are avail at this stage ? and u can update ur Ztable with Update Command.

and coming to error message ? try @ ur end and let me know the status.</b>Regards

Prabhu

Message was edited by: Prabhu Peram

Message was edited by: Prabhu Peram

0 Kudos

Hey Prabhu,

question is that can I use ROLLBACK WORK to back out the changes to the standard table and COMMIT WORK in BADI for udpating the customize table.

Reagrds,

Sandeep.

Former Member
0 Kudos

Hi !

Never do any COMMIT or ROLLBACK within a BADI or User-Exit.

You will interrupt the DB-Transaction (LUW) of the original-program !

What you can do...

You can call a Function-Module in TRFC. Within that you can update your own table.

Regards

Rainer

Some points would be fine of that helped a bit.