2005 Dec 27 8:26 PM
Hello,
Is it possible to update an internal table during selection? What I mean is:
If I´m selecting data like this:
SELECT lmcod1 llifnr lstcdt fbankn fbkont fbankl
INTO CORRESPONDING FIELDS OF TABLE tab_interna
FROM lfa1 AS l INNER JOIN lfbk AS f
ON llifnr = flifnr
WHERE l~lifnr IN doc.
I want that if 'l~stdc' is 'CC' saves '1' into the table instead of 'CC', saves '2' instead of 'NN', is it possible to do it in one step?
Thanks for your help,
Greetings
Gabriel P.
2005 Dec 27 8:29 PM
But what you can do is add a couple more statements as follows to achieve it.
clear tab_interna-stdc.
tab_interna-stdc = '1'.
modify tab_interna transporting stdc where stdc = 'CC'.
Repeat this for NN also.
Srinivas
2005 Dec 27 8:27 PM
2005 Dec 27 8:29 PM
But what you can do is add a couple more statements as follows to achieve it.
clear tab_interna-stdc.
tab_interna-stdc = '1'.
modify tab_interna transporting stdc where stdc = 'CC'.
Repeat this for NN also.
Srinivas
2005 Dec 27 8:30 PM
Hi Gabriel,
in one step NO...
You have to MODIFY the ITAB contents from a work area for each 'l~stdc'.
Regards,
Suresh Datti
2005 Dec 27 8:32 PM
Use SELECT ....UP TO 1 ROWS
do your changes here..
APPEND ITAB.
ENDSELECT.
You cannot update while selecting when you use the select statement the way you used in your posting.
2005 Dec 27 8:33 PM
Hi
No! It's not possible to do that during a select with INTO TABLE option.
But you could do this:
SELECT lmcod1 llifnr lstcdt fbankn fbkont fbankl
INTO CORRESPONDING FIELDS OF TABLE tab_interna
FROM lfa1 AS l INNER JOIN lfbk AS f
ON llifnr = flifnr
WHERE l~lifnr IN doc.
tab_interna-stcdt = '1'.
modify tab_interna transporting stcdt where stcdt = 'CC'.
tab_interna-stcdt = '2'.
modify tab_interna transporting stcdt where stcdt = 'NN'.
Max
2006 Jan 04 3:00 PM
You could define a transparent conversion table, let's say zconv.
In our example, zconv would contain two rows:
row 1: in='CC' out='1'
row 2: in='NN' out='2'
SELECT lmcod1 llifnr cout as stcdt fbankn fbkont fbankl
INTO CORRESPONDING FIELDS OF TABLE tab_interna
FROM lfa1 AS l INNER JOIN lfbk AS f
INNER JOIN zconv as c
ON llifnr = flifnr and
cin = lstcdt
WHERE l~lifnr IN doc.
However, you must pay attention to performance issues - if the selection result contains many rows, the additional table in the join would affect the performance.