‎2011 Feb 16 11:15 PM
Can anyone tell me why this works for the first table and not he second?
Ok when I use the SELECT SINGLE statement on table T005X it works
I set everthing up like so
DATA: TEST_VAR1(2) TYPE C VALUE 'US'.
DATA: wa_t005x type t005x.
select single * from t005x into wa_t005x where land = TEST_VAR1.
and all the fields in wa_t005x have a value.
But.....when I do the same thing against table ADRC
DATA: TEST_VAR2(5) TYPE C VALUE 36705.
DATA: WA_ADRC TYPE ADRC.
Select single * from ADRC into WA_ADRC where ADDRNUMBER = TEST_VAR2.
I don't pull any data to the WA_ADRC fields
any thoughts?
‎2011 Feb 16 11:22 PM
Please pass leading zero's in where condition while selecting ADRC.
‎2011 Feb 16 11:22 PM
Please pass leading zero's in where condition while selecting ADRC.
‎2011 Feb 16 11:32 PM
Ok First i checked table ADRC-ADDRNUMBER's length and found it to be 10
the only way I know how to do that is to change to this
DATA: TEST_VAR2 TYPE n length 10 VALUE 36705.
So i tried that and go this output for TEST_VAR2 0000036705
but still nothing in WA_ADRC-ADDRNUIMBER is still blank
i tried with N LENGTH 10 and C LENGTH 10.
Is there another way to do this?
‎2011 Feb 16 11:35 PM
In order to get the leading zeroes, like indicated rightfully in the first reply, do the following:
DATA: TEST_VAR2(10) TYPE C VALUE 36705.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = TEST_VAR2
IMPORTING
output = TEST_VAR2.
Kind regards,
Robert
‎2011 Feb 16 11:48 PM
Same thing output for TEST_VAR2 is 0000036705
and nothing for ADDRNUMBER
I'm going to post the code just incase someone see's something I don't (i'm not getting any errors)
*************************TABLE ADRC*******************************************
DATA: TEST_VAR2(10) TYPE C VALUE 36705.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = TEST_VAR2
IMPORTING
output = TEST_VAR2.
DATA: WA_ADRC TYPE ADRC.
Select single * from ADRC into WA_ADRC where ADDRNUMBER = TEST_VAR2.
WRITE:/ 'THIS IS WHAT IS STORED IN TEST_VAR RIGHT NOW: ', TEST_VAR2.
WRITE:/ 'OK LETS HOPE THIS IS THE SAME FOR ADDRNUMBER: ', WA_ADRC-ADDRNUMBER.
*****************************TABLE T005X*****************************************
DATA: TEST_VAR1(2) TYPE C VALUE 'US'.
DATA: wa_t005x type t005x.
select single * from T005X into WA_T005X where LAND = TEST_VAR1.
WRITE:/ 'OK LETS TRY DIFFERENT SET THIS IS COUNTRY: ', TEST_VAR1.
WRITE:/ 'AND THIS IS WA_T005X-LAND I HOPE: ', WA_T005X-LAND.
WRITE:/ 'THIS IS A TEST TO SEE IF I GOT THE WHOLE TABLE FROM WA_T005X'.
WRITE:/ 'OK THIS IS THE DATE FORMAT CHAR: ', WA_T005X-DATFM.
WRITE:/ 'AND THE TIME FORMATE: ', WA_T005X-TIMEFM.
WRITE:/ 'AND THE DECIMAL NOTATION: ', WA_T005X-XDEZP.
WRITE:/ 'AND THE CLIENT: ', WA_T005X-MANDT.
‎2011 Feb 16 11:52 PM
I have tested and it works as we expected.
see the source code :
tables : adrc.
data: wa_adrc like adrc,
test_var2(10) type c.
start-of-selection.
test_var2 = '22349'.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = test_var2
importing
output = test_var2.
select single * from adrc into wa_adrc
where addrnumber = test_var2.
if sy-subrc eq 0.
write:/ wa_adrc-addrnumber.
endif.
‎2011 Feb 16 11:54 PM
Are you sure the number is actually 36705? Check it on SE16 for ADRC? Maybe you are looking in a different client??
‎2011 Feb 17 12:01 AM
Yep this is copied and pasted right from SE16 36705 just to be sure
I tried your code too Seshu and it still didn't give me a value maybe something else is wrong I don't know any ideas?
‎2011 Feb 17 12:03 AM
did you try with:
DATA: TEST_VAR2(10) TYPE n VALUE 36705.
Type = N not C.
‎2011 Feb 17 12:23 AM
I copied Seshu's program and tested it with a value in our system and it works fine, so there must either be a problem with your data or somewhere in your program.
I would recommend you doing the same.
Kind regards,
Robert
‎2011 Feb 17 12:42 AM
I have tried your own code in my system, with a different addrnumber, and it works.
Have you tried debugging it? Step through and watch if the variable is changed as you expect it to.
‎2011 Feb 17 4:38 AM
hi,
declare your field like
DATA: TEST_VAR2 like adrc-ADDRNUMBER VALUE 36705.
and use CONVERSION_EXIT_ALPHA_INPUT for TEST_VAR2.
regards
Ganesh Reddy
Edited by: Ganesh Reddy on Feb 17, 2011 10:15 AM
‎2011 Feb 17 9:21 AM
PLEASE DECLARE TEST_VAR(2) TYPE (TABLE-FIELDNAME) OR (DATAELEMENT) INSTEAD OF CHAR 10
‎2011 Feb 16 11:50 PM
you can also do it like this:
DATA: TEST_VAR2(10) TYPE n VALUE 36705.
DATA: WA_ADRC TYPE ADRC.
Select single * from ADRC into WA_ADRC
where ADDRNUMBER = TEST_VAR2.
write:/ sy-dbcnt.
‎2011 Feb 17 10:01 AM
Hi..
Conversion routine is there for this field ADDRNUMBER domain AD_ADDRNUM.
Use FM's CONVERSION_EXIT_ALPHA_INPUT
CONVERSION_EXIT_ALPHA_OUTPUT
to convert the value and then pass.
regards,
Lokesh
‎2011 Feb 17 10:47 AM
Hi
This is working for me
DATA: var2(10) TYPE c VALUE 36705.
DATA: wa_adrc TYPE adrc.
UNPACK var2 TO var2.
SELECT SINGLE * FROM adrc INTO wa_adrc WHERE addrnumber = var2.
WRITE: wa_adrc.
Did you check if this 36705 address number exist?
‎2011 Feb 17 10:58 AM
DATA: TEST_VAR2(10) TYPE C VALUE '0000036705'.
DATA: WA_ADRC TYPE ADRC.
Select single * from ADRC into WA_ADRC where ADDRNUMBER = TEST_VAR2.
‎2011 Feb 17 11:00 AM
Try following code it works perfectly.
DATA: TEST_VAR2(10) TYPE C VALUE '0000036705'.
DATA: WA_ADRC TYPE ADRC.
Select single * from ADRC into WA_ADRC where ADDRNUMBER = TEST_VAR2.
‎2011 Feb 17 3:04 PM
first, use SE11 or SE16 to see if your address number exists in ADRC....simplest way to find out why your program didn't work, I think.
‎2011 Feb 17 3:43 PM
Sorry everyone all the code is working fine now I was having an issue with my sandbox
I have all the code from this thread pasted into my program and everyone's is working correctly now
including my original setup
sorry and thanks for everyone's help and quick replies