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 with Classes and methods

Former Member
0 Likes
1,377

Hi,

I am trying to do one ALV with splited screen. i am passing internal table in LVC_FIELDCATALOG_MERGE to merge fieldcatlog. when i tried to do that at the end it gives an error saying " Field catalog not found " and it stops running. i have gone through some of the BCALV demo progs but all of them are passing DDIC structure to merge fieldcatalog. i want to get result with internal table can i do that??? please reply ASAP.

Thanks,

Dhwanit.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,292

Can you post your code?

Regards,

Rich Heilman

13 REPLIES 13
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,293

Can you post your code?

Regards,

Rich Heilman

Read only

0 Likes
1,292

Hi Rich,

Yeah sure... here you go...

&----


*& Form create_and_init_controls

&----


FORM create_and_init_controls .

g_repid = sy-repid.

  • create docking container for alv control

CREATE OBJECT container_1

EXPORTING

repid = g_repid

dynnr = '100'

extension = 100

side = cl_gui_docking_container=>dock_at_top.

IF sy-subrc <> 0.

  • MESSAGE a000.

ENDIF.

  • create docking container for alv control

CREATE OBJECT container_2

EXPORTING

repid = g_repid

dynnr = '100'

extension = 300

side = cl_gui_docking_container=>dock_at_top.

IF sy-subrc <> 0.

  • MESSAGE a000.

ENDIF.

  • create alv control

CREATE OBJECT g_alv

EXPORTING i_parent = container_1.

  • create alv control

CREATE OBJECT g_alv1

EXPORTING i_parent = container_2.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

i_internal_tabname = 'I_AO_OUTPUT'

CHANGING

ct_fieldcat = gt_fieldcatalog.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

***PERFORM get_data_ao.

    • CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

    • EXPORTING

    • i_structure_name = 'I_AO'

    • CHANGING

    • ct_fieldcat = it_fieldcatalog

    • EXCEPTIONS

    • inconsistent_interface = 1

    • program_error = 2

    • OTHERS = 3.

    • IF sy-subrc <> 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    • ENDIF.

CALL METHOD g_alv1->set_table_for_first_display

EXPORTING

is_layout = gs_layout

CHANGING

it_fieldcatalog = gt_fieldcatalog

it_outtab = gt_outtab.

*

  • init = 'X'.

*

  • CALL METHOD cl_gui_cfw=>flush

  • EXCEPTIONS

  • cntl_system_error = 1

  • cntl_error = 2.

  • IF sy-subrc <> 0.

    • error handling

  • ENDIF.

ENDFORM. " create_and_init_controls

Read only

0 Likes
1,292

I need to see how you defined, the internal table 'I_AO_OUTPUT'

Regards,

Rich Heilman

Read only

0 Likes
1,292

Hi Rich,

Thanks for quick reply. here i am sending the code where i have declared all the tables and data.

&----


*& Include Z_RE_MASS_IDENTIFICATION_TOP.

&----


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

  • Types *

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

TYPE-POOLS: slis,

cndp.

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

  • Tables *

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

TABLES:

vibdao, "Architectural Object

vibpobjrel, "Business Partner-Object Relationship

but000, "Business Partner General Data

tb003t, "BP Roles

vibdpr, "Property

vitmoa, "Term:Organizational Assignment

vibdbu. "Building

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

  • Constants *

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

CONSTANTS:

wc_aotype_st LIKE vibdao-aotype VALUE 'Z1ST',

wc_aotype_bu LIKE vibdao-aotype VALUE 'Z2BU',

wc_appl LIKE vibpobjrel-appl VALUE '0057'.

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

  • Internal tables/structures *

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

DATA:

BEGIN OF i_ao OCCURS 0, "Architectural Objects

role LIKE vibpobjrel-role,

partner LIKE but000-partner,

intreno LIKE vibpobjrel-intreno,

aoid LIKE vibdao-aoid,

rltxt LIKE tb003t-rltxt,

appl LIKE vibpobjrel-appl,

END OF i_ao.

DATA:

BEGIN OF i_uo_prop OCCURS 0, "Usage Objects-Property

bukrs LIKE vibdpr-bukrs,

swenr LIKE vibdpr-swenr,

sgrnr LIKE vibdpr-sgrnr,

xgrtxt LIKE vibdpr-xgrtxt,

prctr LIKE vitmoa-prctr,

intreno LIKE vibdpr-intreno,

END OF i_uo_prop.

DATA:

BEGIN OF i_uo_bu OCCURS 0, "Usage Objects-Building

bukrs LIKE vibdbu-bukrs,

swenr LIKE vibdbu-swenr,

sgenr LIKE vibdbu-sgenr,

xgetxt LIKE vibdbu-xgetxt,

prctr LIKE vitmoa-prctr,

intreno LIKE vibdbu-intreno,

END OF i_uo_bu.

data:

begin of i_output occurs 0,

appl like vibpobjrel-appl,

aoid like vibdao-aoid,

name like vibdao-xao,

end of i_output.

*DATA splitter TYPE REF TO cl_gui_splitter_container.

*DATA container TYPE REF TO cl_gui_custom_container.

DATA container_1 TYPE REF TO cl_gui_docking_container.

DATA container_2 TYPE REF TO cl_gui_docking_container.

DATA init.

DATA ok_code TYPE sy-ucomm.

DATA g_repid LIKE sy-repid.

DATA g_alv TYPE REF TO cl_gui_alv_grid.

DATA g_alv1 TYPE REF TO cl_gui_alv_grid.

DATA gs_layout TYPE lvc_s_layo.

DATA gt_outtab LIKE standard TABLE OF i_ao.

DATA gt_fieldcatalog TYPE lvc_t_fcat.

Read only

0 Likes
1,292

Still don't see a data statement for 'I_AO_OUTPUT'

Regards,

RIch Heilman

Read only

0 Likes
1,291

Hello Dwanit

Your coding

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_internal_tabname = 'I_AO_OUTPUT'
CHANGING
ct_fieldcat = gt_fieldcatalog.

cannot work this way. Instead, you have to define the line type of 'I_AO_OUTPUT' in an include and tell the function module the name of this include. For details refer to the following sample report:

*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_FIELDCATALOG_1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zus_sdn_fieldcatalog_1.


TYPE-POOLS: slis.

include zus_sdn_slisfcat_Data.
*DATA: BEGIN OF ty_s_list.
*DATA:   bukrs    LIKE knb1-bukrs.
*DATA:   kunnr    LIKE knb1-kunnr.
*DATA:   vkorg    TYPE knvv-vkorg.  " type does not work !!!
*DATA: END OF ty_s_list.


DATA:
  gs_list         LIKE ty_s_list,
  gt_list         LIKE ty_s_list OCCURS 0.

DATA:
  gt_fcat         TYPE slis_t_fieldcat_alv.


START-OF-SELECTION.

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name               = syst-repid
      i_internal_tabname           = 'TY_S_LIST'
*     I_STRUCTURE_NAME             =
*     I_CLIENT_NEVER_DISPLAY       = 'X'
      i_inclname                   = 'ZUS_SDN_SLISFCAT_DATA'
      I_BYPASSING_BUFFER           = 'X'
*     I_BUFFER_ACTIVE              =
    CHANGING
      ct_fieldcat                  = gt_fcat
    EXCEPTIONS
      inconsistent_interface       = 1
      program_error                = 2
      OTHERS                       = 3.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.




  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_structure_name = 'LVC_S_FCAT'
    TABLES
      t_outtab         = gt_fcat
    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.

END-OF-SELECTION.

And here is the coding of the include:

*&---------------------------------------------------------------------*
*&  Include           ZUS_SDN_FIELDCATALOG_1_DATA
*&---------------------------------------------------------------------*


DATA: BEGIN OF ty_s_list.
DATA:   bukrs    LIKE knb1-bukrs.
DATA:   kunnr    LIKE knb1-kunnr.
DATA:   vkorg    TYPE knvv-vkorg.  " type does not work !!!
DATA: END OF ty_s_list.

Regards

Uwe

Read only

0 Likes
1,291

This function module may only work when dealing with structures which are defined in the ABAP Dictionary.

Regards,

Rich Heilman

Read only

0 Likes
1,291

Hi Rich,

look at the below code now i am sorry that was wrong code which i have posted. in the below code you can see data statement for i_ao_output.

&----


*

*& Form get_data_ao

&----


FORM get_data_ao .

DATA: wa_ao LIKE i_ao.

DATA: i_ao_output LIKE STANDARD TABLE OF i_ao.

DATA: wa_ao_output LIKE i_ao.

SELECT

vibpobjrel~role

but000~partner

vibpobjrel~intreno

vibdao~aoid

tb003t~rltxt

vibpobjrel~appl

INTO TABLE i_ao

FROM vibdao

LEFT OUTER JOIN vibpobjrel

ON vibdaointreno = vibpobjrelintreno

INNER JOIN but000

ON but000partner = vibpobjrelpartner

INNER JOIN tb003t

ON tb003trole = vibpobjrelrole

WHERE

tb003t~spras = sy-langu AND

vibdao~aotype = p_aotype AND

vibdao~aoid IN s_aoid AND

( ( vibdao~aotype = wc_aotype_st AND

vibdao~zzsstdort IN s_reglo AND

vibdao~slagewe IN s_metro AND

vibdao~sverkehr IN s_trans ) ) OR

( ( vibdao~aotype = wc_aotype_bu AND

vibdao~rgebart IN s_paset AND

vibdao~sunutza IN s_saset AND

vibdao~zzgemeinde IN s_munic AND

vibdao~sgrart IN s_stval AND

vibdao~zztier1 IN s_tier1 ) ).

IF sy-subrc <> 0.

MESSAGE i806(k9) WITH 'No data found for given selection'(t15).

STOP.

ENDIF.

IF p_bp = 'X'.

LOOP AT i_ao INTO wa_ao WHERE role IN s_role AND partner IN s_partnr.

APPEND wa_ao TO i_ao_output.

ENDLOOP.

ENDIF.

ENDFORM. " get_data_ao

Read only

0 Likes
1,291

Also, it appears that you are using a parameter name that does not exist in this function module, instead of I_INTERNAL_TABLE, it should be I_STRUCTURE_NAME.

call function 'LVC_FIELDCATALOG_MERGE'
     exporting
          I_STRUCTURE_NAME = 'SBOOK'
     changing
          ct_fieldcat        = gt_fieldcatalog.


check sy-subrc  = 0.

Regards,

RIch HEilman

Read only

Former Member
0 Likes
1,291

Hi Dhwanit,

It seems there is some problem with your code. Specially the structure and internal table you are using to build the field catalog.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

i_internal_tabname =<b> 'I_AO_OUTPUT'</b>

CHANGING

ct_fieldcat = gt_fieldcatalog.

Did you define the internal table 'I_AO_OUTPUT' properly?

What I ll suggest go for some Z(structure) via SE11 and use it to create the field catalog.

Similarly for the code below....I_AO is it a std. SAP structure u r using?

Plz define Z(structure) for this too.

I hope u ll get the required O/P

***PERFORM get_data_ao.

    • CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

    • EXPORTING

    • i_structure_name = <b>'I_AO'</b>

    • CHANGING

    • ct_fieldcat = it_fieldcatalog

    • EXCEPTIONS

    • inconsistent_interface = 1

    • program_error = 2

    • OTHERS = 3.

Hope it ll help and u ll get the required solution.

Thank-You.

Regards,

vinsee

Read only

0 Likes
1,291

Thank you very much for your support you guys were right to pass that i have to have an DDIC structure.

Thank you very much.

Read only

Former Member
0 Likes
1,291

to make fieldcatalog with merge function we have to pass DDIC structure only.

Read only

Former Member
0 Likes
1,291

to make fieldcatalog with merge function we have to pass DDIC structure only.