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

error in select query

Former Member
0 Likes
909

Hi Experts,

we are facing some problem in select query while fetching the data.

data is coming to internal table t_table. but when i am trying to retrieve data into t_afko, it is not retrieving.

please find below code.

SELECT sap_po_nb vin_nb vsl_nb gltrp matnr werks

FROM zprdctn_ordr_mpn

INTO TABLE t_table

WHERE gltrp IN s_date AND vsl_nb IN s_vslnum

AND matnr IN s_mat AND werks IN s_plant.

IF sy-subrc EQ 0.

SELECT aufnr stlst FROM afko

INTO table t_afko

for all entries in t_table

WHERE aufnr = t_table-sap_po_nb and stlst = '01'.

endif.

Regards,

lokeswari.

7 REPLIES 7
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
869

aufnr has a conversion exit attached to it, please check it.

Read only

0 Likes
869

Hi Keshav,

Can you please elaborate it more.

Regards,

Lokeswari.

Read only

Former Member
0 Likes
869

Hi lokeswari,

Maintaine SAP_PO data type as AUFNR. and check with that selection in the AFKO table for data.

Regards,

Sri

Read only

Former Member
0 Likes
869

Dear Bandaru

please check weather the field type afko-aufnr and t_table-sap_po_nb is same,

if so remove stlst = '01'. in your second select and check, it may issue.

when same problem occurs placed the full code here, that will very help full for repliers.

Thanks in advance

Read only

Former Member
0 Likes
869

Hi,

It seems like your ztable has the value 106, but in the table the value is like 0000106. if this is the reason for your select query failure, try teh below code.

 
SELECT sap_po_nb
       vin_nb
       vsl_nb
       gltrp
       matnr
       werks
  FROM zprdctn_ordr_mpn
  INTO TABLE t_table
 WHERE gltrp IN s_date AND vsl_nb IN s_vslnum
   AND matnr IN s_mat AND werks IN s_plant.

IF sy-subrc EQ 0.

  LOOP AT t_table ASSIGNING <fs_wa>.

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = <fs_wa>-sap_po_nb
      IMPORTING
        output = <fs_wa>-sap_po_nb.

  ENDLOOP.

  IF t_table[] IS NOT INITIAL.

    SELECT aufnr
           stlst
      FROM afko
      INTO TABLE t_afko
       FOR ALL ENTRIES IN t_table
     WHERE aufnr = t_table-sap_po_nb
       AND stlst = '01'.

  ENDIF.

ENDIF.

Thanks and Regards,

Senthil kumar Anantham.

Read only

Former Member
0 Likes
869

Lokeswari,

are you sure you have entries in table t_table

what keshav is saying is domain associated with field aufnr is using some conversion exits

CONVERSION_EXIT_ALPHA_INPUT - to convert into sap format

CONVERSION_EXIT_ALPHA_OUTPUT - to convert into display format

so while using

SELECT aufnr stlst FROM afko

INTO table t_afko

for all entries in t_table

WHERE aufnr = t_table-sap_po_nb and stlst = '01'.

you need to convert t_table-sap_po_nb into sap format using CONVERSION_EXIT_ALPHA_INPUT

Thanks

Bala Duvvuri

Read only

Former Member
0 Likes
869

PLease

1. check the data types of the where clause field.

2 check data is available in databse.

hope this will help u..

let me know if u required more help on this.

Srinivas