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 reports using class

Former Member
0 Likes
918

Hi

I waana develop an alv report(OOPS) using 3 different tables. I waana know since i have to output fields from 3 different tables depending upon selection criteria. So can any body tell me how to use field catalog or field catalog merge using class.... not function REUSE alv

Hi

I waana develop an alv report(OOPS) using 3 different tables. I waana know since i have to output fields from 3 different tables depending upon selection criteria. So can any body tell me how to use field catalog or field catalog merge using class.... not function REUSE alv

6 REPLIES 6
Read only

Former Member
0 Likes
883

T Code - DWDM for various examples in OOPS.

Plz reward if useful.

Thnx

Read only

Former Member
0 Likes
883

Hello Preet,

For creating the Field catalog

  • Internal table for Field Catalog

DATA: G_T_FIELDCAT_C TYPE LVC_T_FCAT,

G_R_FIELDCAT TYPE LVC_S_FCAT.

FORM BUILD_FIELD_CATALOG .

DATA: L_F_COUNT TYPE I VALUE '0'.

*/ Add properties values to ALV Catalog

ADD 1 TO L_F_COUNT.

PERFORM ADD_CATALOG USING 'MTART' 'C' SPACE L_F_COUNT "Sales Org

TEXT-005 4 SPACE SPACE SPACE.

ADD 1 TO L_F_COUNT.

PERFORM ADD_CATALOG USING 'VKORG' 'C' SPACE L_F_COUNT "Sales Org

TEXT-001 4 SPACE SPACE SPACE.

ADD 1 TO L_F_COUNT.

PERFORM ADD_CATALOG USING 'MATNR' 'C' SPACE L_F_COUNT

TEXT-002 18 'MATN1' SPACE SPACE.

ADD 1 TO L_F_COUNT.

PERFORM ADD_CATALOG USING 'STAWN' 'C' SPACE L_F_COUNT

TEXT-004 13 SPACE SPACE SPACE.

ENDFORM. " build_field_catalog

FORM ADD_CATALOG USING P_FNAME

P_INTTYPE

P_KEY

P_COL_POS

P_COL_TEXT

P_INTLEN

P_CONV

P_EDIT

P_HOTSPOT.

CLEAR G_R_FIELDCAT.

G_R_FIELDCAT-FIELDNAME = P_FNAME.

G_R_FIELDCAT-INTTYPE = P_INTTYPE.

G_R_FIELDCAT-KEY = P_KEY.

G_R_FIELDCAT-COL_POS = P_COL_POS.

G_R_FIELDCAT-COLTEXT = P_COL_TEXT.

G_R_FIELDCAT-OUTPUTLEN = P_INTLEN.

G_R_FIELDCAT-CONVEXIT = P_CONV.

G_R_FIELDCAT-EDIT = P_EDIT.

G_R_FIELDCAT-HOTSPOT = P_HOTSPOT.

APPEND G_R_FIELDCAT TO G_T_FIELDCAT_C.

ENDFORM. " add_catalog

If useful reward.

Vasanth

Read only

Former Member
0 Likes
883

Hi,

You can do in two ways.

one is


DATA: IT_FIELDCAT  TYPE  LVC_T_FCAT,
      X_FIELDCAT TYPE LVC_S_FCAT.
DATA: L_POS TYPE I.
  L_POS = L_POS + 1.


  X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
  X_FIELDCAT-FIELDNAME = 'VBELN'.
  X_FIELDCAT-TABNAME = 'IT_FINAL'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-NO_ZERO    = 'X'.
  X_FIELDCAT-OUTPUTLEN = '10'.
  X_FIELDCAT-HOTSPOT = 'X'.

  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
  L_POS = L_POS + 1.

  X_FIELDCAT-SCRTEXT_M = 'Item'(025).
  X_FIELDCAT-FIELDNAME = 'POSNR'.
  X_FIELDCAT-TABNAME = 'IT_FINAL'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-OUTPUTLEN = '5'.
  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
  L_POS = L_POS + 1.

another is

create the structure in SE11 with all the fields from 3 tables and then pass it to the FM.

using the function,

  call function 'LVC_FIELDCATALOG_MERGE'
       exporting
            i_structure_name = 'ZSTRUC'
       changing
            ct_fieldcat      = pt_fieldcat.

Regards

vijay

Read only

uwe_schieferstein
Active Contributor
0 Likes
883

Hello Preet

If you have the structure for you ALV list already defined in the DDIC then use the name of structure to receive the fieldcatalog from LVC_FIELDCATALOG_MERGE.

However, if you haven't defined a DDIC structure but use a type defined within your program you can still use function module LVC_FIELDCATALOG_MERGE. Simply call the function module with your 3 different tables and collect the fieldcatalog into the same itab (e.g. gt_fcat). Then remove all unnecessary fields and duplicates and, if necessary, re-order the remaining fields.

* First sort the fields in the catalog in the required order
* Then renumber them.
  LOOP AT gt_fcat INTO ls_fcat.
    ls_fcat-col_pos = syst-tabix.
    MODIFY gt_fcat FROM ls_fcat.
  ENDLOOP.

Regards

Uwe

Read only

0 Likes
883

hi can u provide me some example code oh this how to use LVC_fieldcatalog_merge.. Since i have to use fields from 3 different tables