Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to select into a field of my internal table?

Former Member
0 Kudos

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!

1 ACCEPTED SOLUTION

andreas_mann3
Active Contributor
0 Kudos

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

7 REPLIES 7

andreas_mann3
Active Contributor
0 Kudos

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

0 Kudos

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?

0 Kudos

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

former_member181962
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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