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

bukrs and plant validation.

Former Member
0 Likes
2,273

In my selection screen ,

there are plant(werks) and company code (bukrs).

I need to validate bukrs whether it is there in that plant or not on the selection screen.

How to write the logic ?

If I am not wrong t001w is the table - not sure hwo to validate the burks for that plant ?

Can you please help m e.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,292

the table is T001K- the valuation area is plant.

so validate plant from T001W, then for that plant give it as valuation area and validate bukrs from T001K

Edited by: Kartik Tarla on May 20, 2009 2:43 PM

4 REPLIES 4
Read only

Former Member
0 Likes
1,292

Hi,

Try this code

PARAMETERS:

p_werks TYPE mast-werks.

AT SELECTION-SCREEN ON p_werks.

SELECT werks FROM mast UP TO 1 ROWS INTO p_werks

WHERE werks = p_werks.

ENDSELECT.

IF sy-subrc NE 0.

MESSAGE 'No records found with this plant'(007) TYPE 'E' DISPLAY LIKE 'S'.

EXIT.

ENDIF.

Regards,

jaya

Read only

Former Member
0 Likes
1,292

Hi sam kumar,

You can do it in event as

AT SELECTION-SCREEN ON p_plant.
  SELECT SINGLE * FROM T001W
                  WHERE werks = p_plant.
  IF sy-subrc <> 0.
    MESSAGE e015(pm01) WITH p_plant.
  ENDIF.

AT SELECTION-SCREEN ON p_bukrs.
  SELECT SINGLE * FROM T001
                  WHERE werks = p_bukrs.
  IF sy-subrc <> 0.
    MESSAGE e015(pm01) WITH p_bukrs.
  ENDIF.

Regards,

Suneel G

Read only

Former Member
0 Likes
1,292

Hi Sam,

validate the bukrs in AT SELECTION-SCREEN event

Ex code:

parameters p_bukrs like t001-bukrs.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_bukrs.

SELECT single bukrs from t001 into t001-bukrs

WHERE bukrs EQ p_bukrs.

if sy-subrc Ne 0.

Message 'BUKRS doesnot exits' type 'I'.

exit.

endif.

Read only

Former Member
0 Likes
1,293

the table is T001K- the valuation area is plant.

so validate plant from T001W, then for that plant give it as valuation area and validate bukrs from T001K

Edited by: Kartik Tarla on May 20, 2009 2:43 PM