Application Development 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: 

How to remove preceding zeroes

0 Kudos

I have made a report on an online exam result with NAME, ROLLNO, YEAR STUDYING and EXAM RESULT but my roll no and year studying column is giving output as '000001101' instead of only '1101'. Please help...

5 REPLIES 5

former_member27
Community Manager
Community Manager
0 Kudos

Hi ,

Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with: https://community.sap.com/resources/questions-and-answers, as it provides tips for preparing questions that draw responses from our members.

For example, you can:

- outline what steps you took to find answers (and why they weren't helpful)

- share screenshots of what you've seen/done

- make sure you've applied the appropriate tags

- use a more descriptive subject line

The more details you provide, the more likely it is that members will be able to respond. Feel free to also take our Q&A tutorial at: https://developers.sap.com/tutorials/community-qa.html

Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your profile you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html

Regards,

Dedi

Regards,
Dedi Metser

anujawani2426
Active Participant

Hi Syed,

You can use CONVERSION_EXIT_ALPHA_OUTPUT function module to remove preceding zero.

You can pass roll no to function module.

Please find sample code.

PARAMETERS:sale type ebelp.
START-OF-SELECTION.
Write:/ sale.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = sale
IMPORTING
OUTPUT = sale
.
WRITE:/ sale.

0 Kudos

Or by defining a DDIC domain for ROLLNO, with ALPHA conversion routine, then WRITE automatically applies the conversion routine.

Or instead of all WRITE and CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT', more simple:

WRITE / : sale, |{ sale ALPHA = OUT }|.

ChrisSolomon
Active Contributor

Did you try searching first??!! This has literally been asked hundreds of times over the life of this site.

SowmyaSurekha
Explorer
0 Kudos

Hi uzair_123,

To Remove the preceding zeroes,

SHIFT Concept can be used,

Here is the piece of code that helps in your ABAP Program :

DATA: var_name(10) TYPE C VALUE '01'. " var_name - Variable " C - Data Type(char)
      WRITE: var_name.

SHIFT var_name LEFT DELETING LEADING '0'.
      WRITE: var_name.

Thanks,

Sowmya Surekha,

YASH Technologies,

SAP Jr. Consultant.