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

How to hard code IF condition

Former Member
0 Likes
590

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
Read only

Former Member
0 Likes
546

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
Read only

Former Member
0 Likes
547

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.

Read only

0 Likes
546

Thanks...

Read only

Former Member
0 Likes
546

Hi

You can do what harikrishanan said.

Regards

Sagar