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: 

Regarding AUFK, AUAK / COSB tables

ananthula_sumanth
Participant
0 Kudos
1,389

Hi all,

I am working on WIP Aging Report and for this, i need to extract the data from the AUFK and COSB tables. I was told to get all the AUFNR values from AUFK table and then the values of AUFK-AUFNR will match with COSB-OBJNR values excluding the first two letters. Is there any other way to implement this requirement as extracting data without 'where' clause in from AUAK or COSB tables results with huge amount of data.

Regards,

1 ACCEPTED SOLUTION

Former Member
0 Kudos
235

Hi,

you can fetch the OBJNR directly from AUFK and use it for the select on COSB.

Regards

Uwe

2 REPLIES 2

Former Member
0 Kudos
235

Hiya

Try something like this, you may need to amend for your purpose but the principle may work for you. If you don't already know, never do FOR ALL ENTRIES with an empty itab...

Regards,

KM

TYPES: BEGIN OF T_AUFK,
	 AUFNR LIKE AUFK-AUFNR,
	 OBJNR LIKE COSB-OBJNR,
       END OF T_AUFK.

DATA: IT_AUFK TYPE STANDARD TABLE OF T_AUFK,
      IT_COSB TYPE STANDARD TABLE OF COSB.

FIELD-SYMBOLS: <AUFK> LIKE LINE OF IT_AUFK.


{ ..... }


* Get your order numbers
SELECT AUFNR INTO TABLE IT_AUFK 
       FROM AUFK 
       WHERE etc etc

IF NOT IT_AUFK IS INITIAL.

* Take 2 chars off AUFNR to give OBJNR
  LOOP AT IT_AUFK ASSIGNING <AUFK>.
    <AUFK>-OBJNR = <AUFK>-AUFNR.
    SHIFT <AUFK>-OBJNR BY 2 PLACES.
  ENDLOOP.

* Use OBJNR in the internal table to select from COSB
  SORT IT_AUFK BY OBJNR.
  SELECT * INTO TABLE IT_COSB
         FROM COSB
	 FOR ALL ENTRIES IN IT_AUFK
         WHERE OBJNR = IT_AUFK-OBJNR.

ENDIF.

Former Member
0 Kudos
236

Hi,

you can fetch the OBJNR directly from AUFK and use it for the select on COSB.

Regards

Uwe