06-30-2022 11:34 AM
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...
06-30-2022 11:34 AM
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
06-30-2022 11:45 AM
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.
06-30-2022 12:57 PM
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 }|.
06-30-2022 11:49 AM
Did you try searching first??!! This has literally been asked hundreds of times over the life of this site.
08-23-2022 8:34 AM
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.