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

****Query regarding ALV*********

Former Member
0 Likes
868

Hi all,

I have defined a structure in the code using TYPES.

I want to build a field catalog for the structure.

To build the field catalog I use the Function Module LVC_FIELDCATALOG_MERGE and I am exporting the structure to the field i_structure_name .

But i find that the field catalog is not getting created.

If I pass a standard structure then the field catalog is geting created.

please tell me how to build the field catalog for a structure defined in the code.

Regards,

Vijay

*************ENTRIES WILL SURELY BE REWARDED******

Hi all,

I have defined a structure in the code using TYPES.

I want to build a field catalog for the structure.

To build the field catalog I use the Function Module LVC_FIELDCATALOG_MERGE and I am exporting the structure to the field i_structure_name .

But i find that the field catalog is not getting created.

If I pass a standard structure then the field catalog is geting created.

please tell me how to build the field catalog for a structure defined in the code.

Regards,

Vijay

*************ENTRIES WILL SURELY BE REWARDED******

7 REPLIES 7
Read only

Former Member
0 Likes
827

Hi bala,

try to create the structure in SE11.

It will work

Read only

Former Member
0 Likes
827

Hi,

Please avoid to create duplicate records..Please close one of them..

Thanks,

Naren

Read only

Former Member
0 Likes
827

Hi,

You need not create any structure in the data dictionary.

Call as following:

ws_repid is the sy-repid, WS_OPEN_SUM is an internal table.

CALL FUNCTION 'K_KKB_FIELDCAT_MERGE'

EXPORTING

i_callback_program = ws_repid

i_tabname = 'WS_OPEN_SUM'

i_inclname = ws_repid

CHANGING

ct_fieldcat = i_cat

EXCEPTIONS

inconsistent_interface = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE e000 WITH text-003.

ENDIF.

*Function module to get the field catalog in the lvc_t_fieldcat format

CALL FUNCTION 'LVC_TRANSFER_FROM_KKBLO'

EXPORTING

it_fieldcat_kkblo = i_cat

IMPORTING

et_fieldcat_lvc = i_fieldcatalog

EXCEPTIONS

it_data_missing = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE e000 WITH text-003.

ENDIF.

Read only

Former Member
0 Likes
827

Hello Bala,

You have define fields as<b> Like mara-matnr.</b>

If it is type <b>mara-matnr</b>then the fieldcat will not be created.

Check this.

If useful reward.

vasanth

Read only

amit_khare
Active Contributor
0 Likes
827

Hi,

this ids the FM you are using,

IMPORTING

VALUE(I_BUFFER_ACTIVE) OPTIONAL

VALUE(I_STRUCTURE_NAME) LIKE DD02L-TABNAME OPTIONAL

VALUE(I_CLIENT_NEVER_DISPLAY) TYPE SLIS_CHAR_1 DEFAULT 'X'

VALUE(I_BYPASSING_BUFFER) TYPE CHAR01 OPTIONAL

VALUE(I_INTERNAL_TABNAME) LIKE DD02L-TABNAME OPTIONAL

CHANGING

VALUE(CT_FIELDCAT) TYPE LVC_T_FCAT

here instead of using i_structure name use iinternal_tabname.

Regards,

Amit

reward all helpful replies.

Read only

Former Member
0 Likes
827

Hi ,

I am not sure whether you can use the FM for types defined in the program , they need to be defined in the dictionary.

Regrad

Arun

Read only

0 Likes
827

If you want to have th MERGE function module gernerate the field cat based on an internal table, you must do it like this. You must use a DATA statement to define the structure and use LIKE to define the field types, also use LIKE to define the internal table.



report zrich_0002 .


type-pools: slis.

data: begin of xma,
       matnr like makt-matnr,
       maktx like makt-maktx,
       end of xma.

data: ima like standard table of xma with header line.
data: fieldcat type slis_t_fieldcat_alv.
data: repid type syrepid.

repid = sy-repid.

select matnr maktx
                 into table ima
                       from makt
                             up to 100 rows
                                where spras = sy-langu.

call function 'REUSE_ALV_FIELDCATALOG_MERGE'
     exporting
          i_program_name     = repid
          i_internal_tabname = 'XMA'
          i_inclname         = repid
          i_bypassing_buffer = 'X'
     changing
          ct_fieldcat        = fieldcat.


call function 'REUSE_ALV_GRID_DISPLAY'
     exporting
          it_fieldcat = fieldcat
     tables
          t_outtab    = ima.

Regards,

Rich Heilman