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: 

Problem in querying

Former Member
0 Kudos

I am trying to fetch all the values of POSNR for given values of AUFNR and VORNR from RESB.

Using databrowser in se11 I can query posnr on above condition and also can see the queried data.

But when I try to write SQL statements in my report nothing gets fetched. I am wondering the way I am querying is wrong or what ?

(Also I get warning like VORNR may contain null values in where clause but it get activated. I guess this is not the problem)

report ZTF1.

TABLES: RESB.

DATA: BEGIN OF IRESB OCCURS 100,

W_POSNR LIKE RESB-POSNR,

END OF IRESB.

SELECT POSNR from RESB INTO IRESB-W_POSNR where VORNR = 0010 and AUFNR = 7200000100.

ENDSELECT.

LOOP AT IRESB.

WRITE: / IRESB-W_POSNR.

ENDLOOP.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Tushar,

In your SELECT you select only record for record and you put the result into the header line of the table.

Try:

SELECT posnr

FROM RESB

INTO TABLE IRESB

WHERE VORNR = '0010'

AND AUFNR = '720000100'.

Then you can loop over your internal table!.

Regards,

John.

4 REPLIES 4

Vinod_Chandran
Active Contributor
0 Kudos

Hi,

The select is failing because there is a convertion exit for both these fields.

For VORNR it is NUMCV and for AUFNR it is ALPHA.

You can get the corresponding function module by checking in SE37 ( NUMCV and ALPHA).

Before the selection convert the values. The function modules are

CONVERSION_EXIT_NUMCV_INPUT

CONVERSION_EXIT_ALPHA_INPUT

Hope this will work.

Thanks

Vinod

Former Member
0 Kudos

Hi Tushar,

In your SELECT you select only record for record and you put the result into the header line of the table.

Try:

SELECT posnr

FROM RESB

INTO TABLE IRESB

WHERE VORNR = '0010'

AND AUFNR = '720000100'.

Then you can loop over your internal table!.

Regards,

John.

0 Kudos



data: begin of iresb occurs 100,
posnr like resb-posnr,
end of iresb.


select posnr from resb
          into corresponding fields of table iresb
            where vornr = '0010'
              and aufnr = '007200000100'.      " Conversion needed here
  loop at iresb.
    write: / iresb-posnr.
  endloop.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi, try this

SELECT POSNR from RESB INTO IRESB-W_POSNR where VORNR = '0010' and AUFNR = '007200000100'.

ENDSELECT.

or use FM 'CONVERSION_EXIT_ALPHA_OUTPUT' to convert AUFNR

Svetliin