03-18-2014 6:43 AM
hi all,
i have a z custom table contains the field MATNR.
it contains the both complete material number and patterns also.
for example
700420889142 ( in ztable stored as 000000700420889142)
700*20889142 ( in ztable stored as 700*20889142)
70042+889142 ( in ztable stored as 70042+889142)
and i have one report that will fetch the data from the above custom table based on selection screen input.the selection screen contains MATNR field also.
the select query is like this.
SELECT MATNR MATKL FROM ZCUSTOMTABLE INTO IT_TAB where MATNR in S_MATNR.
my problem here is when I'm giving the pattern in MATNR field ( in selection screen) like 700* its fetching only the pattern values.
in this case its fetching only 700*20889142 and 70042+889142. but i want the material number 700420889142 also. when i am giving the *700* its fetching all the values, but the user not interested use the pattern *700*.
please help me in this case....
Thank You..
Message was edited by: Matthew Billingham - Subject was in ALL CAPITALS
03-18-2014 10:43 AM
Hi all,
I solved this problem but still one more problem is there.
i have declared a copy of s_matnr as s_matnr1 and
copy of it_tab as it_tab1.
at selection-screen on s_matnr.
s_matnr1 = s_matnr.
if s_matnr-option = 'CP'.
CONCATENATE '*' s_matnr-low into s_matnr-low.
append s_matnr.
endif.
select * from ztable into corresponding fields of
table it_table
and matkl in s_matkl
and matnr in s_matnr
loop at it_table into wa_table.
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = wa_table-matnr
IMPORTING
OUTPUT = wa_table-matnr.
append wa_table to it_table1.
endloop.
refresh it_table.
loop at it_table1 into wa_table1.
if wa_table1-matnr cp s_matnr1-low.
append wa_table1 to it_table.
clear wa_table1.
endif.
endloop.
its working fine when i am fetching the values using select query.
and some times i have to call the SM30 based on selection screen values. for this i am using FM VIEW_RANGETAB_TO_SELLIST and VIEW_MAINTENANCE_CALL and providing the rangetab as s_matnr. in this case i am facing the same problem.
03-18-2014 6:53 AM
Hi Ramesh,
As per understanding, you may click on the option multiple selection on the selection screen and provide your values e.g. 000000700* as well along with other option. I hope it will work for you:
Thanks,
Anupama
03-18-2014 7:12 AM
hi Anupama,
Thanks for quick reply.
If i'm giving the value 000000700*or *700* its fetching all the material numbers and I suggested the same to user,but he is not interested to use above method simply he wants to put material number or pettern.and the user dont know how many zeros he has to put before the pattern in the selection screen.
03-18-2014 7:26 AM
If this is the case and user is not ready to put input every time. You may offer a help to user by creating this particular input variant. So each time when user is getting the variant he/she can easily run the report without much input efforts.
Thanks,
Anupama
03-18-2014 6:57 AM
Hi,
Use the pattern *XXX* to select data from DB and then remove all leading zeros from the Internal table.
and then again use the actual pattern given by user to filter out the data to display.
Regards
Sree
03-18-2014 7:03 AM
Hi Ramesh,
I think you can add some lines in range table S_MATNR[].
Such as:
0700*
00700*
000700*
0000700*
00000700*
Even the user only key in 700*
The result will contain 000700*
Regards
03-18-2014 7:04 AM
Hi Ram,
First, You try to execute the similar input selection inputs for the custom table via SE11 only and check the no. of records retrieved/ displayed on the screen.
please let me know whether you are able to view all the values related to input or not.
if not then you can create an RANGES for the MATNR and fill it. Pass the Ranges MATNR values to the custom table and then check.
Kindly let me know.
03-18-2014 7:22 AM
hi Venkat,
when i'm trying through SE11 by giving the 700* in the MATNR field of Ztable I'm getting only
700*20889142 and 70042+889142 but not all the material numbers. its working same as select query.
03-18-2014 9:22 AM
Hi Ram,
You can still achieve the desired functionality as expected.
First, declare an RANGE table of type MATNR.
Build Range table LT_MATNR like below
LOOP AT S_MATNR.
IF S_MATNR-LOW contains any wild characters symbol then Concatenate * before the value.
append into the LT_MATNR.
else.
pass the orginal value without prefixing the * into the LT_MATNR.
ENDLOOP.
Finally, pass this RANGE table to the select query.
03-18-2014 8:31 AM
Hi,
You can write your logic in 'At Selection-Screen'. Here you can concatenate * to the input parameter.
Sample code is as given below.
tables: t023.
data: it TYPE TABLE OF t023,
wa LIKe LINE OF it.
SELECTION-SCREEN BEGIN OF BLOCK b1.
SELECT-OPTIONS: s_matkl for T023-matkl.
SELECTION-SCREEN end OF BLOCK b1.
AT SELECTION-SCREEN.
if s_matkl-low is NOT INITIAL.
CONCATENATE '*' s_matkl-low into s_matkl-low .
ENDIF.
START-OF-SELECTION.
SELECT * FROM t023 INto TABLE it WHERE matkl in s_matkl.
Regards
Sajid Shaik
03-18-2014 9:26 AM
Hi Sajid,
i have written the same logic its working fine in some cases. but the problem is if suppose the following are materials in the Ztable.
700420889142
700*20889142
70042+889142
127004208891
if we enter 700* in the selection screen it will display all the materials, but actually it shouldn't display the material number 127004208891.
03-18-2014 10:22 AM
Hi,
If you know that 6 zeroes are always present for a material (000000700420889142) then you can use 000000*700*.
Regards
Sajid
03-18-2014 10:43 AM
Hi all,
I solved this problem but still one more problem is there.
i have declared a copy of s_matnr as s_matnr1 and
copy of it_tab as it_tab1.
at selection-screen on s_matnr.
s_matnr1 = s_matnr.
if s_matnr-option = 'CP'.
CONCATENATE '*' s_matnr-low into s_matnr-low.
append s_matnr.
endif.
select * from ztable into corresponding fields of
table it_table
and matkl in s_matkl
and matnr in s_matnr
loop at it_table into wa_table.
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = wa_table-matnr
IMPORTING
OUTPUT = wa_table-matnr.
append wa_table to it_table1.
endloop.
refresh it_table.
loop at it_table1 into wa_table1.
if wa_table1-matnr cp s_matnr1-low.
append wa_table1 to it_table.
clear wa_table1.
endif.
endloop.
its working fine when i am fetching the values using select query.
and some times i have to call the SM30 based on selection screen values. for this i am using FM VIEW_RANGETAB_TO_SELLIST and VIEW_MAINTENANCE_CALL and providing the rangetab as s_matnr. in this case i am facing the same problem.