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: 

Sorting on material is not working in ALV

sachin_jadhav8
Participant
0 Kudos

Hi All,

I have created ALV report in the output if i select material coulmn and do sorting then its giving wrong result as materials are without leading zeros and if i add leading zeros then sorting functionality working fine.

Please anyone tell why without leading zeros sorting is not working on material numbers.

Regards,

Sachin

9 REPLIES 9

naveen_inuganti2
Active Contributor
0 Kudos

What I can analyse by this is, you are using MATNR as datatype, which is CHAR type. If number of leading zeros varies then you can certainly expect this kind of results.

You might want to pass data to NUMC and try with that!

Thanks,

Naveen Inuganti

Venkat_Sesha
Advisor
Advisor
0 Kudos

Hi Sachin,

Use the following addition in the field catalog. Then it will work as you want.

X_FCAT-CONVEXIT = 'MATN1'.

Hope This Helps.

Thanks

0 Kudos

Hello Venkat,

I have define fieldcat type as slis_fieldcat_alv and convexit is not available in slis_fieldcat_alv.

Regards,

Sachin

0 Kudos

Hi Sachin,

1. If you have used FM REUSE_FIELDCATALOG_MERGE

2. Material number should be declared as CHAR field or actual datatype

Let me know if both are ok

Vivek

0 Kudos

Hi Vivek,

I have not used REUSE_FIELDCATALOG_MERGE instead i have defined fieldcat manually.

Material number field defined as dictionary type MATNR.

If I remove conversion exit then i use to get leading zeros with material number and sorting functionality works for me but without leading zeros it is giving wrong result.

Regards,

Sachin

0 Kudos

Sachin,

I would suggest to use REUSE_FIELDCATALOG_MERGE. We had same problem and was solved using this FM.

Still if that is not wished for, try this:

For Material number field, set EDIT_MASK

wa_fieldcat-edit_mask = "=ALPHA"

Regards,

Vivek

0 Kudos

Sachin ,

Check this:

= '==ALPHA'

If you set a conversion exit (for example, conv = ' ==ALPHA ' for function module CONVERSION_EXIT_ALPHA_OUTPUT ), you enforce output conversion for the associated output field. (See also F1 help for WRITE edit option USING EDIT MASK) .

http://help.sap.com/saphelp_erp2004/helpdata/en/ff/4649baf17411d2b486006094192fe3/content.htm

Regards,

Vivek

0 Kudos

Looks like Lexicographic is activated in your system (TCode: OMSL). I'm thinking you need to create a z structure with a field like MATNR with conversion exit active (maybe a z conversion exit copied from original one) and use that as your definition for fields in your internal table.

0 Kudos

Hi All,

Solved by myself.

Passing reference table and reference field name in the fieldcatlog.

Thanks all your help.

Regards,

Sachin