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

regarding initilization logic

Former Member
0 Likes
527

hi,

i have one requirement to add in below select statement

AND mara~mstav EQ 'S0'.(its a hard coaded value)

SELECT mara~matnr

marc~werks

marc~beskz

marc~webaz

marc~plifz

marc~wzeit

marc~dzeit

marc~ekgrp

marc~dispo

marc~strgr

mara~meins

marc~disls

marc~mrppp

marc~zz_ext_del

marc~zz_ext_mod

INTO TABLE itb_art

FROM ( mara

INNER JOIN marc

ON maramatnr = marcmatnr )

WHERE mara~matnr IN s_matnr

AND marc~werks EQ p_werks

AND mara~mtart IN s_mtart

AND mara~lvorm EQ ' '

AND marc~lvorm EQ ' '

AND marc~beskz NE ' '

AND mara~mstav EQ 'E0'.

this is the suggestion given by my client instaead of hardcoading follow these steps..

so how to i will write the code????

Why donu2019t you propose to have a new selection criteria field for MARA-MMSTAV and then initialize the values u201CE0u201D & u201CS0u201D?

Then you use the same screen variables in the select query.

OR ELSE.

Use a RANGES option in the program and then append both the values in the range and then use the range in select query instead of writing separately as

MARA~MMSTAV = u2018E0u2019

MARA~MMSTAV = u2018S0u2019 in the query.

WHAT TO DO????

please help me..

thanks

navketan

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
0 Likes
501

Hi,

Depends on what your customer requires. If he/she is sure that it doesn't have to be parametrized (only these two hardcoded values will be used) you can simply inlcude them both in one select statement:


MARA~MMSTAV in ( u2018E0u2019, 'S0' ).

Of course setting this field as a selection screen parameter is much more flexible way of handling the values. No one has to ever use it as long as you initialize values yourself, but in case such need arises they can easily change required values. Your descibred method is then 100% correct and you should convince your customer to this approach.

Regards

Marcin

3 REPLIES 3
Read only

MarcinPciak
Active Contributor
0 Likes
502

Hi,

Depends on what your customer requires. If he/she is sure that it doesn't have to be parametrized (only these two hardcoded values will be used) you can simply inlcude them both in one select statement:


MARA~MMSTAV in ( u2018E0u2019, 'S0' ).

Of course setting this field as a selection screen parameter is much more flexible way of handling the values. No one has to ever use it as long as you initialize values yourself, but in case such need arises they can easily change required values. Your descibred method is then 100% correct and you should convince your customer to this approach.

Regards

Marcin

Read only

0 Likes
501

can anybody tell what the below logic tells???

ranges: : r_mstav for mara-mstav.

data : w_mstav like line of r_mstav.

initialization.

  • build the range

w_mstav-sign = 'I'.

w_mstav-option = 'EQ'.

w_mstav-low = 'E0'.

append w_mstav to r_mstav.

w_mstav-low = 'S0'.

append w_mstav to r_mstav.

Read only

0 Likes
501

First of all: if you want this parameter be visible in selection screen instead of ranges use select-options


select-options r_mstav for mara-mstav.

Now as it already created table with header line you can append this two entries without work area.

Now the meaning:

1) first record says: restrict the selection with all values (for field mstav ) where are equal to 'EQ'

( r_mstav-option = 'EQ'. ) including the result found ( r_mstav-sign = 'I'. ).

2) secod row does excactly the same but the values for field mstav has to be equal to 'S0'.

Generally when creating select-option parameter or ranges table, sing can be I which stands for u201Cinclusiveu201D (inclusion criterion) or E which stands for u201Cexclusiveu201D (exclusion criterion)

For option there are several entries possible EQ, NE, GT, LE, LT, CP, NP.

For more explanation please read [this|http://help.sap.com/erp2005_ehp_04/helpdata/EN/9f/dba71f35c111d1829f0000e829fbfe/frameset.htm]

Regards

Marcin