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

Logic for condition check

Former Member
0 Likes
1,806

Hi All,

I would like to check for 2 conditions & if either one of the conditions are OK, then proceed with the further section of code.

Conditions

1. IF EKPO-MATNR NE SPACE.

2. IF MARC-DISMM IN ('PD', 'P1').

The node on which i am querying is EKPO & hence can manage the 1st condition as it is a straight check. But not sure how i can manage the 2nd condition, as i need to read the EKPO-MATNR & then for this i need to check in MARC table for DISMM field.

Hope my problem is clear, await inputs.

Vivek

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,700

Hi vivek ,

first check for EKPO condition ,

then if this condition is ok ,

then set the flag.

if the flag is initial

then check for dismm field.

READ EKPO.

IF EKPO-MATNR NE SPACE.

Proceed.

Flag = ‘X’.

ENDIF.

IF FLAG IS INITIAL.

READ TABLE MARC WITH MATNR = EKPO-MATNR.

IF MARC-DISMM IN ('PD', 'P1').

Proceed.

ENDIF.

ENDIF.

reward if helpful.

Thanks.

Ramya

Hi vivek ,

first check for EKPO condition ,

then if this condition is ok ,

then set the flag.

if the flag is initial

then check for dismm field.

READ EKPO.

IF EKPO-MATNR NE SPACE.

Proceed.

Flag = ‘X’.

ENDIF.

IF FLAG IS INITIAL.

READ TABLE MARC WITH MATNR = EKPO-MATNR.

IF MARC-DISMM IN ('PD', 'P1').

Proceed.

ENDIF.

ENDIF.

reward if helpful.

Thanks.

Ramya

14 REPLIES 14
Read only

Former Member
0 Likes
1,701

Hi vivek ,

first check for EKPO condition ,

then if this condition is ok ,

then set the flag.

if the flag is initial

then check for dismm field.

READ EKPO.

IF EKPO-MATNR NE SPACE.

Proceed.

Flag = ‘X’.

ENDIF.

IF FLAG IS INITIAL.

READ TABLE MARC WITH MATNR = EKPO-MATNR.

IF MARC-DISMM IN ('PD', 'P1').

Proceed.

ENDIF.

ENDIF.

reward if helpful.

Thanks.

Ramya

Read only

0 Likes
1,700

HiRamya

Thanks for your valuable suggestion. I have tried the below code based on your advice, but system prompts the message when i do syntax check

"." expected after "MARC".

Can you let me know how i can resolve the issue?

TABLES: MARC.

*Check if item is relevant for MRP

IF EKPO-MATNR <> SPACE.

READ TABLE MARC WITH MATNR = EKPO-MATNR

AND WERKS = EKPO-WERKS.

IF MARC-DISMM IN ('PD', 'P1').

Proceed.

ENDIF.

ENDIF.

Note for Others: Thanks for your inputs, but i have not joined MARC with EKPO & hence cannot do a search as mentioned in your posts.

Vivek

Read only

0 Likes
1,700

Friend,

Use like below....

IF MARC-DISMM eq 'PD' or marc-dismm eq 'P1'.

Read only

0 Likes
1,700

Hi vivek,

create a range for PD , PI

ranges r_range for dismm.

r_range-sign = 'I'.

r_range-option = 'EQ'.

r_range-low = 'PD'.

append r_range.

clear r_range.

r_range-sign = 'I'.

r_range-option = 'EQ'.

r_range-low = 'PI'.

append r_range.

clear r_range.

then

check if marc-dismm in r_range.

proceed.

let me know .

thanks.

ramya

Read only

0 Likes
1,700

i think you missed

read table marc with key matnr = ekpo-matnr.

try this .

Read only

0 Likes
1,700

Hi Ramya,

I get the error as below

1. Tried as per your last post

Code:

READ TABLE MARC WITH KEY MATNR = EKPO-MATNR

AND MARC-WERKS = EKPO-WERKS.

Syntax Error:

Field "MATNR" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.

2. Also tried with MARC-MATNR

Code

READ TABLE MARC WITH KEY MARC-MATNR = EKPO-MATNR

AND MARC-WERKS = EKPO-WERKS.

Syntax Error

"." expected after "MARC-MATNR".

Read only

0 Likes
1,700

Hi vivek,

1. Remove the AND

READ TABLE MARC WITH KEY MARC-MATNR = EKPO-MATNR MARC-WERKS = EKPO-WERKS

regards,

amit m.

Read only

0 Likes
1,700

Mr. Amit,

System still prompts the syntax error as below:

"." expected after "MARC-MATNR".

This is the code which i have entered, let me know what i need to rectify:

TABLES: MARC.

ranges r_range for marc-dismm.

r_range-sign = 'I'.

r_range-option = 'EQ'.

r_range-low = 'PD'.

append r_range.

clear r_range.

r_range-sign = 'I'.

r_range-option = 'EQ'.

r_range-low = 'PI'.

append r_range.

clear r_range.

*Check if item is relevant for MRP

IF EKPO-MATNR <> SPACE.

READ TABLE MARC WITH KEY MARC-MATNR = EKPO-MATNR

MARC-WERKS = EKPO-WERKS.

CHECK IF MARC-DISMM IN r_range.

Proceed.

Read only

0 Likes
1,700

write like this..

if ekpo-matnr eq space.

READ TABLE MARC WITH KEY MARC-MATNR = EKPO-MATNR MARC-WERKS = EKPO-WERKS.

Edited by: Ramu on Jan 2, 2008 10:01 AM

Read only

0 Likes
1,700

Mr. Ramu,

I have entered the READ statement as mentioned by you, but the system prompts the syntax error as below

"." expected after "MARC-MATNR".

Any alternative solution for my problem?

Vivek

Read only

0 Likes
1,700

Friend,

I'm sorry, i didn't notice that...you have declard MARC with TABLES keyword....

It is not possible here to use READ TABLE option...as for i know....

Read only

0 Likes
1,700

Dear All,

Thank you for your inputs, managed to resolve the issue with use of RANGE (as suggested by Ms. Ramya) & also SELECT statement.

Keep the good work going.

Edited by: Vivek on Jan 2, 2008 6:39 PM

Read only

Former Member
0 Likes
1,700

read EKPO-MATNR.

IF MATNR EQ SPACE.

Proceed with the code...

ELSEIF MARC-DISMM IN ('PD', 'P1').

Proceed with the code...

ENDIF.

Reward points if useful.........

Read only

Former Member
0 Likes
1,700

Hi vivek,

try like this,

IF ekpo-matnr NE space AND ( marc-dismm EQ 'PD' OR

marc-dismm EQ 'P1' ).

ENDIF.