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

ABAP 7.4 loop alpha conversion

51,868

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
Read only

kaushalya
Active Participant
30,063

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
Read only

Sandra_Rossi
Active Contributor
30,063

If you search, you will get the answer:

ABAP 7.4 loop alpha conversion site:sap.com

(blog post quick reference chapter "ALPHA conversion")

Read only

kaushalya
Active Participant
30,064

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

Read only

matt
Active Contributor
30,063

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.

Read only

FredericGirod
Active Contributor
30,063

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

Read only

Sandra_Rossi
Active Contributor
30,063

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.

Read only

0 Kudos
30,063

Thanks, noted, will not use the alpha for conversions