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

Re: Condensing Values from Internal Table

Former Member
0 Likes
4,245

Hi Abapers,

In PBO i have written a select query which fetches data from Z table. Everything work's fine for me but when am adding or inserting a new record to database

table and fetching it back, in debugging mode it shows that new values added in internal table are with leading space. Due to this my sort functionality is getting this values first.

But when i see the same entry  in ztable it's fine.

Please help me in this regard!

Thanks

Sandy.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,831

Hi All,

Thanks for all the Post, I tried checking with internal table and way the select query is written.

But condense or conversion exit alpa fm will work for single entry that is for work area.

But how to condense value in an internal table which the newly inserted value.

15 REPLIES 15
Read only

rajesh_kumar2
Product and Topic Expert
Product and Topic Expert
0 Likes
2,831

Hello Sand,

declare a local variable of type c with length as per your requriement.

Then use the keyword PACK .

eg - Data : l_temp length 5.

      PACK gv_xxxx TO l_temp.

BR

Rajesh

Read only

naveen_inuganti2
Active Contributor
0 Likes
2,831

Check your select query.

Field order should be same as it is in declaration

Also, check type of the field, should be same as database table (I don't see any issue here, but check it once)

Regards,

Naveen.I

Read only

Former Member
0 Likes
2,831

Hi

There is a mismatch in your internal table definition and the table structure in the underlying database.

Use the same data elements as that of the table for your internal table.

Regards

Raj

Read only

Private_Member_49934
Product and Topic Expert
Product and Topic Expert
0 Likes
2,831

How are you checking that the data in the z-table is without space? Try putting breakpoint before you are actually inserting entries in z-table. I think you will get spaces at this point too?

Sometimes what appears in se16(n) may not be correct due to various conversion rouintes and ingnoring of space. What you get in select query.is what data is actually is in the database.

Read only

Former Member
0 Likes
2,831

Hi Sandeep,

There is a FM 'CONVERSION_EXIT_ALPHA_OUTPUT' which can be used to remove the leading zeros.

Regards,

Shardul P Jitkar

Read only

Former Member
0 Likes
2,831

Hi,

You can use the following:

SHIFT <field> LEFT DELETING LEADING space.

Hope it serves useful.

Read only

Former Member
0 Likes
2,831

Hi Sandy

What i understood is; you are getting like this "_this is a sentense_". where "_" is space

CONDENSE statement is used to delete unwanted leading spaces in string.

Use CONDENSE statement, when you store data in the table.

Try this sandy this should work. ...  Thx Sridhar

Read only

Former Member
0 Likes
2,831

Hi Sandy,

You must have declared your database field as integer-type. When you transfer it back to your internal table into a character field, it will have leading zeroes in it.

Regards,

Karl

Read only

Former Member
0 Likes
2,831

Hi All,

Thanks for all the Post, I tried checking with internal table and way the select query is written.

But condense or conversion exit alpa fm will work for single entry that is for work area.

But how to condense value in an internal table which the newly inserted value.

Read only

Former Member
0 Likes
2,832

Hi All,

Thanks for all the Post, I tried checking with internal table and way the select query is written.

But condense or conversion exit alpa fm will work for single entry that is for work area.

But how to condense value in an internal table which the newly inserted value.

Read only

0 Likes
2,831

Hi Sandy,

You have to convert it manually after fetching it from the database.

Regards,

Karl

Read only

0 Likes
2,831

Hi,

Loop at that internal table into workarea like below:

Loop at itab into w_tab.

SHIFT w_tab-field LEFT DELETING LEADING space.

modify itab from w_tab index sy-tabix.

clear: w_tab.

Endloop.

I hope it solves your problem now.

Read only

Former Member
0 Likes
2,831

Thanks Akankshi Prasad it worked for me.

Thank you all for all the post.

Read only

0 Likes
2,831

can we solve this problem by using the conversion_exit_alpha_output function module. if so how can we....

Read only

0 Likes
2,831

Hi,

Kindly make this post as answered