08-17-2021 5:39 PM
Can we introduce alpha conversions in Value # (Loop) in new 7.4
LOOP AT LT_MARA ASSIGNING FIELD-SYMBOL(<wa_mara>).
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = <wa_mara>-matnr
IMPORTING
output = <wa_mara>-matnr
ENDLOOP.
08-18-2021 3:13 AM
Hi Sunitha,
You can use below syntax:
converted_table = VALUE #( FOR unconverted
IN unconverted_table
( column_a = |{ unconverted-column_a ALPHA = OUT }| )
).
Thanks & Stay Safe
~Kaushalya
08-17-2021 5:39 PM
Welcome to the SAP Community! Take these tutorials to learn more about getting started:
Ask and Answer Questions on SAP Community | Tutorials for SAP Developers
Update and Maintain Your SAP Profile at people.sap.com | Tutorials for SAP Developers
Tour the SAP Community | Tutorials for SAP Developers
Thank you!
08-17-2021 8:27 PM
If you search, you will get the answer:
ABAP 7.4 loop alpha conversion site:sap.com
(blog post quick reference chapter "ALPHA conversion")
08-18-2021 3:13 AM
Hi Sunitha,
You can use below syntax:
converted_table = VALUE #( FOR unconverted
IN unconverted_table
( column_a = |{ unconverted-column_a ALPHA = OUT }| )
).
Thanks & Stay Safe
~Kaushalya
08-18-2021 6:49 AM
Teach a man to fish as sandra.rossi did, and they'll eat for life. You've just given the post a fish. Well done. He/she eats for a day. Then comes back for more.
frdric.girod points out, ALPHA is a bad choice for matnr as the length can be determined by a configuration setting.
08-18-2021 6:41 AM
bad idea to use ALPHA conversion with MATNR field, there is a table to specify the size of the MATNR field
08-18-2021 7:04 AM
frdric.girod You're right. It's worth an answer, and that was a bad answer from me. And I don't propose to search the Web with "matnr delete leading zeroes site:sap.com" because many answers are talking about ALPHA 😞
So, the only valid answer (as far as I know) is to use WRITE matnr TO text with matnr variable being based on DDIC domain MATNR (which is generally the case), which calls the conversion routine from the domain.
And then, to answer the OP question, WRITE could be wrapped into a method and used in a FOR table iteration.
08-18-2021 10:33 AM