08-30-2007 5:52 PM
can you please help me tell what is missing in this program....
its giving run time error NO_FIELDCATALOG_AVAILABLE.
Also if possible give a good example for ALV grid program
TABLES: bsak.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.
PARAMETERS : p_bukrs TYPE bsak-bukrs,
p_augdt type bsak-augdt.
thanks!!
points willl be awarded
SELECTION-SCREEN END OF BLOCK B1.
TYPES : BEGIN OF st_bsak ,
bukrs type bsak-bukrs,
lifnr type bsak-lifnr,
augdt type bsak-augdt,
augbl type bsak-augbl,
gjahr type bsak-gjahr,
belnr type bsak-belnr,
budat type bsak-budat,
bldat type bsak-bldat,
hkont type bsak-hkont,
saknr type bsak-saknr,
zlsch type bsak-zlsch,
zlspr type bsak-zlspr,
hbkid type bsak-hbkid,
END OF st_bsak.
DATA it_bsak LIKE bsak OCCURS 0 WITH HEADER LINE.
SELECT bukrs
lifnr
augdt
augbl
gjahr
belnr
budat
bldat
hkont
saknr
zlsch
zlspr
hbkid
FROM bsak
INTO (it_bsak-bukrs,
it_bsak-lifnr,
it_bsak-augdt,
it_bsak-augbl,
it_bsak-gjahr,
it_bsak-belnr,
it_bsak-budat,
it_bsak-bldat,
it_bsak-hkont,
it_bsak-saknr,
it_bsak-zlsch,
it_bsak-zlspr,
it_bsak-hbkid) UP TO 10 ROWS "need to change it to 65000 rows
WHERE bukrs = p_bukrs.
endselect.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'st_bsak'
I_GRID_TITLE = 'SALES ORDER INFO'
TABLES
T_OUTTAB = it_bsak
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.
08-30-2007 5:55 PM
Hi
change the declaration of the internal table like this and see
it will work.
data : BEGIN OF it_bsak occurs 0,
bukrs type bsak-bukrs,
lifnr type bsak-lifnr,
augdt type bsak-augdt,
augbl type bsak-augbl,
gjahr type bsak-gjahr,
belnr type bsak-belnr,
budat type bsak-budat,
bldat type bsak-bldat,
hkont type bsak-hkont,
saknr type bsak-saknr,
zlsch type bsak-zlsch,
zlspr type bsak-zlspr,
hbkid type bsak-hbkid,
END OF it_bsak.
Regards
Anji
08-30-2007 5:55 PM
Please search the forum with the term ALV, there will be plenty of examples.
08-30-2007 5:58 PM
By the way....Is the Forum Search Working for you guys? Its not ... for me.
08-30-2007 6:02 PM
> By the way....Is the Forum Search Working for you
> guys? Its not ... for me.
Hmmm., yes the one above the forum is not working but the one on the left side is working.
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/advancedsearch?query=alv+example&cat=sdn_all">alv Example Search Results</a>
08-30-2007 6:02 PM
Here ya go boss. You can not pass the structure which is internal defined in your program to the REUSE_ALV_GRID_DISPLAY, this only works of the structured is defined in the ABAP dictionary. If you still want to generate the field cat from your internal structure, then use this below.
report zrich_0001.
tables: bsak.
type-pools: slis.
data: fieldcat type slis_t_fieldcat_alv.
data: repid type syrepid.
selection-screen begin of block b1 with frame title text-010.
parameters : p_bukrs type bsak-bukrs,
p_augdt type bsak-augdt.
selection-screen end of block b1.
* Use DATA instead of TYPE statement and change TYPE to LIKE
* at field level
data : begin of st_bsak ,
bukrs like bsak-bukrs,
lifnr like bsak-lifnr,
augdt like bsak-augdt,
augbl like bsak-augbl,
gjahr like bsak-gjahr,
belnr like bsak-belnr,
budat like bsak-budat,
bldat like bsak-bldat,
hkont like bsak-hkont,
saknr like bsak-saknr,
zlsch like bsak-zlsch,
zlspr like bsak-zlspr,
hbkid like bsak-hbkid,
end of st_bsak.
data it_bsak like bsak occurs 0 with header line.
* I modified your select statement a bit
select bukrs lifnr augdt augbl gjahr belnr
budat bldat hkont saknr zlsch zlspr hbkid
from bsak
into corresponding fields of table it_bsak
up to 10 rows "need to change it to 65000 rows
where bukrs = p_bukrs.
* Use this function to build your field cat based on the structure ST_BSAK
repid = sy-repid.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = repid
i_internal_tabname = 'ST_BSAK'
i_inclname = repid
i_bypassing_buffer = 'X'
changing
ct_fieldcat = fieldcat.
* Now pass the field cat.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* i_structure_name = 'st_bsak'
i_grid_title = 'SALES ORDER INFO'
it_fieldcat = fieldcat
tables
t_outtab = it_bsak
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.
Regards,
RIch Heilman
08-31-2007 1:21 PM
Your program gives error ...says.....Field catalog not found?????
what has to be done????
08-31-2007 1:32 PM
hi,
try this.
&----
*& Report ZALV_DS
*&
&----
*&
*&
&----
REPORT zalv_ds.
TYPE-POOLS:slis.
TABLES:mara,
makt,
marc.
DATA:BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
werks LIKE marc-werks,
rowcolor(4) TYPE c,
cellcolors TYPE lvc_t_scol,
END OF itab.
DATA:t_fcat TYPE slis_t_fieldcat_alv,
t_eve TYPE slis_t_event.
DATA : st_layout TYPE slis_layout_alv.
SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:mat FOR mara-matnr.
SELECTION-SCREEN:END OF BLOCK blk1.
INITIALIZATION.
PERFORM build_cata USING t_fcat.
PERFORM build_event.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM display_data.
&----
*& Form build_cata
&----
text
----
-->TEMP_FCAT text
----
FORM build_cata USING temp_fcat TYPE slis_t_fieldcat_alv.
DATA:wa_fcat TYPE slis_fieldcat_alv.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-seltext_m = 'Material'.
wa_fcat-key = 'X'.
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'MAKTX'.
wa_fcat-seltext_m = 'Description'.
wa_fcat-key = ''.
APPEND wa_fcat TO temp_fcat.
wa_fcat-tabname = 'ITAB'.
wa_fcat-fieldname = 'WERKS'.
wa_fcat-seltext_m = 'Plant'.
APPEND wa_fcat TO temp_fcat.
ENDFORM. "build_cata
&----
*& Form build_event
&----
text
----
FORM build_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = t_eve
EXCEPTIONS
list_type_wrong = 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.
ENDFORM. "build_event
&----
*& Form data_retrieval
&----
text
----
FORM data_retrieval.
SELECT maramatnr maktmaktx marc~werks INTO CORRESPONDING FIELDS OF TABLE itab
FROM mara INNER JOIN makt ON
maramatnr = maktmatnr
INNER JOIN marc ON
maramatnr = marcmatnr
WHERE mara~matnr IN mat.
SORT itab BY matnr.
DELETE ADJACENT DUPLICATES FROM itab.
ENDFORM. "data_retrieval
&----
*& Form display_data
&----
text
----
FORM display_data.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZALV_DS'
it_fieldcat = t_fcat
it_events = t_eve
TABLES
t_outtab = itab
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.
ENDFORM. "display_data