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: 

PO error message problem

Former Member
0 Kudos

Hi Experts,

Usign the userexit 'EXIT_SAPMM06E_012' doing the validations at the time of purchase order creation LIKE checking the each poitem material classifications widthif no width populating the error message.

But the problem is :getting the error message in header level.

I need to populate the error message in item level.

for example for one purchase order we have the two items for the second item material we dont have the width . for that material I need to display error message (me21n)

Please suggest me how we can do this.

Regards,

Sam.

2 REPLIES 2

Former Member
0 Kudos

Hi,

Exit code required for this

0 Kudos

Hi The below is the exit code

DATA: gt_zminvcomp_plant TYPE zminvcomp_plant

OCCURS 0 WITH header line.

RANGES: r_plant FOR ekpo-werks.

DATA:gs_lfa1 TYPE lfa1.

DATA:gv_object TYPE objnum,

gt_class TYPE sclass OCCURS 0 WITH HEADER LINE,

gt_objectdata TYPE clobjdat OCCURS 0 WITH HEADER LINE.

CONSTANTS:c_class LIKE klah-class VALUE 'CLS_FIX_STD_COST',

c_atnam LIKE clobjdat-atnam VALUE 'CHR_FIX_STD_COST_PLANTS',

c_ctype_001 LIKE klah-klart VALUE '001'.

gs_lfa1 = i_lfa1.

IF ( sy-tcode = 'ME21N' OR

sy-tcode = 'ME22N' ).

  • To get the Plant data

SELECT * FROM zminvcomp_plant

INTO TABLE gt_zminvcomp_plant.

REFRESH r_werks1.

LOOP AT gt_zminvcomp_plant.

r_werks1-sign = 'I'.

r_werks1-low = gt_zminvcomp_plant-werks.

r_werks1-option = 'EQ'.

APPEND r_werks1.

CLEAR r_werks1.

ENDLOOP.

LOOP AT gt_ekpo WHERE NOT matnr IS initial.

IF gt_ekpo-loekz <> 'L'. "for not deleted items

CLEAR gv_object.

gv_object = gt_ekpo-matnr.

PERFORM to_get_classification_data.

IF gt_ekpo-werks IN r_plant AND NOT r_plant[] IS INITIAL.

ELSE.

mmpur_message 'E' 'ZZ' '048' ''

''

''

''.

ENDIF.

ENDIF.

ENDLOOP.

ENDIF.

*&----


*

*& Form to_get_classification_data

*&----


*

FORM to_get_classification_data.

CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'

EXPORTING

class = c_class

classtype = c_ctype_001

object = gv_object

TABLES

t_class = gt_class

t_objectdata = gt_objectdata

EXCEPTIONS

no_classification = 1

no_classtypes = 2

invalid_class_type = 3

OTHERS = 4.

CHECK sy-subrc = 0.

REFRESH r_plant.

LOOP AT gt_objectdata.

CASE gt_objectdata-atnam.

WHEN c_atnam.

r_plant-low = gt_objectdata-ausp1.

r_plant-sign = 'I'.

r_plant-option = 'EQ'.

APPEND r_plant.

CLEAR r_plant.

ENDCASE. "gt_objectdata-atnam

ENDLOOP. "gt_objectdata

ENDFORM. " to_get_classification_data