2009 Feb 25 2:23 PM
Iu2019ve retrieved MSEG-MATNR for the condition mseg-mblnr = material doc no. and mseg-mjahr = mat doc year and mseg-zeile = mat doc item.
And my retrieved data mseg data in i_mseg is like below:
Mblnru2026u2026u2026..mjahru2026..zeilen.u2026u2026.matnr
0049000242....1995......0003........YY-110
0049000242u2026.1995u2026u20260004u2026u2026.YY-120
0049000248....1995u2026u20260001u2026u2026..40-110C
0049000248u2026.1995u2026u20260002........40-200C
0049000248u2026.1995u2026u20260003........40-210
0049000248u2026.1995u2026u20260004........L-40C
Now Iu2019ll have to fetch:
MAKT-MAKTX for the condition MAKT-MATNR=MSEG-MATNR and MAKT-SPRAS = u2018ENu2019.
Shall I use select single or normal select queries for makt-maktx retrieval?
If select single, then why and if not, then why?
Can anyone please guide?
Regards.
2009 Feb 25 2:29 PM
You can retrive material texts for all the materials retreived in your table by using Select..for all entries....
Please let me knwo if this helps!
You can retrive material texts for all the materials retreived in your table by using Select..for all entries....
Please let me knwo if this helps!
2009 Feb 25 2:29 PM
You can retrive material texts for all the materials retreived in your table by using Select..for all entries....
Please let me knwo if this helps!
2009 Feb 25 2:31 PM
I think for all entries will work in this case but trying to be understand why not select single here?
2009 Feb 25 2:40 PM
if you use select..single you will need to use that in a loop.
So that for every material in the loop you use select single which will retrieve 1 record each for a material...
One more point for Select single ...when you use select single ...you need to provide the entire key of the table.
2009 Feb 25 2:44 PM
2009 Feb 25 2:57 PM
Hi,
It depends of how many records you expect to read. If you have a reduced amount of records I would expect for the join statement to underperform, even if the access to the data bank is faster.
But at a considerable amount of data the join might be a lot faster. Use the tc SM30 to test your code.
This is a test script (for development system):
TABLES: mseg, makt.
SELECT-OPTIONS: s_mblnr FOR mseg-mblnr,
s_mjahr FOR mseg-mjahr,
s_zeile FOR mseg-zeile.
PARAMETERS p_join AS CHECKBOX.
DATA: BEGIN OF l_mseg,
mblnr LIKE mseg-mblnr,
maktx LIKE makt-maktx,
END OF l_mseg.
START-OF-SELECTION.
DO 10000 TIMES.
IF p_join IS INITIAL.
SELECT mblnr INTO l_mseg-mblnr FROM mseg WHERE mblnr IN s_mblnr
AND mjahr IN s_mjahr AND zeile IN s_zeile.
SELECT SINGLE maktx INTO l_mseg-maktx FROM makt
WHERE matnr EQ mseg-matnr AND spras = sy-langu.
ENDSELECT.
ELSE.
SELECT mblnr maktx INTO l_mseg
FROM mseg JOIN makt ON makt~matnr = mseg~matnr
WHERE mblnr IN s_mblnr AND mjahr IN s_mjahr AND zeile IN s_zeile
AND spras = sy-langu.
ENDSELECT.
ENDIF.
ENDDO.
regards,
Edgar
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |