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: 

ABAP 7.4 loop alpha conversion

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.
1 ACCEPTED SOLUTION

kaushalya
Active Participant

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

7 REPLIES 7

Sandra_Rossi
Active Contributor

If you search, you will get the answer:

ABAP 7.4 loop alpha conversion site:sap.com

(blog post quick reference chapter "ALPHA conversion")

kaushalya
Active Participant

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

matt
Active Contributor

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.

FredericGirod
Active Contributor

bad idea to use ALPHA conversion with MATNR field, there is a table to specify the size of the MATNR field

Sandra_Rossi
Active Contributor

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.

0 Kudos

Thanks, noted, will not use the alpha for conversions