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: 

How to hard code IF condition

Former Member
0 Kudos
107

Hi frnds,

In below code i want to hard code plant PALM.

IF plant is PALM then only if condition will fire other wise it raise a below mentiond message

I am taking that PALM value from the screen.

    • PALM Plant Validation

if wa_table-plant_palm is not initial.

select single matnr werks from marc into wa_marc where matnr eq wa_table-material

and werks eq wa_table-plant_palm.

if sy-subrc eq 0.

select single matnr werks from marc into wa_marc where matnr eq wa_table-component

and werks eq wa_table-plant_palm.

if sy-subrc <> 0.

message 'Component does not exit in this plant' type 'E'.

endif.

else.

message 'Material does not exit in this plant' type 'E'.

endif.

endif.

Edited by: Rakhi@abap on May 14, 2010 11:08 AM

1 ACCEPTED SOLUTION

Former Member
0 Kudos
63

hi,

Here my understanding is if plant is PALM then only your if condition sgould work. If its the erquirement, then declare a constant t hold the value PALM, and use it in the same IF condition.

constants: c_palm(4) VALUE 'PALM'.

IF wa_table-plant_palm is not initialAND wa_table-plant_palm EQ c_palm.

your code

ENDIF.

3 REPLIES 3

Former Member
0 Kudos
64

hi,

Here my understanding is if plant is PALM then only your if condition sgould work. If its the erquirement, then declare a constant t hold the value PALM, and use it in the same IF condition.

constants: c_palm(4) VALUE 'PALM'.

IF wa_table-plant_palm is not initialAND wa_table-plant_palm EQ c_palm.

your code

ENDIF.

0 Kudos
63

Thanks...

Former Member
0 Kudos
63

Hi

You can do what harikrishanan said.

Regards

Sagar