2007 Dec 04 6:12 PM
Hi frnz, in one requirement, use will enter some values in select-options, the system has to see whether the entered value's pattern exists in the database.
For example if user enters "PRODMAT" then system should search in mara table whether any mara-matnr CP 'PRODMAT*', ie begins with entered value. if yes, should give next possible matnr value to create material. If user enters multiple values also system should do the same thing. Pls help me with some coding.
Thanks in advance.
2007 Dec 04 6:21 PM
Hi Suresh,
Use Like Operator in the SELECT statement
eg:
select * from table where name like 'abc%'.
Message Edited
Shibu
2007 Dec 04 6:21 PM
Hi Suresh,
Use Like Operator in the SELECT statement
eg:
select * from table where name like 'abc%'.
Message Edited
Shibu
2007 Dec 04 6:43 PM
Hi Shibu..
It is working with parameter, is not working with select-option. Pls give me some piece of code if possible.
What I used was
"<u>select * from mara into table it_mara where matnr like p_matnr."</u>
Pls help me in modifying this in to select options.
2007 Dec 04 6:46 PM
Try:
tables: mara.
select-options s_matnr for mara-matnr.
select * from mara into table it_mara where matnr in s_matnr
Rob
2007 Dec 04 6:59 PM
Hi, this will select the exact entries which are there in select-options. It is needed to select matnr starting with the prefix entered in select option. Pls try.
2007 Dec 04 7:01 PM
2007 Dec 04 7:13 PM
OK - I see what you want to do. Try:
REPORT ztest MESSAGE-ID 00.
TABLES: mara.
DATA: it_mara TYPE TABLE OF mara WITH HEADER LINE.
PARAMETER p_matnr LIKE mara-matnr OBLIGATORY.
RANGES: r_matnr FOR mara-matnr.
MOVE 'CP' TO r_matnr-option.
MOVE 'I' TO r_matnr-sign.
CONCATENATE p_matnr '*' INTO r_matnr-low.
APPEND r_matnr.
SELECT * FROM mara INTO TABLE it_mara WHERE matnr IN r_matnr.
Rob
2007 Dec 04 7:40 PM
Thanks Rob,
but I am affraid RANGES will not prompt any select-option to user to enter his values. The requirement is, program should prompt select-options to user, user enters multiple single entries or range of values in select-options, program should see mara table for possible matnr with all prefixes entered by the user in select-option, should fetch last one with that prefix and display next available matnr which he can create.
for ex. user is entering AA, BB, CC, DD in select options, it should see matnr starting with AA, BB, CC, DD in table mara and go to last entry with AA BB CC DD and give last entry+1 to user. If AA10 is last entry in mara then AA11 should be displayed, if BB12 is last entry, BB13 should be displayed...
Pls give some suggestions.
Suresh.
2007 Dec 04 7:47 PM
2007 Dec 04 7:54 PM
User is restricted to enter only short range. Like range containing 5-6 entries. Or else the user enters multiple single entries.
Suresh.
2007 Dec 04 7:59 PM
Try like this, but be aware of the fact that having select options, user can use NE, NP, exclude range, exclude single value etc. You may want the user to be restricted to only EQ and BT.
TABLES: mara.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
RANGES: r_matnr FOR mara-matnr.
START-OF-SELECTION.
LOOP AT s_matnr.
r_matnr = s_matnr.
IF r_matnr-low IS NOT INITIAL.
CONCATENATE r_matnr-low '*' INTO r_matnr-low.
ENDIF.
IF r_matnr-high IS NOT INITIAL.
CONCATENATE r_matnr-high '*' INTO r_matnr-high.
ENDIF.
r_matnr-option = 'CP'.
APPEND r_matnr.
ENDLOOP.
SELECT * FROM mara WHERE matnr IN r_matnr.
2007 Dec 04 8:40 PM
Thanks, thanks a million. For some time our server was not working, so I delayed.
Its working as per my requirement. Thanks again.