2009 Mar 05 6:32 AM
Hello All,
I have a scenario.
I read a DB table MARA, i will get few records .
now i have to query a Z* table, based on the mara entries, what i got earlier.
but in Z* table contains the material, with two extra characters than mara-matnr.
for eg: if mara-matnr = 12345
Z*-matnr can be 1234500 or/and 12345AB like this.......
I know i can loop through mara entries and select Z* for each of mara entry using like statement.
is there any other better way.
I cant use 'for all entries' with 'like' it is giving a sytax error saying this combination cant be used.
Thanks in advance.
Best Regards
Amrender Reddy B
2009 Mar 05 6:48 AM
Hi,
First select the Material from MARA table into itab then,
Build the range..
LOOP AT ITAB.
Concatenate itab-matnr *' into l_matnr.
R_matnr-SIGn = 'I'.
R_matnr-option ='CP'.
R_matnr = l_matnr.
append r_matnr.
Clear r_matnr.
ENDLOOP.
Use the range R_MATNR on the Z* table to select the data
Hi,
First select the Material from MARA table into itab then,
Build the range..
LOOP AT ITAB.
Concatenate itab-matnr *' into l_matnr.
R_matnr-SIGn = 'I'.
R_matnr-option ='CP'.
R_matnr = l_matnr.
append r_matnr.
Clear r_matnr.
ENDLOOP.
Use the range R_MATNR on the Z* table to select the data
2009 Mar 05 6:43 AM
If you already know that your Z table will contain few entries , you can still live with this approach
2009 Mar 05 6:48 AM
Hi,
First select the Material from MARA table into itab then,
Build the range..
LOOP AT ITAB.
Concatenate itab-matnr *' into l_matnr.
R_matnr-SIGn = 'I'.
R_matnr-option ='CP'.
R_matnr = l_matnr.
append r_matnr.
Clear r_matnr.
ENDLOOP.
Use the range R_MATNR on the Z* table to select the data
2009 Mar 05 6:53 AM
Hi,
If you can apply any other conditions in Where cause other than MATNR apply that and take all entries of Z table into an internal table and after that you can put the check of mara-matnr* and delete the not required entries,this will reduce hitting DB for every LOOP pass.
Regards,
Neha
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |