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: 

Namespace problem in ALV Field catalog - Data is not displaying for this columns.

Former Member
0 Kudos

Hi All,

We have a reserved name space with our company name. I have created a table with field names starting with the company namespace for example, /TLI/DATE. When using this field name in Field catalog i used field name as /TLI/DATE as shown below.


  wa_fieldcat-fieldname   = '/TLI/DATE'.

   wa_fieldcat-seltext_m   = 'Date'.

   wa_fieldcat-col_pos     5.

   APPEND wa_fieldcat TO it_fieldcat.

   CLEAR wa_fieldcat.

In the result ALV Grid display, the date column is empty. i.e Field names which has namespace is not showing any data in the columns but other fields working normal. Pease see the attached screenshot, where the fields with namespace is not showing any data.

Please let me know what changes do i need to make.

Thanks in advance,

Kind regards,

NarsiReddy.

1 ACCEPTED SOLUTION

ipravir
Active Contributor
0 Kudos

Hi,

Use "REUSE_ALV_FIELDCATALOG_MERGE" Fm to generate the Field Catalog for the ALV.

and use the same for REUSE_ALV_GRID_DISPLAY FM.

Regards,

Praveer.

14 REPLIES 14

Former Member
0 Kudos

Hi,

Also pass the below and check.

wa_fieldcat-tabname   = 'ITAB'.  "Internal Table which stores the data.

wa_fieldcat-fieldname   = '/TLI/DATE'

wa_fieldcat-seltext_m   = 'Date'. 

wa_fieldcat-col_pos     =  5. 

APPEND wa_fieldcat TO it_fieldcat. 

CLEAR wa_fieldcat.

Hope this helps.


0 Kudos

Hi Gaurav,

I tried with what you suggested, but it remains same.

Regards,

NarsiReddy

ipravir
Active Contributor
0 Kudos

Hi,

Use "REUSE_ALV_FIELDCATALOG_MERGE" Fm to generate the Field Catalog for the ALV.

and use the same for REUSE_ALV_GRID_DISPLAY FM.

Regards,

Praveer.

Former Member
0 Kudos

Hi Praveer,

I have used the REUSE_ALV_FIELDCATALOG_MERGE to generate the field catalog and used REUSE_ALV_GRID_DISPLAY for displaying.

But the problem remains same.

Regards,

NarsiReddy

Former Member
0 Kudos

Hi,

I that case check you code where you are passing the values and check where it is getting cleared.

Hope this helps.

Former Member
0 Kudos

Have you checked the name of the field in the output internal table ?  How you have declared your output internal table?

Former Member
0 Kudos

Hi Gaurav,

Here is my code, I tried but was not able to fix the problem.


TYPES: BEGIN OF ty_ivcus,

          kunnr TYPE kunnr,

          resco TYPE /tli/viv_resco,

          stceg TYPE stceg,

          bname TYPE xubname,

          date  TYPE sydats,

          time  TYPE sytime,

          rsn  TYPE  /tli/viv_rsn,

        END OF ty_ivcus.

DATA : it_ivcus TYPE TABLE OF ty_ivcus,

        wa_ivcus TYPE ty_ivcus.

DATA it_ivcuscp  TYPE  STANDARD TABLE OF ty_ivcus, "temparary table for MARA

        it_changes TYPE  STANDARD TABLE OF ty_ivcus. "changes on grid

DATA wa_fieldcat      TYPE  slis_fieldcat_alv, "Field catalog work area

        it_fieldcat      TYPE  slis_t_fieldcat_alv, "field catalog internal table

        it_layout        TYPE slis_layout_alv, "ALV layout settings

        form_top_of_page TYPE slis_formname VALUE 'FORM_TOP_OF_PAGE', "for avl header.

        form_callback    TYPE slis_formname VALUE 'USER_COMMAND'. "For user command

SELECT-OPTIONS: s_ivcus FOR wa_ivcus-kunnr"''''''''''''''''''''''''''''''''''''''''''''''''''''''''

START-OF-SELECTION.

  SELECT * FROM /tli/viv_ivcus INTO CORRESPONDING FIELDS OF TABLE it_ivcus WHERE kunnr IN s_ivcus.

  PERFORM build_fcat.

  PERFORM display_alv.

FORM build_fcat .

  wa_fieldcat-tabname  = 'IT_IVCUS'.

  wa_fieldcat-fieldname  = 'KUNNR'.

  wa_fieldcat-seltext_m  = 'Customer Number'.

  wa_fieldcat-col_pos    1.

  wa_fieldcat-key        = 'X'.

  wa_fieldcat-hotspot        = 'X'.

  APPEND wa_fieldcat TO it_fieldcat.

  CLEAR wa_fieldcat.

  wa_fieldcat-tabname  = 'IT_IVCUS'.

  wa_fieldcat-fieldname  = '/TLI/VIV_RESCO'.

  wa_fieldcat-seltext_m  = 'Result Code'.

*  wa_fieldcat-edit        = 'X'.

  wa_fieldcat-col_pos    2.

  APPEND wa_fieldcat TO it_fieldcat.

  CLEAR wa_fieldcat.

  wa_fieldcat-tabname  = 'IT_IVCUS'.

  wa_fieldcat-fieldname  = 'STCEG'.

  wa_fieldcat-seltext_m  = 'VAT Reg. No.'.

*  wa_fieldcat-edit        = 'X'.

  wa_fieldcat-col_pos    3.

  APPEND wa_fieldcat TO it_fieldcat.

  CLEAR wa_fieldcat.

  wa_fieldcat-tabname  = 'IT_IVCUS'.

  wa_fieldcat-fieldname  = 'BNAME'.

  wa_fieldcat-seltext_m  = 'USER'.

  wa_fieldcat-edit        = 'X'.

  wa_fieldcat-col_pos    4.

  APPEND wa_fieldcat TO it_fieldcat.

  CLEAR wa_fieldcat.

  wa_fieldcat-tabname  = 'IT_IVCUS'..

  wa_fieldcat-fieldname  = '/TLI/DATE'.

  wa_fieldcat-seltext_m  = 'Date'.

*  wa_fieldcat-icon        = 'X'.  " Display the field as ICON

  wa_fieldcat-col_pos    5.

  APPEND wa_fieldcat TO it_fieldcat.

  CLEAR wa_fieldcat.

  wa_fieldcat-tabname  = 'IT_IVCUS'.

  wa_fieldcat-fieldname  = 'TIME'.

  wa_fieldcat-seltext_m  = 'TIME'.

*  wa_fieldcat-icon        = 'X'.  " Display the field as ICON

  wa_fieldcat-col_pos    6.

  APPEND wa_fieldcat TO it_fieldcat.

  CLEAR wa_fieldcat.

  wa_fieldcat-tabname  = 'IT_IVCUS'.

  wa_fieldcat-fieldname  = '/TLI/VIV_RSN'.

  wa_fieldcat-seltext_m  = 'Reason'.

  wa_fieldcat-edit        = 'X'.

  wa_fieldcat-col_pos    7.

  APPEND wa_fieldcat TO it_fieldcat.

  CLEAR wa_fieldcat.

ENDFORM.                    " BUILD_FCAT

FORM display_alv .

  it_ivcuscp[] = it_ivcus[].

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

      i_callback_program      = sy-repid "program name

      i_callback_user_command = form_callback "user command subroutine name

      i_callback_top_of_page  = form_top_of_page "sub routine for top of page

      is_layout              = it_layout

      it_fieldcat            = it_fieldcat

    TABLES

      t_outtab                = it_ivcus

    EXCEPTIONS

      program_error          = 1

      OTHERS                  = 2.

  IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ENDIF.

ENDFORM.                    " DISPLAY_ALV

FORM form_top_of_page.

  DATA: it_header    TYPE slis_t_listheader,

        wa_header    TYPE slis_listheader,

        lv_line      LIKE wa_header-info,

        ld_lines      TYPE i,

        ld_linesc(10) TYPE c.

* Title

  wa_header-typ  = 'H'.

  wa_header-info = 'Reasons for invalidity of VAT Registration numbers'.

  APPEND wa_header TO it_header.

  CLEAR wa_header.

* Date

  wa_header-typ  = 'S'.

  wa_header-key = 'Date: '.

  CONCATENATE  sy-datum+6(2) '.'

                sy-datum+4(2) '.'

                sy-datum(4) INTO wa_header-info"todays date

  APPEND wa_header TO it_header.

  CLEAR: wa_header.

* Date

  wa_header-typ  = 'S'.

  wa_header-key = 'User: '.

  CONCATENATE  sy-uname ' ' INTO wa_header-info"Logged in user

  APPEND wa_header TO it_header.

  CLEAR: wa_header.

* Total No. of Records Selected

  DESCRIBE TABLE  it_ivcus LINES ld_lines.

  ld_linesc = ld_lines.

  CONCATENATE 'Total No. of Records Selected: ' ld_linesc

                    INTO lv_line SEPARATED BY space.

  wa_header-typ  = 'A'.

  wa_header-info = lv_line.

  APPEND wa_header TO it_header.

  CLEAR: wa_header, lv_line.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

      it_list_commentary = it_header.

  .

  CLEAR it_header.

ENDFORM.                    "TOP-OF-PAGE

Former Member
0 Kudos

Hi Rudra,

I changed the names same as in the output internal table, but it is not working. Please see my code below:


TYPES: BEGIN OF ty_ivcus,

          kunnr TYPE kunnr,

          resco TYPE /tli/viv_resco,

          stceg TYPE stceg,

          bname TYPE xubname,

          date  TYPE sydats,

          time  TYPE sytime,

          rsn   TYPE  /tli/viv_rsn,

        END OF ty_ivcus.

DATA : it_ivcus TYPE TABLE OF ty_ivcus,

        wa_ivcus TYPE ty_ivcus.

DATA it_ivcuscp  TYPE  STANDARD TABLE OF ty_ivcus, "temparary table for MARA

         it_changes TYPE  STANDARD TABLE OF ty_ivcus. "changes on grid

DATA wa_fieldcat      TYPE  slis_fieldcat_alv, "Field catalog work area

         it_fieldcat      TYPE  slis_t_fieldcat_alv, "field catalog internal table

         it_layout        TYPE slis_layout_alv, "ALV layout settings

         form_top_of_page TYPE slis_formname VALUE 'FORM_TOP_OF_PAGE', "for avl header.

         form_callback    TYPE slis_formname VALUE 'USER_COMMAND'. "For user command

SELECT-OPTIONS: s_ivcus FOR wa_ivcus-kunnr.   "''''''''''''''''''''''''''''''''''''''''''''''''''''''''

START-OF-SELECTION.

   SELECT * FROM /tli/viv_ivcus INTO CORRESPONDING FIELDS OF TABLE it_ivcus WHERE kunnr IN s_ivcus.

   PERFORM build_fcat.

   PERFORM display_alv.

FORM build_fcat .

   wa_fieldcat-tabname   = 'IT_IVCUS'.

   wa_fieldcat-fieldname   = 'KUNNR'.

   wa_fieldcat-seltext_m   = 'Customer Number'.

   wa_fieldcat-col_pos     1.

   wa_fieldcat-key         = 'X'.

   wa_fieldcat-hotspot         = 'X'.

   APPEND wa_fieldcat TO it_fieldcat.

   CLEAR wa_fieldcat.

   wa_fieldcat-tabname   = 'IT_IVCUS'.

   wa_fieldcat-fieldname   = 'RESCO'.

   wa_fieldcat-seltext_m   = 'Result Code'.

*  wa_fieldcat-edit        = 'X'.

   wa_fieldcat-col_pos     2.

   APPEND wa_fieldcat TO it_fieldcat.

   CLEAR wa_fieldcat.

   wa_fieldcat-tabname   = 'IT_IVCUS'.

   wa_fieldcat-fieldname   = 'STCEG'.

   wa_fieldcat-seltext_m   = 'VAT Reg. No.'.

*  wa_fieldcat-edit        = 'X'.

   wa_fieldcat-col_pos     3.

   APPEND wa_fieldcat TO it_fieldcat.

   CLEAR wa_fieldcat.

   wa_fieldcat-tabname   = 'IT_IVCUS'.

   wa_fieldcat-fieldname   = 'BNAME'.

   wa_fieldcat-seltext_m   = 'USER'.

   wa_fieldcat-edit        = 'X'.

   wa_fieldcat-col_pos     4.

   APPEND wa_fieldcat TO it_fieldcat.

   CLEAR wa_fieldcat.

   wa_fieldcat-tabname   = 'IT_IVCUS'..

   wa_fieldcat-fieldname   = 'DATE'.

   wa_fieldcat-seltext_m   = 'Date'.

*  wa_fieldcat-icon         = 'X'.  " Display the field as ICON

   wa_fieldcat-col_pos     5.

   APPEND wa_fieldcat TO it_fieldcat.

   CLEAR wa_fieldcat.

   wa_fieldcat-tabname   = 'IT_IVCUS'.

   wa_fieldcat-fieldname   = 'TIME'.

   wa_fieldcat-seltext_m   = 'TIME'.

*  wa_fieldcat-icon         = 'X'.  " Display the field as ICON

   wa_fieldcat-col_pos     6.

   APPEND wa_fieldcat TO it_fieldcat.

   CLEAR wa_fieldcat.

   wa_fieldcat-tabname   = 'IT_IVCUS'.

   wa_fieldcat-fieldname   = 'RSN'.

   wa_fieldcat-seltext_m   = 'Reason'.

   wa_fieldcat-edit        = 'X'.

   wa_fieldcat-col_pos     7.

   APPEND wa_fieldcat TO it_fieldcat.

   CLEAR wa_fieldcat.

ENDFORM.                    " BUILD_FCAT

FORM display_alv .

   it_ivcuscp[] = it_ivcus[].

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

     EXPORTING

       i_callback_program      = sy-repid "program name

       i_callback_user_command = form_callback "user command subroutine name

       i_callback_top_of_page  = form_top_of_page "sub routine for top of page

       is_layout               = it_layout

       it_fieldcat             = it_fieldcat

     TABLES

       t_outtab                = it_ivcus

     EXCEPTIONS

       program_error           = 1

       OTHERS                  = 2.

   IF sy-subrc <> 0.

     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

   ENDIF.

ENDFORM

regards,

NarsiReddy.

0 Kudos

Hi,

It should be like this.

Also declaring internal table

  • TYPES: BEGIN OF ty_ivcus,  
  •           kunnr TYPE kunnr, 
  •           resco TYPE /tli/viv_resco, 
  •           stceg TYPE stceg, 
  •           bname TYPE xubname, 
  •           '/TLI/DATE'  TYPE sydats,  
  •           time  TYPE sytime, 
  •           rsn  TYPE  /tli/viv_rsn, 
  •         END OF ty_ivcus. 
  • DATA : it_ivcus TYPE TABLE OF ty_ivcus, 
  •         wa_ivcus TYPE ty_ivcus.

It should be like this.

Arivazhagan S

Former Member
0 Kudos

Hi,

Looks better now.

Couple of things you should do now.

1. In the debugger check if you have entries for dates in your internal table IT_IVCUS.

2. Don't pass wa_fieldcat-tabname   = 'IT_IVCUS'.   . It is not required.

3. You should never pass SY-REPID directly as I_CALLBACK_PROGRAM Rather pass it to a variable V_REPID  first.


DATA : V_REPID type syrepid.


V_REPID = SY-REPID.



  1. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' 
  2.      EXPORTING 
  3.        i_callback_program      = v_repid "program name 
  4.        i_callback_user_command = form_callback "user command subroutine name 
  5.        i_callback_top_of_page  = form_top_of_page "sub routine for top of page 
  6.        is_layout               = it_layout 
  7.        it_fieldcat             = it_fieldcat 
  8.      TABLES 
  9.        t_outtab                = it_ivcus 
  10.      EXCEPTIONS 
  11.        program_error           = 1 
  12.        OTHERS                  = 2. 
  13.    IF sy-subrc <> 0. 
  14.      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno 
  15.              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. 
  16.    ENDIF. 

Reason :

Juwin
Active Contributor
0 Kudos

Hi,

You internal table declaration doesn't match with the fieldcatelog built. The "fieldname" in fieldcatelog, should be the internal table field name.


As a best practice, whenever you build fieldcatelog always fill in these 4 fields.


wa_fieldcat-tabname        = "Your internal table name

wa_fieldcat-fieldname      = "Your fieldname in internal table

wa_fieldcat-ref_tabname    = "Referenced database table name

wa_fieldcat-ref_fieldname  = "Referenced database table fieldname

APPEND wa_fieldcat TO it_fieldcat. 

and everything should work fine.

Thanks,

Juwin

arivazhagan_sivasamy
Active Contributor
0 Kudos

Hi,

Debug your program and check the internal table values.

Also check, how are u assigning values to the field /TLI/DATE.  

Arivazhagan S.

0 Kudos

Hi NarsiReddy,

Use the below code.

Data: l_fname type string.

   l_fname = '/TLI/DATE'.

   wa_fieldcat-tabname = 'I_TAB'.

   wa_fieldcat-fieldname = l_fname.

   wa_fieldcat-seltext_l = 'DATE'.

   APPEND wa_fieldcat TO i_fieldcat.

This should help.

Thanks and Regards-

Chirag Keswani

raymond_giuseppi
Active Contributor
0 Kudos

As you are able to display the ALV (even with errors)  your first "instinct" should be The Consistency Check, of course also check your internal table current values with debug.

Hint: there are a mimimum of data to pass to report to manually generate a field catalog (could you also post your code version with MERGE FM to generate field catalog, NB: those FM required the use of LIKE options and not TYPE) - ref: Generating the Field Catalog Manually (look for “Required Fields of the Field Catalog”)

Regards,

Raymond