Application Development and Automation 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: 
Read only

Select single *

ramco1917
Participant
0 Likes
1,788

Hi

I have below function . Instead of * i want to display only Matnr , MTART , MEINS fields . Can it be done with Select Single syntax.

SELECT SINGLE * FROM MARA
INTO EX_MARA
WHERE MATNR = IM_MATNR.

Thanks

1 ACCEPTED SOLUTION
Read only

MateuszAdamus
Active Contributor
0 Likes
1,654

Hello ramco_1917

Yes. Provide field names instead of the start. Define the structure with the fields and do the following.

SELECT SINGLE matnr, mtart, meins FROM MARA INTO EX_MARA WHERE MATNR = IM_MATNR.

Or

SELECT SINGLE matnr, mtart, meins FROM MARA INTO CORRESPONDING FIELDS OF EX_MARA WHERE MATNR = IM_MATNR.

Kind regards,

Mateusz
5 REPLIES 5
Read only

MateuszAdamus
Active Contributor
0 Likes
1,655

Hello ramco_1917

Yes. Provide field names instead of the start. Define the structure with the fields and do the following.

SELECT SINGLE matnr, mtart, meins FROM MARA INTO EX_MARA WHERE MATNR = IM_MATNR.

Or

SELECT SINGLE matnr, mtart, meins FROM MARA INTO CORRESPONDING FIELDS OF EX_MARA WHERE MATNR = IM_MATNR.

Kind regards,

Mateusz
Read only

0 Likes
1,654

If a comma is used between column names, the valid syntax must use @:

SELECT SINGLE matnr, mtart, meins FROM MARA INTO @EX_MARA WHERE MATNR = @IM_MATNR.

Or

SELECT SINGLE matnr, mtart, meins FROM MARA INTO CORRESPONDING FIELDS OF @EX_MARA WHERE MATNR = @IM_MATNR.
Read only

0 Likes
1,654

Hi, R S,

Using the new syntax you can do the following

SELECT SINGLE FROM MARA

FIELDS matnr, mtart, meins

INTO EX_MARA

WHERE matnr = @IM_MATNR

Read only

0 Likes
1,654

If you want to declare EX_MARA inline:

into @DATA(EX_MARA)

Please note that you can have a list of available fields when pressing ctrl-space after the keyword FIELDS

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,654

Please edit your question, select your code and press the "CODE" button to make it correctly colorized/indented, so that it's easier for us to analyze it. Thank you.