This website is not affiliated with, sponsored by, or approved by SAP AG.

Display ALV using Custom Control? - [RESOLVED]

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Display ALV using Custom Control? - [RESOLVED]

Postby Baz » Thu Jul 02, 2015 10:08 am

Hi

I am trying to display an ALV in a custom control (Called BOM_ALV) - although I have never done this before. I am using this as a guide:
http://www.kodyaz.com/articles/sap-abap ... inter.aspx

I have already added three standard fields in the screen (CS02/CS03) and these are displayed and changeable and post back to STPO.

The ALV reads fields from a ZTABLE and has a link of one BoM to many ZTABLE.

I have used the following code inside Status 1000

Code: Select all
DATA:   gs_fieldcatalog TYPE lvc_s_fcat OCCURS 0,
          gv_fcat         LIKE LINE OF gs_fieldcatalog,
          gs_layout       TYPE lvc_s_layo.

  DATA:  gt_bom_table     TYPE TABLE OF zpp_bom_table.

  DATA : g_container        TYPE scrfname VALUE 'CC_CONTAINER_GRID',
         g_custom_container TYPE REF TO cl_gui_custom_container,
         g_grid             TYPE REF TO cl_gui_alv_grid.

  IF g_custom_container IS INITIAL.

    " Create CONTAINER object with reference to container name in the screen
    CREATE OBJECT g_custom_container
      EXPORTING
        container_name = g_container.
    " Create GRID object with reference to parent name
    CREATE OBJECT g_grid
      EXPORTING
        i_parent = g_custom_container.

    PERFORM u_prepare_fieldcatalog.
    gs_layout-zebra = 'X'.
    "gs_layout-edit = 'X'. " Makes all Grid editable

    PERFORM get_data.

    " SET_TABLE_FOR_FIRST_DISPLAY
    CALL METHOD g_grid->set_table_for_first_display
      EXPORTING
        is_layout       = gs_layout
      CHANGING
        it_fieldcatalog = gs_fieldcatalog
        it_outtab       = gt_bom_table. " Data

  ELSE.
    CALL METHOD g_grid->refresh_table_display.
  ENDIF.


Is this the right way to do this? nothing is displayed so I guess I am missing something key. Having never done PBO/PAI before i tried first...

Any suggestions/links for me to would be gratefully received.

Thanks in advance....
Baz

AsPiRiNg tUlY iDiOt Image

http://www.catb.org/~esr/faqs/smart-questions.html

Image

check out my Podcasts http://dj-baz.podomatic.com
Baz
 
Posts: 4736
Joined: Fri Nov 08, 2002 5:54 am
Location: He's out there! somewhere!!!!

Re: Display ALV using Custom Control?

Postby Gothmog » Thu Jul 02, 2015 10:36 am

Your field catalog should be a table, not a structure (type lvc_t_fcat, not lvc_s_fcat).
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1941
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Display ALV using Custom Control?

Postby Baz » Thu Jul 02, 2015 10:49 am

Thank you.
I have amended all of that now.

D'oh!

Found the bit i was missing....

i had not set the container properly:

DATA : g_container TYPE scrfname VALUE 'BOM_ALV',

It now has the ALV! :)
Baz

AsPiRiNg tUlY iDiOt Image

http://www.catb.org/~esr/faqs/smart-questions.html

Image

check out my Podcasts http://dj-baz.podomatic.com
Baz
 
Posts: 4736
Joined: Fri Nov 08, 2002 5:54 am
Location: He's out there! somewhere!!!!


Return to ABAP

Who is online

Users browsing this forum: Google [Bot] and 7 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.