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

ALV output error

former_member209770
Participant
0 Likes
1,548

Hi Gurus,

Does FIELDNAME not allowed lower case? Please refer to the below code.

'Cause I meet the weird situation, totalofsoqtys will show the value of MATNR, and the left 4 fields also be the same with the value of TOTALOFMOQTYS.

Could anyone share with me the cause?  Thanks. 

***************************************************************************************

FORM FIELDS .

  DATA: V_COL TYPE I.

  REFRESH I_FIELDCAT_ALV.

  V_COL = 0.

  PERFORM SET_FIELDS USING 'MATNR'                       'Material'.

  PERFORM SET_FIELDS USING 'totalofsoqtys'                'SO qty'.

  PERFORM SET_FIELDS USING 'TOTALOFMOQTYS'   'MO qty'.

  PERFORM SET_FIELDS USING 'totalOfPoQtys'             'PO qty'.

  PERFORM SET_FIELDS USING 'totalOfInventory'          'Stock'.

  PERFORM SET_FIELDS USING 'totalOfMMDoc'             '261 qty'.

  ENDFORM.                    " FIELDS

FORM SET_FIELDS USING P_IN_FNAME P_IN_SELTEXT.

  CLEAR I_FIELDCAT.

  ADD 1 TO V_COL .

   I_FIELDCAT-COL_POS   = V_COL .

   I_FIELDCAT-FIELDNAME = P_IN_FNAME    .

   I_FIELDCAT-SELTEXT_L = P_IN_SELTEXT  .

        i_fieldcat-LOWERCASE ='X'.

  APPEND I_FIELDCAT TO  I_FIELDCAT_ALV .

  CLEAR I_FIELDCAT.

ENDFORM .                    "SET_FIELDS

Jamie

9 REPLIES 9
Read only

Arun_Prabhu_K
Active Contributor
0 Likes
1,506

Hello.

     Only caps are allowed.

     To find out any inconsistency in ALV, just press SHIFT button and double click the right mouse button in the blank area.

Regards.

Read only

0 Likes
1,506

Hi K.Arun,

Yes, I know it only allowed uppercase, I just wanna sure about that I can't assign lowercase into fieldname.   Thanks

Read only

Former Member
0 Likes
1,506

Pass the ref_tabname and ref_fieldname also to the field catalog

I_FIELD_CAT-REF_TABNAME = 'MSEG'.
I_FIELD_CAT-REF_FIELDNAME = 'MENGE'.

I_FIELD_CAT-LOWERCASE = 'X'.

I_FIELD_CAT-QFIELDNAME = 'MEINS'.

Read only

roberto_vacca2
Active Contributor
0 Likes
1,506

Hi.

Probably you'll have to check out DOMAIN type.

From SE11 check out your Field Domain.

Here you can see a flag LOWERCASE in the section Output Characteristics (definition). You should activate this.

Hope to help.

BYe

Rob

Read only

0 Likes
1,506

Hi Rob,

After I tick the flag LOWERCASE and activate it, it doesn't work, also get the value from the preceding field...

Any help? Thanks.

Read only

alessandroieva
Active Participant
0 Likes
1,506

Hi,

the only field not valorized that i see is TABLENAME.

are you sure that in your internal table there are the correct values?

could i see your internal table (alv table) before that you call the output?

let me know,

AI

Read only

0 Likes
1,506

Hi AI,

Yes, it got the correct data that I see on the debug screen .

Read only

0 Likes
1,506

Hi,

You can define filed type for that field as CHAR18 and convert to lower case.

Or

You can define new domain with same characteristics as MATNR and check box for lowercase.

Create new data element with new domain. Use new data element as type for the field which you want to display.

Santosh

Read only

roberto_vacca2
Active Contributor
0 Likes
1,506

Ok. Well there's something not clear in your code. You declare the V_COL variable as local in FORM FIELDS and you use it like a global variable in FORM SET_FIELDS. That shouldn't be declared in such way.

By the way I suggest you this code for your output so you'll not have to configure manual fieldcatalog:


DATA: lr_func TYPE REF TO CL_SALV_FUNCTIONS_LIST.

DATA : lt_columns TYPE REF TO cl_salv_columns_table,

        lr_column TYPE REF TO cl_salv_column_table.

DATA:  gd_alv_table   TYPE REF TO cl_salv_table.

* Create ALV grid instance

   TRY.

       CALL METHOD cl_salv_table=>factory

*    EXPORTING

*      LIST_DISPLAY   = IF_SALV_C_BOOL_SAP=>FALSE

*      R_CONTAINER    =

*      CONTAINER_NAME =

         IMPORTING

           r_salv_table   = gd_alv_table

         CHANGING

           t_table        = gt_yourtable "YOUR global internal table

"Functions

       lr_func = gd_alv_table->get_functions( ).

       lr_func->set_all( ).

*- Get all the Columns

       lt_columns = gd_alv_table->get_columns( ).

*- Set Column optimization

       lt_columns->set_optimize( C_X ).

       lr_column ?= lt_columns->get_column( 'MATNR' ).

       lr_column->set_lowercase( value  = if_salv_c_bool_sap=>true ).

       gd_alv_table->display( ).

     CATCH cx_salv_msg .

     CATCH cx_salv_not_found.

   ENDTRY.

Let me know if this can help you.

Bye