Skip to Content
0
Former Member
Jul 02, 2008 at 06:16 AM

SELECT INTO TABLE

15771 Views

Hi,

Is there a possibility to convert something like this:

TYPES: BEGIN OF r_mystruct,
	field1(10),
	field2(20),
	field3(30),
	field4(40),
	field5,
	field6(5)
       END OF r_mystruct.

DATA:
	tab TYPE STANDARD TABLE OF r_mystruct WITH HEADER LINE.

MOVE sy-index TO tab-field5.
SELECT aufnr gsber ktext FROM aufk INTO CORRESPONDING FIELDS OF aufk.
	MOVE aufk-aufnr TO tab-myfield1.
	MOVE aufk-aufnr TO tab-myfield2.
	MOVE aufk-ktext TO tab-myfield3.
	MOVE aufk-gsber TO tab-myfield4.
	APPEND tab.
ENDSELECT.

to a statement involving a SELECT INTO TABLE ?

I've tried something like:

SELECT aufnr aufnr ktext gsber ( sy-index ) NULL FROM aufk INTO TABLE tab.

but i get numerous errors (and yes, i need to have aufnr twice)

Any hints on how to transfer selected fields to a completely custom structure, is it possible ?

Thanks in advance,

Bart