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

ztable issue

Former Member
0 Likes
1,366

Hi all,

I have created a custom field of type numc and length 4.

Iam uploading data from text file to the ztable.

an again i retrieving data from the same table in other program

if its value is 1 its saving in database as 1 its not saving as 0001.

When i go into selection screen of ztable and give 1 as input it says no records found but when i see data without any input i see data 1 .

So i ahve to convert that field using fm CONVERSION_EXIT_ALPHA_INPUT before saving it to ztable so that i would save as 0001.

is there any alternate way for this which can be done at table itself rather than using the fm at program level.

Thanks

13 REPLIES 13
Read only

Former Member
0 Likes
1,312

Then you will have to declare the field as INTEGER, then you don't have to use the conversion function.

NUMC is meant to be numeric character, so it automatically pads with ZEROE's.

Regards,

Ravi

Note - Please mark all the helpful answers

Read only

LucianoBentiveg
Active Contributor
0 Likes
1,312

You need to create a Z Domain with convertion routine ALPHA and use it in a Z Data element, and use that element in your Z table.

Regards.

Read only

0 Likes
1,312

Hi all,

I have added alpha as conversion routine to my domain.

Even then when i upload a value of 1 to the ztable, it stores as 1 lave 3 spaces blank.

when i try to access that record through selection screen of table it says noi record found.

i tried giving 1 and 0001 in my selection in both the cases it failed and says no entries found though i have a record value 1

when i write as select query to retrieve data with value 1 its returnas sy-subrc of 4 or 8

Please let me know

Thanks

Read only

Former Member
0 Likes
1,312

Hi,

Check if the data type of the field is really a numc field..Go to the domain of the data element..and check if the data type is NUMC.

Thanks,

Naren

Read only

0 Likes
1,312

Hi

The data type is numc and length 4.

In addition to that i have given the conversion routine as alpha.

Now iam uploading a value equal to 1 ,

it uploads as 1 followed by 3 spaces ,so when i try to retrieve it witha select query it returns a sy-subrc ne 0.

i guess it should adjust to a value equal to 0001 but its not doing that .

can anyone explain as to what is happening

Thanks

Read only

Former Member
0 Likes
1,312

Hi,

For NUMC field you don't require conversion routine..Automatically it will have leading zeroes..

I tried a sample code in my system with a numc field..It is automatically adding the zeroes..

Please give me the following information to analyze further..

1) Show the structure of database table of the numc field..

FIELDNAME - ???

DATA ELEMENT - ???

DOMAIN - ??

DATA TYPE - ??

LENGTH - ??

2) Paste code the of how you are uploading to your table..

Thanks,

Naren

Read only

0 Likes
1,312

Hi narendran,

can i know your email id.

i can send you screen shots

Thanks

preeti

Read only

0 Likes
1,312

Hi initially the internal table has 0000 but when i use the following code

i has a value equal to 1.

split i_file at con_tab

into idat-id.

append idat.

Now the idat-id has a value eq 1

Thanks

Read only

Former Member
0 Likes
1,312

Hi,

Please send it to narendranm@hotmail.com

Thanks,

Naren

Read only

Former Member
0 Likes
1,312

Hi,

Did you send the screen shots to my email address.

Thanks,

Naren

Read only

0 Likes
1,312

Hi ,yes i did now

Read only

Former Member
0 Likes
1,312

Hi,

I think you have to call the FM CONVERSION_EXIT_ALPHA_INPUT..

As when you split the string and move it to the NUMC field..It is not putting the zeroes in front of it..

You manually have to insert zeroes...

split i_file at con_tab

into idat-id.

<b> CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = idat-id

IMPORTING

output = idat-id.</b>

append idat.

Now the idat-id has a value eq 0001

Thanks,

Naren

Read only

Former Member
0 Likes
1,312

Hi,

Check this example..

DATA: BEGIN OF ITAB,

CHAR(4),

NUMC(4) TYPE N,

END OF ITAB.

DATA: STR TYPE STRING.

STR = '12,12'.

SPLIT STR AT ',' INTO ITAB-CHAR ITAB-NUMC.

WRITE: / ' BEFORE '.

WRITE: / ITAB-CHAR.

WRITE: / ITAB-NUMC.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = ITAB-NUMC

IMPORTING

OUTPUT = ITAB-NUMC

.

WRITE: / ' AFTER '.

WRITE: / ITAB-CHAR.

WRITE: / ITAB-NUMC.

Thanks,

Naren