11-21-2005 1:18 PM
Howdy,
I have an internal table:
TYPES: BEGIN OF T_OUTPUT,
EQUIPMENT TYPE EQUI-EQUNR,
DESCRIPTION TYPE EQKT-EQKTX,
EQUIPMENT_CAT TYPE EQUI-EQTYP,
MASTER_WARRANTY TYPE BGMKOBJ-MGANR,
DELIVERY TYPE LIKP-VBELN,
END OF T_OUTPUT.
DATA: ITAB_DETAILS TYPE STANDARD TABLE OF T_OUTPUT WITH HEADER LINE.
Now i'd like to do a slect from LIKP into the field ITAB_DETAILS-delivery, but his code doesn't work?
SELECT VBELN FROM LIKP INTO table ITAB_details-delivery
WHERE VBELN IN S_VBELN
AND VKORG = P_VKORG
AND WERKS = P_WERKS
AND ERDAT IN S_ERDAT
AND LFART IN S_LFART.
Does anyone know what I am doing wrong?
I need to keep the name of the field as 'delivery' and I don't want to change its order in the internal table - Otherwise I'd ahve used the 'MOVE CORRESPONDING' command.
Does anyone have any ideas?
Thanks!
11-21-2005 1:22 PM
try:
SELECT VBELN FROM LIKP INTO ITAB_details-delivery
WHERE VBELN IN S_VBELN
AND VKORG = P_VKORG
AND WERKS = P_WERKS
AND ERDAT IN S_ERDAT
AND LFART IN S_LFART.
...
append /modify itab_details.
...
Andreas
11-21-2005 1:22 PM
try:
SELECT VBELN FROM LIKP INTO ITAB_details-delivery
WHERE VBELN IN S_VBELN
AND VKORG = P_VKORG
AND WERKS = P_WERKS
AND ERDAT IN S_ERDAT
AND LFART IN S_LFART.
...
append /modify itab_details.
...
Andreas
11-21-2005 1:26 PM
Thanks Andreas,
I thought of doing your suggestion:
SELECT VBELN FROM LIKP INTO ITAB_details-delivery
WHERE VBELN IN S_VBELN
AND VKORG = P_VKORG
AND WERKS = P_WERKS
AND ERDAT IN S_ERDAT
AND LFART IN S_LFART.
endselect.
Only problem is that our QA standards don't allow us to do select/endselect statements
Any other ideas?
11-21-2005 1:32 PM
Hi Steve!
If you
- don't want to change the column order
- can't rename the column
- aren't allowed to use select ... apend ... endselect,
then it's not possible. But you can define a second internal table with VBELN as column name, make a into corresponding fields select and copy the internal tables afterwards itab1[] = itab2[] (which is not unicode-enabled, don't forget the free itab2).
Then you have a fast select and you don't need a loop for the internal table.
Regards,
Christian
11-21-2005 1:25 PM
Hi Steve,
The command into corresponding fields of table itab, will not change the order of the fields in internal table.
It will not be a problem if you use that command.
If you want this code,
SELECT VBELN FROM LIKP INTO table ITAB_details WHERE VBELN IN S_VBELN
AND VKORG = P_VKORG
AND WERKS = P_WERKS
AND ERDAT IN S_ERDAT
AND LFART IN S_LFART.
To work,
then vbeln should be the first field of the internal table.
Regards,
Ravi
11-21-2005 1:26 PM
STEVE,
Modified Code:
Get value for Delivery
SELECT <b>SINGLE</b> VBELN FROM LIKP
INTO ITAB_details-delivery
WHERE VBELN IN S_VBELN
AND VKORG = P_VKORG
AND WERKS = P_WERKS
AND ERDAT IN S_ERDAT
AND LFART IN S_LFART.
Insert into Internal Table ASSUMING u have values for
other fields in the Work Area.
<b> append ITAB_DELIVERY.</b>
Thanks
Kam
11-21-2005 1:31 PM
Hi please use 'corresponding' in ur select statement as foloows to work.
SELECT VBELN FROM LIKP INTO corresponding fields of table ITAB_details WHERE VBELN IN S_VBELN
AND VKORG = P_VKORG
AND WERKS = P_WERKS
AND ERDAT IN S_ERDAT
AND LFART IN S_LFART.
Please rename delivery in ur itab to vbeln.
satish
11-21-2005 1:46 PM
Hi Steve,
do you want in your internal table itab_details only the vbeln field of likp?
If yes why dont' rename delivery fields with vbeln and use select * from likp into corresponding fields of table itab_details.?
Another option is to define a table with only a field (vbeln) and make the select descripted above.
bye
enzo