‎2009 Dec 08 8:26 AM
Hello
I would like to make the following select from Transp. Table :
Select F1 F2 'ABC' AS SOURCE
FROM Transp. Table
F1, F2 - fields of the table , 'ABC' is a char constant , the same for all records of the table
I dont want to run Loop-End loop and populate the constant there.
‎2009 Dec 08 9:06 AM
Hello,
You can use MODIFY ... TRANSPORTING statement for this. No need to use LOOP...ENDLOOP.
TYPES:
BEGIN OF ty,
bukrs TYPE bukrs,
text TYPE string,
END OF ty.
DATA:
itab TYPE STANDARD TABLE OF ty,
wa TYPE ty.
SELECT bukrs FROM t001 INTO TABLE itab.
IF sy-subrc = 0.
wa-text = 'Test Modify'.
MODIFY itab FROM wa TRANSPORTING text WHERE bukrs IS NOT INITIAL.
ENDIF.
LOOP AT itab INTO wa.
WRITE : / wa-bukrs, 10 wa-text.
ENDLOOP.Hope i am clear.
BR,
Suhas
‎2009 Dec 08 8:38 AM
Hi,
Select F1 F2 'ABC' AS SOURCE
FROM Transp. Table
Your saying that ABC is same for all records of the table.So it must be one of the field of the table.
SELECT F1 F2 <your field>
From TABLE
WHERE <your field> = 'ABC'.
Regards,
Subhashini
‎2009 Dec 08 9:06 AM
Hello,
You can use MODIFY ... TRANSPORTING statement for this. No need to use LOOP...ENDLOOP.
TYPES:
BEGIN OF ty,
bukrs TYPE bukrs,
text TYPE string,
END OF ty.
DATA:
itab TYPE STANDARD TABLE OF ty,
wa TYPE ty.
SELECT bukrs FROM t001 INTO TABLE itab.
IF sy-subrc = 0.
wa-text = 'Test Modify'.
MODIFY itab FROM wa TRANSPORTING text WHERE bukrs IS NOT INITIAL.
ENDIF.
LOOP AT itab INTO wa.
WRITE : / wa-bukrs, 10 wa-text.
ENDLOOP.Hope i am clear.
BR,
Suhas
‎2009 Dec 08 9:20 AM
thanks
constant ABC isnt a part of the table. Its not a field of the table.
I need it to know where the data was derived from.
‎2009 Dec 08 9:26 AM
Hello,
If i understand correctly ABC is an identifier of the data source. You want this identifier to be able to identify from which table the data has come.
I donot think you can do this w/o defining it as a table field.
BR,
Suhas
‎2009 Dec 08 9:51 AM
Hi,
I will suggest you to fill the dummy column right after the query through MODIFY statement as descirbed above.
And then if you get more data into the same tab using SELECT.. APPENDING... then again u can fill your dummy column through MODIFY.
Only additional processing time will be the MODIFY statements, and that wont be too much and your purpose will be served of identifying the source too..
Revert if I havent been able to clarify myself.