‎2006 Nov 02 11:34 PM
Hello Experts,
Can anybody of you pleaes help me in writing the logic.
<b>select matnr
werks
into table i_data
where matnr = i_mara-mantr
and werks IN s_werks.</b>
here i have to execute the following logic if "S_WERKS" is not "US" and "EU".
<b>loop at i_data.
..................................
..................................
endloop.</b>
Thanks a lot.
‎2006 Nov 02 11:37 PM
Hi
RANGES R_WERKS FOR MARC-WERKS.
R_WERKS(3) = 'EEQ'.
R_WERKS-LOW = 'US'.
APPEND R_WERKS.
R_WERKS-LOW = 'EU'.
APPEND R_WERKS.
loop at i_data where werks in R_WERKS.
..................................
..................................
endloop.
Max
‎2006 Nov 02 11:37 PM
Hi
RANGES R_WERKS FOR MARC-WERKS.
R_WERKS(3) = 'EEQ'.
R_WERKS-LOW = 'US'.
APPEND R_WERKS.
R_WERKS-LOW = 'EU'.
APPEND R_WERKS.
loop at i_data where werks in R_WERKS.
..................................
..................................
endloop.
Max
‎2006 Nov 02 11:48 PM
Thnx Max.
Can you please let me knwo if I want to check that condition before the "SELECT" statement how would I do that?
Thnx.
‎2006 Nov 02 11:54 PM
In the Initialization event you can populate the same into <b>s_werks</b> instead in r_werks. and use this s_werks in the select statement.
regards,
vamshi tallada
‎2006 Nov 03 12:05 AM
Hi
Have you tried:
select matnr
werks
into table i_data
where matnr = i_mara-mantr
and ( werks IN s_werks and
werks <> 'US' and
werks <> 'EU ).Max
‎2006 Nov 03 12:08 AM
i'm sorry for not giving u a clear idea of what I want.
the code is like this:
<b>form get_data.</b>
now i hve to check the plants (S_WERKS) first and if they are not 'US' and 'EU' then i hve to execute this following logic.
and if they are euqual to 'EU' or 'US', there is a different approach i hve to take.
<b>select matnr
werks
into table i_data
where matnr = i_mara-matnr
and werks IN s_werks.
loop at i_data.
.......................
.......................
endloop.</b>
‎2006 Nov 03 12:23 AM
Hi
Sorry...
DATA: BEGIN OF T_PLANT OCCURS 2,
WERKS TYPE WERKS,
END OF T_PLANT.
T_PLANT-WERKS = 'US'.
APPEND T_PLANT.
T_PLANT-WERKS = 'EU'.
APPEND T_PLANT.
DELETE T_PLANT WHERE WERKS IN S_WERKS.
IF SY-SUBRC <> 0.
-
> It means US and EU not in S_WERKS
ELSE.
DESCRIBE TABLE T_PLANT LINES SY-TABIX.
IF SY-TABIX = 0.
-
> It means US and EU are in S_WERKS
ELSE.
-
> It means US or EU are in S_WERKS
ENDIF.
ENDIF.
Max
‎2006 Nov 03 12:28 AM