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

Problem in SELECT SINGLE Query

Former Member
0 Likes
1,888

Hi,

I am writing a small quesry in PS, Though the entry exist in database table PRPS, The sy-subrc is 4 for this query.Can u help me.

data : wa_src_prps like prps-posid.

start-of-selection.

wa_src_prps = '3-3310-02-01-01-10-20'.

DATA: lv_pbukr LIKE prps-pbukr.

CLEAR: lv_pbukr.

SELECT SINGLE pbukr INTO lv_pbukr

FROM prps

WHERE posid EQ wa_src_prps.

if sy-subrc = 0.

write:/5 wa_src_prps, lv_pbukr.

endif.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,422

Hi,

Before passing the value in selct query use conversion routine :

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = wa_src_prps

IMPORTING

OUTPUT = wa_src_prps.

Then pass this value. Hopefully ur problem should get resolved.

Regards,

Lalit

11 REPLIES 11
Read only

Sm1tje
Active Contributor
0 Likes
1,422

you will have to take the conversion routine for this field into account, are you doing so?

1. CONVERSION_EXIT_ABPSN_INPUT Format > Without Edition (Project Number / WBS Element Number)

2. CONVERSION_EXIT_ABPSN_OUTPUT Format > With Edition (Project Number / WBS Element Number)

Edited by: Micky Oestreich on Mar 19, 2009 8:14 AM

Read only

Former Member
0 Likes
1,422

Could you tell me the Conversion routine.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,422

Hi,

Use:


data : wa_src_prps like prps-posid.

start-of-selection.

  wa_src_prps = '3-3310-02-01-01-10-20'.

  DATA: lv_pbukr LIKE prps-pbukr.
  CLEAR: lv_pbukr.
  SELECT SINGLE pbukr INTO lv_pbukr
  FROM prps
  WHERE posid EQ wa_src_prps.

  if sy-subrc = 0.
    write:/5 wa_src_prps, lv_pbukr.
  endif.

Check the suitable data in database table PRPS for data in where clause (for POSID).

Regards,

Tarun

Read only

former_member209217
Active Contributor
0 Likes
1,422

Hi Deepthi,

The field posid is of length 24.

But ur passing value of shorter length to the work area

.Dont ignore any zeroes.Please add them if they are present.

Regards,

Lakshman

Read only

Former Member
0 Likes
1,422

Hi,

If you check the domain of posid you'll see it has a conversion routine attached to it.

There is a chance that while you select query is being executed the format is different from the one entered. Try running the program in debugging mode ane check the value at runtime. If there is a difference then you will have to conert it using the function modules

CONVERSION_EXIT_ABPSN_INPUT or

CONVERSION_EXIT_ABPSN_OUTPUT

Hope this helps.

Regards,

Sachin.

Read only

Former Member
0 Likes
1,422

hi,

fm: CONVERSION_EXIT_ABPSN_INPUT

CONVERSION_EXIT_ABPSN_OUTPUT

write PSPNR also in the where condition as it is the primary key and u are using select single

wa_src_prps sholud be of length 24.

SELECT SINGLE pbukr INTO lv_pbukr

FROM prps

WHERE

pspnr = '1252525' and "some value of pspnr

posid EQ wa_src_prps.

thanks

Read only

Former Member
0 Likes
1,422

Hi,

For '3-3310-02-01-01-10-20' wbs-element ,there is no record ,so sy-subrc is 4.

Read only

Former Member
0 Likes
1,422

Use conversion routine: CONVERSION_EXIT_ABPSN_INPUT for wa_src_prps.

pass wa_src_prps as input and get wa_src_prps as ouput.

Pass this wa_src_prps to the select query. u can fetch data.

Reg,

Sachin

Read only

Former Member
0 Likes
1,423

Hi,

Before passing the value in selct query use conversion routine :

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = wa_src_prps

IMPORTING

OUTPUT = wa_src_prps.

Then pass this value. Hopefully ur problem should get resolved.

Regards,

Lalit

Read only

0 Likes
1,422

Thanks guys...

My problem is solved

Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
1,422

hi,

DATA : wa_src_prps LIKE prps-posid.

START-OF-SELECTION.

  wa_src_prps = '0-1000-0'.

" Conversion Routine for domain PS_POSID
  CALL FUNCTION 'CONVERSION_EXIT_ABPSN_INPUT'
    EXPORTING
      input  = wa_src_prps
    IMPORTING
      output = wa_src_prps.


  DATA: lv_pbukr LIKE prps-pbukr.
  CLEAR: lv_pbukr.
  SELECT SINGLE pbukr INTO lv_pbukr
  FROM prps
  WHERE posid EQ wa_src_prps.

  IF sy-subrc = 0.
    WRITE:/5 wa_src_prps, lv_pbukr.
  ENDIF.