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 field catalog include structure

Former Member
0 Likes
3,632

Hi I have declared the tables like this :

TYPES: BEGIN OF tt_vbak,

cbox TYPE c.

INCLUDE STRUCTURE vbak.

TYPES: END OF tt_vbak.

DATA: lt_vbak TYPE STANDARD TABLE OF tt_vbak,

wa_vbak TYPE tt_vbak.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
     EXPORTING
       i_program_name               = sy-repid
*       i_internal_tabname           = 'LT_VBAK'
       i_structure_name             = 'LT_VBAK'
*       I_CLIENT_NEVER_DISPLAY       = 'X'
*       I_INCLNAME                   =
*       I_BYPASSING_BUFFER           =
*       I_BUFFER_ACTIVE              =
    CHANGING
      ct_fieldcat                  = g_fieldcat_tab[]
     EXCEPTIONS
       inconsistent_interface       = 1
       program_error                = 2
       OTHERS                       = 3.

I am not getting the field catalog...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,558

Hi

That fm doesn't work if the internal table is defined using TYPE, but u need to use LIKE:

DATA: BEGIN lt_vbak OCCURS 0.
            CBOX(1) TYPE C.
DATA:  INCLUDE STRUCTURE VBAK,
          END OF IT_VBAK.

DATA: GT_REPORT TYPE SY-REPID.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
     EXPORTING
       i_program_name              = GT_REPORT
       i_internal_tabname          = 'LT_VBAK'
       i_include_name               = GT_REPORT
    CHANGING
      ct_fieldcat                  = g_fieldcat_tab[]
     EXCEPTIONS
       inconsistent_interface       = 1
       program_error                = 2
       OTHERS                       = 3

If you want to use the TYPES defination, u can do in this way:

TYPES: BEGIN OF tt_vbak,
                cbox TYPE c.
                INCLUDE STRUCTURE vbak.
TYPES: END OF tt_vbak.

DATA: lt_vbak TYPE STANDARD TABLE OF tt_vbak,
wa_vbak TYPE tt_vbak.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
     EXPORTING
       i_program_name              = sy-repid
       i_internal_tabname          = 'LT_VBAK'
       i_structure_name             = 'VBAK'
    CHANGING
      ct_fieldcat                  = g_fieldcat_tab[]
     EXCEPTIONS
       inconsistent_interface       = 1
       program_error                = 2
       OTHERS                       = 3.

Max

Hi I have declared the tables like this :

TYPES: BEGIN OF tt_vbak,

cbox TYPE c.

INCLUDE STRUCTURE vbak.

TYPES: END OF tt_vbak.

DATA: lt_vbak TYPE STANDARD TABLE OF tt_vbak,

wa_vbak TYPE tt_vbak.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
     EXPORTING
       i_program_name               = sy-repid
*       i_internal_tabname           = 'LT_VBAK'
       i_structure_name             = 'LT_VBAK'
*       I_CLIENT_NEVER_DISPLAY       = 'X'
*       I_INCLNAME                   =
*       I_BYPASSING_BUFFER           =
*       I_BUFFER_ACTIVE              =
    CHANGING
      ct_fieldcat                  = g_fieldcat_tab[]
     EXCEPTIONS
       inconsistent_interface       = 1
       program_error                = 2
       OTHERS                       = 3.

I am not getting the field catalog...

5 REPLIES 5
Read only

Former Member
0 Likes
1,559

Hi

That fm doesn't work if the internal table is defined using TYPE, but u need to use LIKE:

DATA: BEGIN lt_vbak OCCURS 0.
            CBOX(1) TYPE C.
DATA:  INCLUDE STRUCTURE VBAK,
          END OF IT_VBAK.

DATA: GT_REPORT TYPE SY-REPID.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
     EXPORTING
       i_program_name              = GT_REPORT
       i_internal_tabname          = 'LT_VBAK'
       i_include_name               = GT_REPORT
    CHANGING
      ct_fieldcat                  = g_fieldcat_tab[]
     EXCEPTIONS
       inconsistent_interface       = 1
       program_error                = 2
       OTHERS                       = 3

If you want to use the TYPES defination, u can do in this way:

TYPES: BEGIN OF tt_vbak,
                cbox TYPE c.
                INCLUDE STRUCTURE vbak.
TYPES: END OF tt_vbak.

DATA: lt_vbak TYPE STANDARD TABLE OF tt_vbak,
wa_vbak TYPE tt_vbak.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
     EXPORTING
       i_program_name              = sy-repid
       i_internal_tabname          = 'LT_VBAK'
       i_structure_name             = 'VBAK'
    CHANGING
      ct_fieldcat                  = g_fieldcat_tab[]
     EXCEPTIONS
       inconsistent_interface       = 1
       program_error                = 2
       OTHERS                       = 3.

Max

Read only

0 Likes
1,558

ohh ok...

but as sadi.. its not giving me the field catalog of my custom field...i.e. cbox

I know we can manually create and append it.. but I was assuming it would do automagically...

Another Q plz...

CASE  r_ucomm.
    WHEN '&IC1'.  "double click
      READ TABLE lt_vbak INTO wa_vbak INDEX sy-tabix.
      SET PARAMETER ID 'AUN' FIELD wa_vbak-vbeln.
      CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
  ENDCASE.

I am using this code for double click... if I click on any element its taking me to va03... if I click on matnr say it should take me to mm03.. what should I do ?

Edited by: Ram kumar on Jan 30, 2009 5:05 PM

Read only

0 Likes
1,558

Hi

Yes u can, after fm ALV MERGE u can fill the field catalog table manually for CBOX, but I think it's useless, because I think CBOX is field for a checkbox for selection the line so u need to indicate it in the layout structure:

DATA: LT_LAYOUT     TYPE SLIS_LAYOUT_ALV.

LT_LAYOUT-BOX_FIELDNAME = 'CBOX'.

For doubleclick u need to check the fieldname where the cursor is:

CASE  r_ucomm.
    WHEN '&IC1'.  "double click
      READ TABLE lt_vbak INTO wa_vbak INDEX sy-tabix.
      CASE RS_SELFIELD-FIELDNAME.
         WHEN 'LT_VBAK-VBELN'.
            SET PARAMETER ID 'AUN' FIELD wa_vbak-vbeln.
            CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
        WHEN  'LT_VBAK-MATNR'.
      ENDCASE.
  ENDCASE.

Max

Read only

0 Likes
1,558

in layout we can do it...? wow that was really helpfull

small correction:

CASE  r_ucomm.
    WHEN '&IC1'.  "double click
      READ TABLE lt_vbak INTO wa_vbak INDEX sy-tabix.
      CASE RS_SELFIELD-FIELDNAME.
         WHEN 'VBELN'."<<<correction here
            SET PARAMETER ID 'AUN' FIELD wa_vbak-vbeln.
            CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
        WHEN  'MATNR'. "<<<correction here
      ENDCASE.
  ENDCASE.

Edited by: Ram kumar on Jan 30, 2009 5:26 PM

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,558

Hello,

In the FM documentation, you can find:

The program-internal table must either be in a TOP Include or its Include must be specified explicitly in the interface

I think you have declared a local internal table.

Or as suggested by Max, it considers if the keywords LIKE or INCLUDE STRUCTURE (not TYPE) are used.

BR,

Suhas

Edited by: Suhas Saha on Jan 30, 2009 9:30 PM