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

select fails

Former Member
0 Likes
490

Hi,

My select statement is failing because in the where clause material number(matnr) in the table(ekbe) is having leading zeros where as material number of wa_poauto-matnr does not.

select ebeln ebelp vgabe gjahr belnr buzei wrbtr lfbnr

into table ts_ekbe

from ekbe

where ebeln = wa_poat-ponum and

xblnr = wa_poat-contr and

matnr = wa_poat-matnr and

vgabe in ('1', '2').

Please let me know if you don't understand the issue. Any clue is appricitated.

Thanks,

Surya.

1 ACCEPTED SOLUTION
Read only

former_member186741
Active Contributor
0 Likes
453

Before your select USE A CONVERSION EXIT TO GET THE WA_POAUTO NUMBER IN THE SAME FORMAT AS THE DB:

eg,

  • use conversion exit

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

input = wa_poat-matnr

IMPORTING

output = wa_poat-matnr .

Hi,

My select statement is failing because in the where clause material number(matnr) in the table(ekbe) is having leading zeros where as material number of wa_poauto-matnr does not.

select ebeln ebelp vgabe gjahr belnr buzei wrbtr lfbnr

into table ts_ekbe

from ekbe

where ebeln = wa_poat-ponum and

xblnr = wa_poat-contr and

matnr = wa_poat-matnr and

vgabe in ('1', '2').

Please let me know if you don't understand the issue. Any clue is appricitated.

Thanks,

Surya.

3 REPLIES 3
Read only

Former Member
0 Likes
453

If you selecting the matnr from the database for the field wa_poat-matnr..you don't have to do anything..

Check if there is any record available in the table EKBE for the corresponding combination in the where clause...

Thanks,

Naren

Read only

former_member186741
Active Contributor
0 Likes
454

Before your select USE A CONVERSION EXIT TO GET THE WA_POAUTO NUMBER IN THE SAME FORMAT AS THE DB:

eg,

  • use conversion exit

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

input = wa_poat-matnr

IMPORTING

output = wa_poat-matnr .

Read only

Former Member
0 Likes
453

One way is to use the conversion routine to change the value of input to 18chars before the select statement.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
  EXPORTING
    input  = wa_poat-matnr
  IMPORTING
    output = wa_poat-matnr
  EXCEPTIONS
    OTHERS = 0.


select ebeln ebelp vgabe gjahr belnr buzei wrbtr lfbnr
       into table ts_ekbe
       from ekbe
       where ebeln = wa_poat-ponum and
             xblnr = wa_poat-contr and
             matnr = wa_poat-matnr and
             vgabe in ('1', '2').

Hope this helps you.

Kind Regards

Eswar