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

how to feach data from database table to internal table

1190_5939_439
Active Participant
0 Likes
1,086

Hi Experts

The code is following. There are some data in the item2. But I hope feach lgort from mseg to item2.

But the result is not right .Can you help me ?

Thanks in advance.

SELECT  MSEG~LGORT
    INTO CORRESPONDING FIELDS OF TABLE ITEM2
    FROM MSEG
     FOR ALL ENTRIES IN ITEM2
    WHERE  MBLNR = ITEM2-BELNR AND matnr = ITEM2-matnr .
1 ACCEPTED SOLUTION
Read only

tom_wan
Product and Topic Expert
Product and Topic Expert
0 Likes
1,021

没有图啊,不确定什么问题。估计跟列名有关系。你试试别名。

起的别名要跟ITEM2里你想存LGORT的列同名

SELECT MSEG~LGORT as <XXXXX>

INTO CORRESPONDING FIELDS OF TABLE ITEM2

FROM MSEG

FOR ALL ENTRIES IN ITEM2

WHERE MBLNR = ITEM2-BELNR AND matnr = ITEM2-matnr .

然后这里怎么ITEM2又在FAE里又在INTO里,感觉怪怪的(是不是不太好 😞 )

Hi Experts

The code is following. There are some data in the item2. But I hope feach lgort from mseg to item2.

But the result is not right .Can you help me ?

Thanks in advance.

SELECT  MSEG~LGORT
    INTO CORRESPONDING FIELDS OF TABLE ITEM2
    FROM MSEG
     FOR ALL ENTRIES IN ITEM2
    WHERE  MBLNR = ITEM2-BELNR AND matnr = ITEM2-matnr .
3 REPLIES 3
Read only

tom_wan
Product and Topic Expert
Product and Topic Expert
0 Likes
1,022

没有图啊,不确定什么问题。估计跟列名有关系。你试试别名。

起的别名要跟ITEM2里你想存LGORT的列同名

SELECT MSEG~LGORT as <XXXXX>

INTO CORRESPONDING FIELDS OF TABLE ITEM2

FROM MSEG

FOR ALL ENTRIES IN ITEM2

WHERE MBLNR = ITEM2-BELNR AND matnr = ITEM2-matnr .

然后这里怎么ITEM2又在FAE里又在INTO里,感觉怪怪的(是不是不太好 😞 )

Read only

1,021

Better answer in English if the question is asked in English, so that future visitors can understand the answer if they have the same question 😉

Read only

tom_wan
Product and Topic Expert
Product and Topic Expert
0 Likes
1,021

Thanks for your advice.

I think the cause is the "MSEG~LGORT" doesn't exist in ITEM2.

I suggest use alias:

SELECT MSEG~LGORT as <XXXXX>

INTO CORRESPONDING FIELDS OF TABLE ITEM2

FROM MSEG

FOR ALL ENTRIES IN ITEM2

WHERE MBLNR = ITEM2-BELNR AND matnr = ITEM2-matnr .

<XXXXX> must equals to the column name of LGORT in ITEM2