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

Query Problem

Former Member
0 Likes
699

hi

i have put the follwoing query in my module pool


*&---------------------------------------------------------------------*
*&      Module  val_meins_101  INPUT
*&---------------------------------------------------------------------*
 MODULE val_meins_101 INPUT.
   DATA:v_meins LIKE t006-msehi.
   CLEAR v_meins.
   SELECT SINGLE msehi INTO v_meins
    FROM t006
    WHERE msehi = i_mat_master-meins.

   IF sy-subrc IS NOT INITIAL.
     MESSAGE e001(zmm) WITH 'Invalid Unit'.
   ENDIF.
 ENDMODULE.                 " val_meins_101  INPUT

when my program runs the value of i_mat_master-meins comes 'PAC' and the query gives error

but when i saw this field in table T006 the entry exists there but this query gives error

i have checked many times but for this particular Unit PAC the query gives error inspite of having value in the table.

kindly tell wats the problem.

abhishek

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
563

Hi,

Use the FM CONVERSION_EXIT_CUNIT_INPUT..

tables: t006.

data: v_MSEHI type MSEHI.

CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'

EXPORTING

input = 'PAC'

IMPORTING

OUTPUT = V_MSEHI

EXCEPTIONS

UNIT_NOT_FOUND = 1

OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

select single * from t006

where msehi = v_msehi.

write: / sy-subrc.

Thanks,

Naren

3 REPLIES 3
Read only

Former Member
0 Likes
563

I think the entry should be 'PC" and not "PAC".There is no entry for PAC in t006.

Read only

Former Member
0 Likes
564

Hi,

Use the FM CONVERSION_EXIT_CUNIT_INPUT..

tables: t006.

data: v_MSEHI type MSEHI.

CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'

EXPORTING

input = 'PAC'

IMPORTING

OUTPUT = V_MSEHI

EXCEPTIONS

UNIT_NOT_FOUND = 1

OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

select single * from t006

where msehi = v_msehi.

write: / sy-subrc.

Thanks,

Naren

Read only

Former Member
0 Likes
563

Hi,

The field MSEHI in the table T006 uses a conversion routine CUNIT and hence needs to be used with the conversion routines

CONVERSION_EXIT_CUNIT_INPUT

CONVERSION_EXIT_CUNIT_OUTPUT

for input and output.

Please use CONVERSION_EXIT_CUNIT_INPUT by passing the value PAC .The value obtained from the routine needs to be passed as a variable to the select query.

Regards

Sunil.M