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

problem in query

Former Member
0 Likes
1,348
SELECT matnr
           charg
           CUOBJ_BM
      from mch1
      INTO TABLE it_mch1
      FOR ALL ENTRIES IN it_resb
      WHERE matnr = it_resb-matnr
      AND charg = it_resb-charg.

  IF NOT it_mch1 is INITIAL.

    SELECT OBJEK
           ATINN
           ATWRT
      FROM ausp
      INTO TABLE it_ausp
      FOR ALL ENTRIES IN it_mch1
      WHERE objek eq V_OBJNR
      AND   Atinn = 'BIN_LOCATION'.

in the above code how i can link between MCH1 and AUSP table....

i tried using OBJEK and CUOBJ_BM but there lengths are different so it is giving error...

can any body help me to get ATWRT value?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,301

Hi,

Try the following,



data: begin of it_mch1 occurs 0,
        charg like mch1-charg,
        CUOBJ_BM(50) type c,
        end of it_mch1.


SELECT matnr
           charg
           CUOBJ_BM
      from mch1
      INTO TABLE it_mch1
      FOR ALL ENTRIES IN it_resb
      WHERE matnr = it_resb-matnr
      AND charg = it_resb-charg.
 
  IF NOT it_mch1 is INITIAL.
 
    SELECT OBJEK
           ATINN
           ATWRT
      FROM ausp
      INTO TABLE it_ausp
      FOR ALL ENTRIES IN it_mch1
      WHERE objek eq it_mch1-CUOBJ_BM
      AND   Atinn = 'BIN_LOCATION'.

Regards,

Vik

8 REPLIES 8
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,301


data:ra_objek type range of ausp-objek.
data:wa_objek like line of ra_objek.

wa_objek-sign = 'I'.
wa_objek-sign = 'EQ'.

loop at it_mch1 into wa_mch1.
wa_objek-low = wa_mch1-CUOBJ_BM.
collect wa_objek into ra_objek .
endloop.

    SELECT OBJEK  ATINN  ATWRT  FROM ausp
      INTO TABLE it_ausp
      WHERE objek in    ra_objek
    AND   Atinn = 'BIN_LOCATION'.
Read only

Former Member
0 Likes
1,302

Hi,

Try the following,



data: begin of it_mch1 occurs 0,
        charg like mch1-charg,
        CUOBJ_BM(50) type c,
        end of it_mch1.


SELECT matnr
           charg
           CUOBJ_BM
      from mch1
      INTO TABLE it_mch1
      FOR ALL ENTRIES IN it_resb
      WHERE matnr = it_resb-matnr
      AND charg = it_resb-charg.
 
  IF NOT it_mch1 is INITIAL.
 
    SELECT OBJEK
           ATINN
           ATWRT
      FROM ausp
      INTO TABLE it_ausp
      FOR ALL ENTRIES IN it_mch1
      WHERE objek eq it_mch1-CUOBJ_BM
      AND   Atinn = 'BIN_LOCATION'.

Regards,

Vik

Read only

0 Likes
1,301

hi

i tried as u told...

but im not getting values to it_ausp...

can u help me on this?

Regards

Smitha

Read only

0 Likes
1,301

Hi ,

I checked in my system and its fetching values for ATWRT


data: begin of it_mch1 occurs 0,
        charg like mch1-charg,
        CUOBJ_BM(50) type c,
        end of it_mch1.
 
data: begin of it_ausp occurs 0,
        OBJEK(50) type c,
           ATINN like ausp-atinn,
           ATWRT like ausp-atwrt,
end  of it_ausp.

SELECT matnr
           charg
           CUOBJ_BM
      from mch1
      INTO TABLE it_mch1
      FOR ALL ENTRIES IN it_resb
      WHERE matnr = it_resb-matnr
      AND charg = it_resb-charg.
 
  IF NOT it_mch1 is INITIAL.
 
    SELECT OBJEK
           ATINN
           ATWRT
      FROM ausp
      INTO TABLE it_ausp
      FOR ALL ENTRIES IN it_mch1
      WHERE objek eq it_mch1-CUOBJ_BM
      AND   Atinn = 'BIN_LOCATION'.

define both OBJEK and CUOBJ_BM as char of length 50 in the internal tables.

Even then if it_ausp is not getting populated, then the other where condition must not been satisfied. Try this and check if valid values are there in the database for Atinn = 'BIN_LOCATION'.

Regards,

Vik

Read only

Former Member
0 Likes
1,301

Hi smitha,

why dont you try in the second query where

OBJEK=it_MCH-CUOBJ_BM.

I think this should solve your problem.

Regards

Sunil

Read only

Former Member
0 Likes
1,301

You can try out LKENZ field in AUSP & LVORM in MCH1..

I hope this helps...

Regards,

Anupam.

Read only

former_member585060
Active Contributor
0 Likes
1,301

Hi,

If you have Class, Classtype and Object(Matnr), then you can get the values with the below FM

CLAF_CLASSIFICATION_OF_OBJECTS

a. Call the function module CLAF_CLASSIFICATION_OF_OBJECTS with the following input parameters

Class =

Class Type =

Object = (Matnr)

b. Read the table T_OBJECTDATA

Atnam = characteristic name as mentioned in the file format

Ausp1 = read the value and assign the value to the respective field in the output

Regards

Bala Krishna

Edited by: Bala Krishna on Aug 5, 2009 1:35 PM

Read only

former_member199306
Participant
0 Likes
1,301

but i want to know that if our structure is declared with type then what will be the solution for such problem.

pls reply me