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

BADI - Error messages

Former Member
0 Likes
1,676

Hi

method ME_PROCESS_REQ_CUST~check.

READ TABLE t_mereq_item_exkn_cj40 INTO w_mereq_item_exkn_cj40 INDEX sy-tabix.

IF w_mereq_item_exkn_cj40-menge GT w_mereq_item_exkn_cj40-result.

IF sy-subrc = 0.

MESSAGE e210(zgea) WITH w_mereq_item_exkn_cj40-bnfpo w_mereq_item_exkn_cj40-psp_pnr w_mereq_item_exkn_cj40-result.

ENDIF.

ENDIF.

endmethod.

the above loop if satisfies the condition displayes an error messages.

but If the loop come with three items , in the message popup it should show three errors with the line items.

It works fine with one line item.

multiple line item errors are not pupulating the in the error box.

How to achieve?

I have isplayed the Error messages in Message class.

Hi

method ME_PROCESS_REQ_CUST~check.

READ TABLE t_mereq_item_exkn_cj40 INTO w_mereq_item_exkn_cj40 INDEX sy-tabix.

IF w_mereq_item_exkn_cj40-menge GT w_mereq_item_exkn_cj40-result.

IF sy-subrc = 0.

MESSAGE e210(zgea) WITH w_mereq_item_exkn_cj40-bnfpo w_mereq_item_exkn_cj40-psp_pnr w_mereq_item_exkn_cj40-result.

ENDIF.

ENDIF.

endmethod.

the above loop if satisfies the condition displayes an error messages.

but If the loop come with three items , in the message popup it should show three errors with the line items.

It works fine with one line item.

multiple line item errors are not pupulating the in the error box.

How to achieve?

I have isplayed the Error messages in Message class.

12 REPLIES 12
Read only

Former Member
0 Likes
1,573

Hi,

Try like belwo.

Take out the SY-SUBRC condition.

BUt u r not using any LOOP.ENDLOOP here.


READ TABLE t_mereq_item_exkn_cj40 INTO w_mereq_item_exkn_cj40 INDEX sy-tabix.
IF w_mereq_item_exkn_cj40-menge GT w_mereq_item_exkn_cj40-result.
MESSAGE e210(zgea) WITH w_mereq_item_exkn_cj40-bnfpo w_mereq_item_exkn_cj40-psp_pnr w_mereq_item_exkn_cj40-result.
ENDIF

regards,

Pravin

Read only

0 Likes
1,573

Nop pravin

i have tried

not working

READ TABLE t_mereq_item_exkn_cj40 INTO w_mereq_item_exkn_cj40 INDEX sy-tabix.

IF w_mereq_item_exkn_cj40-menge GT w_mereq_item_exkn_cj40-result.

MESSAGE e210(zgea) WITH w_mereq_item_exkn_cj40-bnfpo w_mereq_item_exkn_cj40-psp_pnr w_mereq_item_exkn_cj40-result.

ENDIF.

ENDIF.

loop at t_mereq_item_exkn_cj40 INTO w_mereq_item_exkn_cj40 INDEX sy-tabix.

IF w_mereq_item_exkn_cj40-menge GT w_mereq_item_exkn_cj40-result.

MESSAGE e210(zgea) WITH w_mereq_item_exkn_cj40-bnfpo w_mereq_item_exkn_cj40-psp_pnr w_mereq_item_exkn_cj40-result.

ENDIF.

ENDIF.

endloop.

tried both the code. But it is not working

Read only

0 Likes
1,573

Hi Muthu,

Can u try like this?


IF w_mereq_item_exkn_cj40-menge GT w_mereq_item_exkn_cj40-result.
  LOOP AT t_mereq_item_exkn_cj40 INTO w_mereq_item_exkn_cj40 .
    MESSAGE e210(zgea) WITH w_mereq_item_exkn_cj40-bnfpo w_mereq_item_exkn_cj40-psp_pnr w_mereq_item_exkn_cj40-result.
  ENDLOOP.
ENDIF.

Read only

0 Likes
1,573

no praveen

it will not display , it wont display even for a single line item.

Read only

0 Likes
1,573

put the if condition inside the loop.


IF w_mereq_item_exkn_cj40-menge GT w_mereq_item_exkn_cj40-result.

and also chek the u have vaild test data.

chek in debugging mode how many records u r getting in INternal table and how many of them are satisfying the above if cos\ntion.

Other wise

chage the records in debigging mode and satify the above if condition and see how many messages you re getting.

Reagrds,

Pravin

Edited by: pravin s. on Aug 9, 2010 8:16 AM

Read only

0 Likes
1,573

Hi ;

In your two methods, I can see you are using sy-tabix in both cases.

Is your method already called within a loop and you were trying to pass the current index value of that loop to your method?

if that, is the sy-tabix populated with your desired or correct line index value and use it in your logic to read the values?

Try to put a breakpoint within the method and check that?

Regards

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,573

Hello Muthu,

You can collect your message texts (using MESSAGE ... INTO) into a internal table & then display these lines in a single popup using 'POPUP_DISPLAY_TEXT_WITH_PARAMS'.

Not sure if this BAdI is triggered at line item level or the document level. Can you elaborate on this ?

BR,

Suhas

Read only

Former Member
0 Likes
1,573

Hi suha

The scenario is

in purchase requsitions

there are three line items.

Line item has Quantity - menge.

Account aassignmet has WBS element.

i have three line diefferent line item and for each line item i have Differet WBS which holds some particular quantity from budget.

comparing that budget quantity with line item menge for each and every time. if it is more then have to display the error messae. with all the ilne items etails

Thank

This badi trigereing for the whole PR in check method.

Read only

Former Member
0 Likes
1,573

Hi Muthu,

Loop at t_mereq_item_exkn_cj40 INTO w_mereq_item_exkn_cj40.

IF w_mereq_item_exkn_cj40-menge GT w_mereq_item_exkn_cj40-result.

IF sy-subrc = 0.

MESSAGE e210(zgea) WITH w_mereq_item_exkn_cj40-bnfpo w_mereq_item_exkn_cj40-psp_pnr w_mereq_item_exkn_cj40-result.

*Capture the message into an internal table itab instead of giving the error message.

concatenate w_mereq_item_exkn_cj40-bnfpo w_mereq_item_exkn_cj40-psp_pnr w_mereq_item_exkn_cj40-result

into text

separated by space.

append text to itab.

ENDIF.

ENDIF.

endloop.

if itab is not initial.

Use FM POPUP_WITH_TABLE_DISPLAY to display all the messages,

Then provide one dummy error message to stop further processing.

endif.

Regards,

Dwarakanath.S

Read only

Former Member
0 Likes
1,573

Any updates

Read only

0 Likes
1,573

[Use macros|] to generate the error messages.

J.N.N.

Read only

Former Member
0 Likes
1,573

No replies