Skip to Content
0
Former Member
Jun 30, 2011 at 12:29 PM

Error message not coming up correct.

17 Views

Hi,

I have a requirement to display error message by comparing the LIPS table and a ZBOX table. Currently I am summing up the box table. Looping on LIPS and then reading the box table by sales_order sales_item and matnr.IF no of lines in lips> thank the box, throw the error ... the the error message is correct, but the sales_item is coming wrong.

LIPS

VBELN | POSNR | MATNR | LFIMG

002743747 | 000010 | MATNR1 | 2

BOX

BOXNUM | SALES_ORDER | SALES_ITEM | MATNR | QUANT

00001 | 002743747 | 000010 | MATNR1| 1

00002 | 002743747 | 000010 | MATNR1| 1

00003 | 002743747 | 000020 | MATNR2| 1

Error message should be Sales Order 002743747 Sale item 000020 are boxed.....

but I am getting...Sales Order 002743747 Sale item 000010 are boxed.....

  • Compare lt_lips & lt_final

LOOP AT lt_lips INTO lw_lips.

READ TABLE lt_final INTO lw_final WITH KEY

sales_order = lw_lips-vgbel sales_item = lw_lips-vgpos matnr = lw_lips-matnr quant = lw_lips-lfimg.

IF sy-subrc <> 0.

MESSAGE e002 WITH lw_final-matnr lw_final-sales_order lw_final-sales_item lw_final-quantity.

EXIT.

ELSE.

READ TABLE lt_final INTO lw_final WITH KEY

sales_order = lw_lips-vgbel sales_item = lw_lips-vgpos.

IF sy-subrc = 0.

DESCRIBE TABLE lt_lips LINES lf_lips_lines.

DESCRIBE TABLE lt_final LINES lf_final_lines.

IF lf_final_lines > lf_lips_lines.

READ TABLE lt_zbox INTO lw_zbox WITH KEY

sales_order = lw_lips-vgbel sales_item = lw_lips-vgpos matnr = lw_lips-matnr." quant = lw_lips-lfimg.

IF sy-subrc = 0.

clear lf_box_num.

Move lw_box-box_num to lf_box_num.

MESSAGE e003 WITH lw_final-sales_order lw_final-sales_item lf_box_num.

EXIT.

ELSE.

MESSAGE e005 WITH lw_final-sales_order lw_final-sales_item.

EXIT.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.