‎2007 Sep 26 6:19 AM
hai,
tell me what this query do..........
itab is my internal table
SELECT SINGLE matkl INTO mara-matkl
FROM mara
WHERE matnr EQ itab-matnr.
‎2007 Sep 26 6:22 AM
If this code is not placed in the LOOP statement, then it will pick up header value present in ITAB-MATNR and use it to pick up MATKL from MARA. If there is an entry, the value is placed in MARA-MATKL.
If it is placed in a LOOP Statement, then it will pick up MATKL from MARA for each entry of MATNR from ITAB. If there is an entry, the value is placed in MARA-MATKL.
‎2007 Sep 26 6:22 AM
If this code is not placed in the LOOP statement, then it will pick up header value present in ITAB-MATNR and use it to pick up MATKL from MARA. If there is an entry, the value is placed in MARA-MATKL.
If it is placed in a LOOP Statement, then it will pick up MATKL from MARA for each entry of MATNR from ITAB. If there is an entry, the value is placed in MARA-MATKL.
‎2007 Sep 26 6:23 AM
this query
SELECT SINGLE matkl INTO mara-matkl
FROM mara
WHERE matnr EQ itab-matnr.
It will fetch one record i.e. matkl value from mara into temp memory mara-matkl
using the where condition matnr EQ itab-matnr(i.e) the values matching in internal table.
Example :
SELECT SINGLE batxt FROM t161t INTO t161t-batxt WHERE
bsart = wa_fitab2-bsart AND
spras = sy-langu.
‎2007 Sep 26 6:31 AM
‎2007 Sep 26 6:38 AM
It is not moved to database table. We are just using the work area of standard table MARA which acts like a variable of type MATKL (as we are using MARA-MATKL).
‎2007 Sep 26 6:30 AM
‎2007 Sep 26 6:30 AM
hi Vikram,
for the 'matnr' value present in the header line of the internal table itab, the select query will fetch the corresponding 'matkl' value from th DB table mara and store it in the field 'mara-matkl'.
Regards,
Viji
‎2007 Sep 26 6:40 AM
If you dont want in that way, do in this below way
example :
SELECT SINGLE *
FROM lfa1 INTO wa_lfa1
WHERE lifnr = wa_fitab2-lifnr.
define as below
Data : wa_lfa1 TYPE lfa1.
<b>In your case do it as below
Data : wa_matkl TYPE matkl.
SELECT SINGLE matkl INTO wa_matkl
FROM mara
WHERE matnr EQ itab-matnr.</b>
‎2007 Sep 26 6:41 AM
And moreover your not updating the database table in the below query
SELECT SINGLE matkl INTO mara-matkl
FROM mara
WHERE matnr EQ itab-matnr.
you are using temporory work area thats it.