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

into

Former Member
0 Likes
930

hi,

i understand that if selecting some particular fields from a table you have to explicitly specify the target fields or variables.

for example:

tables: mara.

select single matnr from mara into mara-matnr where matnr = p_matnr.

if select all like this no need to specify

tables: mara.

select * from mara where matnr = p_matnr.

may i know why the following select statement no need to explicitly specify fields?

tables: msku.

select amatnr awerks acharg akunnr from msku as a inner join mbew as b on

amatnr = bmatnr and awerks = bbwkey

into msku

where .....

thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
841

El,

There are almost 169 post from you in this forum. And there are hardly any point awarded by you to anybody in any of your post. Also, you do mark your post answered and close them.

Read the rules of engagement. It says:

<b>Step 4: Thank Others by Giving Points</b>

SDN/BPX has a Contributor Recognition Program. Which in short text means that for each question you have 10 points, which can be given to the person that answers your question.

So if you want to continue using this forum and expect other to answer and solve your issue, Plese show some coutsey by awaring points, marking the thread as answered once the issue is resolved and close the thread.

Regards,

RS

6 REPLIES 6
Read only

Former Member
0 Likes
842

El,

There are almost 169 post from you in this forum. And there are hardly any point awarded by you to anybody in any of your post. Also, you do mark your post answered and close them.

Read the rules of engagement. It says:

<b>Step 4: Thank Others by Giving Points</b>

SDN/BPX has a Contributor Recognition Program. Which in short text means that for each question you have 10 points, which can be given to the person that answers your question.

So if you want to continue using this forum and expect other to answer and solve your issue, Plese show some coutsey by awaring points, marking the thread as answered once the issue is resolved and close the thread.

Regards,

RS

Read only

0 Likes
841

rs,

i always giving out points. how can you say i not giving out?

rgds

Read only

Former Member
0 Likes
841

hi !!

If the definition of your target table / work area is same as the sequence of fields in your select statement then you do not need to mention the target fields , the respective fields get inputted into the target work area or table . However the fields properties and field sequence in the target should be matching to the field sequence and technical properties of the selected field .

Like for your example the internal table it_msku should be defined like below :

data : begin of it_msku occurs 0 ,

matnr like msku-matnr ,

werks like msku-werks,

charg like msku-charg,

kunnr like msku-kunnr,

end of it_msku.

Read only

0 Likes
841

hi,

thanks for reply.

i actually want to know the into addition.

my first example need to explicitly put into variable to store whereas my second example select * so there is no into addition is needed.

my question on the third select statement, why into msku has no problem despite i only select several fields in this table.

i will reward point when i got the answer to my question

thanks

Read only

0 Likes
841

Hi El,

Whenever you get some time, please revisit all your threads and decide your self how may you have close and awarded the points.

I just want solve as many issue as i can. So here is the answer to your question.

Please refer to this code. Here fields KUNNR, VKORG, VBELN, ERDAT is select from the JOIN of table VAKPA and VBAK. If you see closely, you will see the internal table i am selecting the data in ( lit_vbak) contains the same fields and in the same order i am selecting in select statement. That is the reason you do not need to explicitaly define fields. I hope i clarify your doubt. Let me know if you have any other question.

*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
TABLES: vbak.
CONSTANTS: c_auart LIKE vbak-auart VALUE 'ZOR',
           c_parvw LIKE vbpa-parvw VALUE 'SP'.

DATA: BEGIN OF lit_vbak OCCURS 0,
        kunnr LIKE vbak-kunnr,
        vkorg LIKE vbak-vkorg,
        vbeln LIKE vbak-vbeln,
        erdat LIKE vbak-erdat,
      END OF lit_vbak.

SELECT-OPTIONS: s_kunnr FOR vbak-kunnr.

SELECT
      a~kunde
      a~vkorg
      a~vbeln
      b~erdat FROM vakpa AS a
              INNER JOIN vbak AS b
              ON a~vbeln = b~vbeln
              INTO TABLE lit_vbak
              WHERE a~kunde IN s_kunnr AND
                    a~parvw = c_parvw  AND
                    a~auart = c_auart.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*

Regards,

RS

Read only

Former Member
0 Likes
841

generally we can do two things here

tables: msku.

select amatnr awerks acharg akunnr from msku as a inner join mbew as b on

amatnr = bmatnr and awerks = bbwkey

into <b>corresponding fields of</b> msku

where .....

it will store the data where the field name will match means it will fill the data in msku-matnr msku-werks msku-charg msku-kunnr .

but as per your case

tables: msku.

select amatnr awerks acharg akunnr from msku as a inner join mbew as b on

amatnr = bmatnr and awerks = bbwkey

into msku

where .....

the sequence of the fields describe in msku must be matnr werks charg and kunnr but if it is not in that sequence then it may give you incorrect result or dump error( if it cant place the data in target field). suppose in msku table werks come prior to matnr means the order is werks matnr charg kunnr and you are fetching the data like above code then it will surely give a dump error because you are fetching matnr first and try to place it in werks field . just check that... so it is a good practice to use into corresponding fields declaration or select the data in the same order as per the target area field ( in your case table msku or you can take in int tbale also)...

regards

shiba dutta