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: 

Select query warning. Please help.

0 Kudos

I have written this select statement below,

      SELECT a~matnr
        INTO CORRESPONDING FIELDS OF TABLE lt_matnr
        FROM marc AS a
        INNER JOIN t001w AS b ON b~werks = a~werks
        INNER JOIN t001k AS c ON c~bwkey = b~bwkey
        FOR ALL ENTRIES IN lt_low2
        WHERE c~bukrs = lt_low2-low.

But it is giving me this warning and it's fetching blank value and it's showing total number of value fetched. 489 value fetched.

I cross checked the table according the satement and that table table showing 489 value with exact value.

The warning is:

The work area does not contain any corresponding errors.

1 ACCEPTED SOLUTION

former_member1716
Active Contributor

Hello,

Your code must be as below, the issue is you have named the Field name in structure declaration as MATERIAL ( in lt_matnr declaration) but the in the query you have given MATNR as field selected and given CORRESPONDING FIELDS, for this statement the target structure should have MATNR field in it. Since you have MATERIAL as the field name system could not find the field.

By changing the field name to MATNR from MATERIAL you will get successful output. below pasted the correct code along with correct declarations.

TABLES: marc, t001k.
TYPES: BEGIN OF tt_bukrs,
         bukrs TYPE t001k-bukrs,
       END OF tt_bukrs,


       BEGIN OF tt_mat1,
         sign   TYPE c LENGTH 1,
         option TYPE c LENGTH 2,
         low    TYPE matnr,
         high   TYPE matnr,
       END OF tt_mat1,

       BEGIN OF tt_low,
         low TYPE matnr,
       END OF tt_low,

       BEGIN OF tt_low2,
         low TYPE bukrs,
       END OF tt_low2.


DATA: BEGIN OF lt_matnr OCCURS 0,
       matnr LIKE marc-matnr,
      END OF lt_matnr.

DATA: lt_burks  TYPE STANDARD TABLE OF tt_bukrs,
      lwa_burks TYPE tt_bukrs,
      lwa_mat1  TYPE tt_mat1,
      lwa_low   TYPE tt_low,
      lv_low    TYPE matnr,
      lt_low    TYPE STANDARD TABLE OF tt_low,
      lt_low2   TYPE STANDARD TABLE OF tt_low2.


SELECT a~matnr
INTO CORRESPONDING FIELDS OF TABLE lt_matnr
FROM marc AS a
INNER JOIN t001w AS b ON a~werks = b~werks
INNER JOIN t001k AS c ON b~bwkey = c~bwkey
FOR ALL ENTRIES IN lt_low2
WHERE c~bukrs = lt_low2-low.

Hope it Helps!

Regards
6 REPLIES 6

former_member1716
Active Contributor

Hello Mehabub Mondal,

Can you be more specific with the details, Like

What is the structure of lt_matnr and what is the structure of lt_low2

Regards

0 Kudos

Hi Satish,

These are the declaration:

TABLES: marc, t001k.

TYPES: BEGIN OF tt_bukrs,

bukrs TYPE t001k-bukrs,

END OF tt_bukrs,

BEGIN OF tt_mat1,

sign TYPE c LENGTH 1,

option TYPE c LENGTH 2,

low TYPE matnr,

high TYPE matnr,

END OF tt_mat1,

BEGIN OF tt_low,

low TYPE matnr,

END OF tt_low,

BEGIN OF tt_low2,

low TYPE bukrs,

END OF tt_low2.

DATA: BEGIN OF lt_matnr OCCURS 0,

material LIKE marc-matnr,

END OF lt_matnr.

DATA: lt_burks TYPE STANDARD TABLE OF tt_bukrs,

lwa_burks TYPE tt_bukrs,

lwa_mat1 TYPE tt_mat1,

lwa_low TYPE tt_low,

lv_low TYPE matnr,

lt_low TYPE STANDARD TABLE OF tt_low,

lt_low2 TYPE STANDARD TABLE OF tt_low2.

I hope this will help you!!

former_member1716
Active Contributor

Hello,

Your code must be as below, the issue is you have named the Field name in structure declaration as MATERIAL ( in lt_matnr declaration) but the in the query you have given MATNR as field selected and given CORRESPONDING FIELDS, for this statement the target structure should have MATNR field in it. Since you have MATERIAL as the field name system could not find the field.

By changing the field name to MATNR from MATERIAL you will get successful output. below pasted the correct code along with correct declarations.

TABLES: marc, t001k.
TYPES: BEGIN OF tt_bukrs,
         bukrs TYPE t001k-bukrs,
       END OF tt_bukrs,


       BEGIN OF tt_mat1,
         sign   TYPE c LENGTH 1,
         option TYPE c LENGTH 2,
         low    TYPE matnr,
         high   TYPE matnr,
       END OF tt_mat1,

       BEGIN OF tt_low,
         low TYPE matnr,
       END OF tt_low,

       BEGIN OF tt_low2,
         low TYPE bukrs,
       END OF tt_low2.


DATA: BEGIN OF lt_matnr OCCURS 0,
       matnr LIKE marc-matnr,
      END OF lt_matnr.

DATA: lt_burks  TYPE STANDARD TABLE OF tt_bukrs,
      lwa_burks TYPE tt_bukrs,
      lwa_mat1  TYPE tt_mat1,
      lwa_low   TYPE tt_low,
      lv_low    TYPE matnr,
      lt_low    TYPE STANDARD TABLE OF tt_low,
      lt_low2   TYPE STANDARD TABLE OF tt_low2.


SELECT a~matnr
INTO CORRESPONDING FIELDS OF TABLE lt_matnr
FROM marc AS a
INNER JOIN t001w AS b ON a~werks = b~werks
INNER JOIN t001k AS c ON b~bwkey = c~bwkey
FOR ALL ENTRIES IN lt_low2
WHERE c~bukrs = lt_low2-low.

Hope it Helps!

Regards

0 Kudos

Thanks Satish. Now it's working and also understood the problem.

UweFetzer_se38
Active Contributor
SELECT a~matnr as material

should work.

By the way: OCCURS 0 is depreciated since many years...

0 Kudos

Yes, it has also worked! Thank you se38