Runtime error in ALV demo
HI,
Runtime error in the below report as internal table IT_FIELDCAT is empty after the execution of FM
REUSE_ALV_FIELDCATALOG_MERGE.
Please tell me how do i rectify this error.
REPORT ZMY_ALV_COLORING_CELLS.
TYPE-POOLS SLIS.
DATA: BEGIN OF itab OCCURS 0,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
END OF itab.
PARAMETERS: P_BUKRS TYPE TBUKRS.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BUKRS.
PERFORM F4_FOR_BUKRS.
*& Form F4_FOR_BUKRS
FORM F4_FOR_BUKRS.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV ,
ES_SELFIELD TYPE SLIS_SELFIELD. " Get data
SELECT BUKRS
BUTXT
FROM T001
INTO TABLE itab
up to 10 rows .
Get field
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'ITAB'
CHANGING
CT_FIELDCAT = IT_FIELDCAT[].
LOOP AT IT_FIELDCAT.
IT_FIELDCAT-KEY = SPACE.
IF IT_FIELDCAT-FIELDNAME = 'BUTXT'.
IT_FIELDCAT-EMPHASIZE = 'C710'.
ENDIF.
IF IT_FIELDCAT-FIELDNAME = 'BUKRS'.
IT_FIELDCAT-EMPHASIZE = 'C610'.
ENDIF.
MODIFY IT_FIELDCAT.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE = 'THIS IS FOR F4 IN COLOR'
I_TABNAME = 'ITAB'
IT_FIELDCAT = IT_FIELDCAT[]
IMPORTING
ES_SELFIELD = ES_SELFIELD
TABLES
T_OUTTAB = ITAB .
Thanks,
Ahmed.
Change like this
>
ahmed shaik wrote:
> HI,
>
> Runtime error in the below report as internal table IT_FIELDCAT is empty after the execution of FM
> REUSE_ALV_FIELDCATALOG_MERGE.
>
> Please tell me how do i rectify this error.
>
>
>
> REPORT ZMY_ALV_COLORING_CELLS.
> TYPE-POOLS SLIS.
>
> DATA: BEGIN OF itab OCCURS 0,
> BUKRS LIKE T001-BUKRS,
> BUTXT LIKE T001-BUTXT,
> END OF itab.
>
> PARAMETERS: P_BUKRS TYPE TBUKRS.
>
> AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BUKRS.
>
>
> PERFORM F4_FOR_BUKRS.
> &----
> *& Form F4_FOR_BUKRS
> ----
> FORM F4_FOR_BUKRS.
>
> DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV ,
> ES_SELFIELD TYPE SLIS_SELFIELD. " Get data
>
> SELECT BUKRS
> BUTXT
> FROM T001
> INTO TABLE itab
> up to 10 rows .
> * Get field
>
> CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
> EXPORTING
> I_PROGRAM_NAME = SY-REPID
>* I_INTERNAL_TABNAME = 'ITAB'
> I_STRUCTURE_NAME = 'ITAB'
> CHANGING
> CT_FIELDCAT = IT_FIELDCAT[].
>
> LOOP AT IT_FIELDCAT.
> IT_FIELDCAT-KEY = SPACE.
> IF IT_FIELDCAT-FIELDNAME = 'BUTXT'.
> IT_FIELDCAT-EMPHASIZE = 'C710'.
> ENDIF.
> IF IT_FIELDCAT-FIELDNAME = 'BUKRS'.
> IT_FIELDCAT-EMPHASIZE = 'C610'.
> ENDIF.
>
> MODIFY IT_FIELDCAT.
> ENDLOOP.
>
> CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
> EXPORTING
> I_TITLE = 'THIS IS FOR F4 IN COLOR'
> I_TABNAME = 'ITAB'
> IT_FIELDCAT = IT_FIELDCAT[]
> IMPORTING
> ES_SELFIELD = ES_SELFIELD
> TABLES
> T_OUTTAB = ITAB .
>
>
>
>
>
> Thanks,
> Ahmed.
Rhea
Similar Messages
-
Runtime Error in ALV Tree Output
Dear All, I am trying to create a ALV Tree using Class cl_gui_alv_tree. The Report Shows the Output with the first Node but when i try to expand it is dumping with a runtime error GETWA_NOT_ASSIGNED in class CL_ALV_TREE_BASE and method SET_ITEMS_FOR_COLUMN. The Reason being the data which was copied in the initial node display to mt_outtab is getting refreshed.
Can any one of you help me the reason for the table getting refreshed. Do i need to pass any data.
I am doing the following steps.
1. Create Container,
2. Create Tree Class object
3. Generate the Field Catalog.
4. Set table for first display " With empty internal table
5. Generate the Hierarchy
6. Call the Method Frontend Update.
Let me know if i had missed any steps in the process.
Thank you,
Regards,
Swaroop PatriOne reason for getting this error is using local defined tables for it_outtab parameter in the below code:
To get rid of the dump, define two distinct output tables globally: one is an empty table which you will pass to the below method, other one is your real output table whose size increases dependently.
CALL METHOD go_tree->set_table_for_first_display
EXPORTING
is_hierarchy_header = ls_hier_header
CHANGING
it_outtab = gt_data_e "Empty table
it_fieldcatalog = gt_fcat_tree. -
Regarding Runtime error in ALV List Display.
am using following to display data in ALV List.
but after executing of program am getting runtime error called 'Field Symbol has Not been assigned' .
please tell me how to correct the error.
Very urgent
Suitable answers rewarded with Maximum Ponits...
REPORT zmatrix.
TYPE-POOLS: slis.
TABLES: agr_define, sza5_d0700.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-006.
SELECT-OPTIONS: s_role FOR agr_define-agr_name OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
D A T A *
TYPES: BEGIN OF ty_agr_1251_inf,
agr_name TYPE agr_1251-agr_name,
object TYPE agr_1251-object,
field TYPE agr_1251-field,
low(20) TYPE c,
high TYPE agr_1251-high,
infty TYPE t582s-infty,
itext TYPE t582s-itext,
END OF ty_agr_1251_inf.
TYPES: BEGIN OF ty_agr_1251_tcode,
agr_name TYPE agr_1251-agr_name,
object TYPE agr_1251-object,
field TYPE agr_1251-field,
low(20) TYPE c,
high TYPE agr_1251-high,
tcode TYPE tstct-tcode,
ttext TYPE tstct-ttext,
END OF ty_agr_1251_tcode.
TYPES: BEGIN OF ty_t582s,
infty TYPE agval,
itext TYPE t582s-itext,
END OF ty_t582s.
TYPES: BEGIN OF ty_code,
tcode TYPE tstct-tcode,
ttext TYPE ttext_stct,
END OF ty_code.
TYPES: BEGIN OF ty_inf,
infty TYPE t582s-infty,
itext TYPE t582s-itext,
END OF ty_inf.
TYPES: BEGIN OF ty_role,
agr_name TYPE agr_1251-agr_name,
END OF ty_role.
TYPES: BEGIN OF tys_role_dtls,
agr_name TYPE agr_name,
value TYPE c,
property TYPE c,
END OF tys_role_dtls.
TYPES: BEGIN OF tys_infotype_final,
text(60),
text1(60),
value(4),
END OF tys_infotype_final.
I N T E R N A L T A B L E S *
DATA: wa_infotyp_final TYPE tys_infotype_final.
DATA: t_infotyp_final TYPE TABLE OF tys_infotype_final.
DATA: BEGIN OF wa_infotyp_dtls,
infty TYPE infty,
itext TYPE intxt,
role_dtls TYPE TABLE OF tys_role_dtls,
END OF wa_infotyp_dtls.
DATA: BEGIN OF wa_tcode_dtls,
tcode TYPE tcode,
ttext TYPE ttext_stct,
role_dtls TYPE TABLE OF tys_role_dtls,
END OF wa_tcode_dtls.
DATA: t_infotyp_dtls LIKE TABLE OF wa_infotyp_dtls,
t_tcode_dtls LIKE TABLE OF wa_tcode_dtls,
t_role_dtls TYPE TABLE OF tys_role_dtls,
wa_role_dtls TYPE tys_role_dtls.
DATA: wa_inf TYPE ty_inf,
t_inf TYPE STANDARD TABLE OF ty_inf.
DATA: wa_role TYPE ty_role,
t_role TYPE STANDARD TABLE OF ty_role.
DATA: wa_tcode TYPE ty_code,
t_tcode TYPE TABLE OF ty_code.
DATA: wa_agr_1251_inf TYPE ty_agr_1251_inf.
DATA: wa_agr_1251_tcode TYPE ty_agr_1251_tcode.
DATA: t_agr_1251_inf TYPE STANDARD TABLE OF ty_agr_1251_inf.
DATA: t_agr_1251_tc TYPE STANDARD TABLE OF ty_agr_1251_tcode.
DATA: wa_582s TYPE ty_t582s.
DATA: t_582s TYPE STANDARD TABLE OF ty_t582s.
DATA: t_range_tcode TYPE RANGE OF tcode.
DATA: t_range_inf TYPE RANGE OF infotyp.
DATA: wa_range_inf LIKE LINE OF t_range_inf.
DATA: wa_range_tcode LIKE LINE OF t_range_tcode.
DATA: wa_field TYPE slis_fieldcat_alv.
DATA: t_field TYPE slis_t_fieldcat_alv.
VARIABLES FOR OLE *
DATA: text(20),
count(20).
DATA: text1(30).
DATA: agr_name TYPE agr_1251-agr_name.
DATA: flag TYPE i VALUE '0'.
DATA: string1 TYPE string.
DATA: str TYPE string VALUE 'SAP%'.
DATA: count1 TYPE i VALUE '0'.
*& Event START-OF-SELECTION
START-OF-SELECTION.
PERFORM f100_get_inf_data.
PERFORM f200_process_inf_data.
count1 = 1.
PERFORM f300_prepare_field_catalog.
PERFORM f110_main_data.
PERFORM f400_display_data.
PERFORM f100_get_trans_data.
*& Form f110_main_data
text
FORM f110_main_data.
wa_infotyp_final-text = 'Access to Infotypes'.
APPEND wa_infotyp_final TO t_infotyp_final.
wa_infotyp_final-text = 'Infotype'.
wa_infotyp_final-text1 = 'Description'.
APPEND wa_infotyp_final TO t_infotyp_final.
wa_infotyp_final-text = '*'.
wa_infotyp_final-text1 = 'Acess to all Infotypes'.
LOOP AT t_role INTO wa_role WHERE agr_name <> ' '.
READ TABLE t_agr_1251_inf INTO wa_agr_1251_inf
WITH KEY agr_name = wa_role-agr_name field = 'INFTY' low = '*'.
IF syst-subrc = 0.
wa_infotyp_final-value = 'X'.
ENDIF.
ENDLOOP.
APPEND wa_infotyp_final TO t_infotyp_final.
LOOP AT t_inf INTO wa_inf WHERE infty <> ' '.
wa_infotyp_final-text = wa_inf-infty.
wa_infotyp_final-text1 = wa_inf-itext.
LOOP AT t_role INTO wa_role WHERE agr_name <> ' '.
Role Name
CLEAR wa_role_dtls.
flag = 1.
wa_role_dtls-agr_name = wa_role-agr_name.
For Value D & F
READ TABLE t_agr_1251_inf INTO wa_agr_1251_inf
WITH KEY agr_name = wa_role-agr_name field = 'AUTHC'..
IF syst-subrc EQ 0.
IF wa_agr_1251_inf-low = 'R'.
wa_infotyp_final-value = 'D'.
ELSE.
wa_infotyp_final-value = 'F'.
ENDIF.
ENDIF.
APPEND wa_role_dtls TO t_role_dtls.
APPEND wa_infotyp_final TO t_infotyp_final.
ENDLOOP.
ENDLOOP.
ENDFORM. "f110_main_data
*& Form f100_get_inf_data
text
FORM f100_get_inf_data.
Logic for Infotypes *
SELECT aagr_name aobject
afield alow a~high
INTO TABLE t_agr_1251_inf
FROM agr_1251 AS a INNER JOIN agr_define AS b
ON aagr_name EQ bagr_name
WHERE ( ( aobject EQ 'P_ORGIN' OR aobject EQ 'P_PERNR' )
AND ( aagr_name IN s_role ) AND ( bagr_name NOT LIKE str ) ).
ENDFORM. "f100_get_inf_data
*& Form f200_get_inf_process_data
text
FORM f200_process_inf_data.
LOOP AT t_agr_1251_inf INTO wa_agr_1251_inf.
IF wa_agr_1251_inf-high IS INITIAL.
CLEAR wa_range_inf.
wa_range_inf-sign = 'I'.
wa_range_inf-option = 'EQ'.
wa_range_inf-low = wa_agr_1251_inf-low.
APPEND wa_range_inf TO t_range_inf.
ELSE.
CLEAR wa_range_inf.
wa_range_inf-sign = 'I'.
wa_range_inf-option = 'BT'.
wa_range_inf-low = wa_agr_1251_inf-low.
wa_range_inf-high = wa_agr_1251_inf-high.
APPEND wa_range_inf TO t_range_inf.
ENDIF.
ENDLOOP.
SORT t_range_inf.
DELETE ADJACENT DUPLICATES FROM t_range_inf.
IF t_range_inf IS NOT INITIAL.
SELECT infty itext FROM t582s
INTO TABLE t_582s
WHERE sprsl = 'EN' AND infty IN t_range_inf.
IF syst-subrc EQ 0.
ENDIF.
ENDIF.
LOOP AT t_agr_1251_inf INTO wa_agr_1251_inf.
IF wa_agr_1251_inf-high IS INITIAL.
READ TABLE t_582s INTO wa_582s
WITH KEY infty = wa_agr_1251_inf-low.
IF syst-subrc EQ 0.
wa_agr_1251_inf-infty = wa_582s-infty.
wa_agr_1251_inf-itext = wa_582s-itext.
MODIFY t_agr_1251_inf FROM wa_agr_1251_inf
TRANSPORTING infty itext.
IF syst-subrc EQ 0.
ENDIF.
ENDIF.
ELSE.
CLEAR count.
LOOP AT t_582s INTO wa_582s
WHERE infty GE wa_agr_1251_inf-low
AND infty LE wa_agr_1251_inf-high.
IF count LE 1.
wa_agr_1251_inf-high = space.
wa_agr_1251_inf-infty = wa_582s-infty.
wa_agr_1251_inf-itext = wa_582s-itext.
MODIFY t_agr_1251_inf FROM wa_agr_1251_inf
TRANSPORTING infty itext.
IF syst-subrc EQ 0.
CLEAR wa_582s.
ENDIF.
ELSE.
wa_agr_1251_inf-high = space.
wa_agr_1251_inf-infty = wa_582s-infty.
wa_agr_1251_inf-itext = wa_582s-itext.
APPEND wa_agr_1251_inf TO t_agr_1251_inf.
ENDIF.
CLEAR wa_agr_1251_inf.
count = count + 1.
ENDLOOP.
ENDIF.
ENDLOOP.
wa_role-agr_name = ' '.
APPEND wa_role TO t_role.
wa_role-agr_name = ' '.
APPEND wa_role TO t_role.
LOOP AT t_agr_1251_inf INTO wa_agr_1251_inf.
IF wa_agr_1251_inf IS NOT INITIAL.
wa_role-agr_name = wa_agr_1251_inf-agr_name.
wa_inf-infty = wa_agr_1251_inf-infty.
wa_inf-itext = wa_agr_1251_inf-itext.
APPEND wa_role TO t_role.
APPEND wa_inf TO t_inf.
ENDIF.
ENDLOOP.
SORT t_role BY agr_name.
DELETE ADJACENT DUPLICATES FROM t_role.
SORT t_inf BY infty.
DELETE ADJACENT DUPLICATES FROM t_inf.
ENDFORM. "f200_get_process_inf_data
*& Form f100_get_trans_data
text
FORM f100_get_trans_data.
Logic for Transaction Codes *
SELECT aagr_name aobject
afield alow a~high
INTO CORRESPONDING FIELDS OF TABLE t_agr_1251_tc
FROM agr_1251 AS a
INNER JOIN agr_define AS b ON aagr_name EQ bagr_name
WHERE a~agr_name IN s_role
AND a~object EQ 'S_TCODE'.
ENDFORM. "f100_get_trans_data
*& Form f200_process_trans_data
text
FORM f200_process_trans_data.
LOOP AT t_agr_1251_tc INTO wa_agr_1251_tcode.
IF wa_agr_1251_tcode-high IS INITIAL.
CLEAR wa_range_tcode.
wa_range_tcode-sign = 'I'.
wa_range_tcode-option = 'EQ'.
wa_range_tcode-low = wa_agr_1251_tcode-low.
APPEND wa_range_tcode TO t_range_tcode.
ELSE.
CLEAR wa_range_tcode.
wa_range_tcode-sign = 'I'.
wa_range_tcode-option = 'BT'.
wa_range_tcode-low = wa_agr_1251_tcode-low.
wa_range_tcode-high = wa_agr_1251_tcode-high.
APPEND wa_range_tcode TO t_range_tcode.
ENDIF.
ENDLOOP.
SORT t_range_tcode.
DELETE ADJACENT DUPLICATES FROM t_range_tcode.
IF t_range_tcode IS NOT INITIAL.
SELECT tcode
ttext
FROM tstct
INTO TABLE t_tcode
WHERE sprsl EQ 'E'
AND tcode IN t_range_tcode.
IF sy-subrc EQ 0.
ENDIF.
ENDIF.
SORT t_agr_1251_tc BY agr_name.
LOOP AT t_agr_1251_tc INTO wa_agr_1251_tcode.
IF wa_agr_1251_tcode-high IS INITIAL.
READ TABLE t_tcode INTO wa_tcode
WITH KEY tcode = wa_agr_1251_tcode-low.
IF syst-subrc EQ 0.
wa_agr_1251_tcode-tcode = wa_tcode-tcode.
wa_agr_1251_tcode-ttext = wa_tcode-ttext.
MODIFY t_agr_1251_tc FROM wa_agr_1251_tcode
TRANSPORTING tcode ttext.
IF syst-subrc EQ 0.
ENDIF.
ENDIF.
ELSE.
CLEAR count.
LOOP AT t_tcode INTO wa_tcode
WHERE tcode GE wa_agr_1251_tcode-low
AND tcode LE wa_agr_1251_tcode-high.
IF count LE 1.
agr_name = wa_agr_1251_tcode-agr_name.
wa_agr_1251_tcode-high = space.
wa_agr_1251_tcode-tcode = wa_tcode-tcode.
wa_agr_1251_tcode-ttext = wa_tcode-ttext.
MODIFY t_agr_1251_tc FROM wa_agr_1251_tcode
TRANSPORTING tcode ttext high.
IF syst-subrc EQ 0.
CLEAR wa_tcode.
ENDIF.
count = 1.
ELSE.
wa_agr_1251_tcode-high = space.
wa_agr_1251_tcode-agr_name = agr_name.
wa_agr_1251_tcode-low = wa_tcode-tcode.
wa_agr_1251_tcode-tcode = wa_tcode-tcode.
wa_agr_1251_tcode-ttext = wa_tcode-ttext.
APPEND wa_agr_1251_tcode TO t_agr_1251_tc.
ENDIF.
CLEAR wa_agr_1251_tcode.
count = count + 1.
ENDLOOP.
ENDIF.
ENDLOOP.
LOOP AT t_agr_1251_tc INTO wa_agr_1251_tcode.
wa_role-agr_name = wa_agr_1251_tcode-agr_name.
APPEND wa_role TO t_role.
ENDLOOP.
SORT t_role BY agr_name.
DELETE ADJACENT DUPLICATES FROM t_role.
SORT t_tcode BY tcode.
DELETE ADJACENT DUPLICATES FROM t_tcode.
ENDFORM. "f200_process_trans_data
*& Form f100_prepare_field_catalog
text
FORM f300_prepare_field_catalog.
LOOP AT t_role INTO wa_role.
wa_field-col_pos = count1.
wa_field-fieldname = wa_role-agr_name.
APPEND wa_field TO t_field.
count1 = count1 + 1.
ENDLOOP.
ENDFORM. "f100_prepare_field_catalog
*& Form f100_display_data
text
FORM f400_display_data.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-cprog
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
IS_LAYOUT =
it_fieldcat = t_field[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IR_SALV_LIST_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = t_infotyp_final[]
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. "f100_display_datathis are the wasy u can build a field catalog...
1.----
FORM fill_fieldcat .
DATA: fld(30),
idx(2) TYPE n.
DEFINE no_output.
fieldcatalog-fieldname = &1.
fieldcatalog-no_out = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
END-OF-DEFINITION.
DEFINE catalog.
fieldcatalog-fieldname = &1.
fieldcatalog-seltext_s = &2.
if not &3 is initial.
fieldcatalog-seltext_m = &3.
else.
fieldcatalog-seltext_m = fieldcatalog-seltext_s.
endif.
if not &4 is initial.
fieldcatalog-seltext_l = &4.
else.
fieldcatalog-seltext_l = fieldcatalog-seltext_m.
endif.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
END-OF-DEFINITION.
catalog 'AVAIL_BASE'
'Base Qty.'
'Base Qty. Available'
'Base Quantity Available'.
catalog 'AVAIL_SALES'
'Sales Qty.'
'Sales Qty. Available'
'Sales Quantity Available'.
LOOP AT t_char_data.
idx = sy-tabix.
CONCATENATE 'CHR' idx INTO fld.
catalog fld
t_char_data-atbez
t_char_data-atbez
t_char_data-atbez.
ENDLOOP.
ADD 1 TO idx.
WHILE idx LE 15.
CONCATENATE 'CHR' idx INTO fld.
no_output fld.
ADD 1 TO idx.
ENDWHILE..
fieldcatalog-fieldname = 'EXACT'.
fieldcatalog-checkbox = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
2.----
FORM fieldcatalog.
REFRESH fc. CLEAR fc.
fc-tabname = 'HEADER'.
fc-fieldname = 'KUNNR'.
fc-ref_tabname = 'MSKU'.
APPEND fc. CLEAR fc.
fc-tabname = 'HEADER'.
fc-fieldname = 'NAME1_K'.
fc-ref_tabname = 'KNA1'.
fc-ref_fieldname = 'NAME1'.
APPEND fc. CLEAR fc.
fc-tabname = 'HEADER'.
fc-fieldname = 'TOTAL'.
fc-ref_tabname = 'MBEW'.
fc-ref_fieldname = 'SALK3'.
APPEND fc. CLEAR fc.
fc-tabname = 'LIST'.
fc-fieldname = 'MATNR'.
fc-ref_tabname = 'MSKU'.
APPEND fc. CLEAR fc.
fc-tabname = 'LIST'.
fc-fieldname = 'MAKTX'.
fc-ref_tabname = 'MAKT'.
fc-no_out = 'X'.
APPEND fc. CLEAR fc.
fc-tabname = 'LIST'.
fc-fieldname = 'CHARG'.
fc-ref_tabname = 'MSKU'.
APPEND fc. CLEAR fc.
fc-tabname = 'LIST'.
fc-fieldname = 'WERKS'.
fc-ref_tabname = 'MSKU'.
fc-no_out = 'X'.
APPEND fc. CLEAR fc.
fc-tabname = 'LIST'.
fc-fieldname = 'NAME1_W'.
fc-ref_tabname = 'T001W'.
fc-ref_fieldname = 'NAME1'.
fc-no_out = 'X'.
APPEND fc. CLEAR fc. -
Getting runtime error in ALV ...
Hi,
I am calling function REUSE_ALV_GRID_DISPLAY to display my data in an ALV grid... this code was working fine and so I used it for a different set of data but now it is throwing a runtime error saying ..
GETWA_NOT_ASSIGNED
Field symbol has not yet been assigned.
I dont understand why I am getting this and how to resolve this...my sample code is pasted below..
REPORT ZFB12TEST.
TABLES: BKPF.
TYPE-POOLS: slis.
DATA: BEGIN OF bkpf_rec OCCURS 0,
bukrs LIKE BKPF-BUKRS,
blart LIKE BKPF-BLART,
cpudt LIKE BKPF-CPUDT,
budat LIKE BKPF-budat,
belnr LIKE BKPF-BELNR,
gjahr LIKE BKPF-GJAHR,
END OF bkpf_rec.
DATA migo_data LIKE bkpf_rec occurs 0 with header line.
DATA: it_cat TYPE slis_t_fieldcat_alv,
wa_lay TYPE slis_layout_alv.
FIELD-SYMBOLS: <fs_cat> LIKE LINE OF it_cat.
SELECT-OPTIONS: so_bukrs FOR BKPF-BUKRS,
so_blart FOR BKPF-BLART,
so_cpudt FOR BKPF-CPUDT,
so_budat FOR BKPF-budat,
so_belnr FOR BKPF-BELNR,
so_gjahr FOR BKPF-GJAHR.
*include bdcrecx1.
start-of-selection.
SELECT bukrs blart cpudt budat belnr gjahr into table bkpf_rec from bkpf
where bukrs IN
so_bukrs and blart in so_blart and cpudt in so_cpudt and budat in
so_budat and belnr in so_belnr and gjahr in so_gjahr.
loop at bkpf_rec.
move-corresponding bkpf_rec to migo_data.
append migo_data.
endloop.
DATA: it_sortcat type slis_sortinfo_alv occurs 1,
wa_sort like line of it_sortcat.
wa_sort-spos = 1.
wa_sort-fieldname = 'bukrs'.
wa_sort-subtot = 'X'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sortcat.
wa_sort-spos = 2.
wa_sort-fieldname = 'belnr'.
wa_sort-subtot = 'X'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sortcat.
wa_lay-zebra = 'X'.
data: tmp_fc type slis_fieldcat_alv .
tmp_fc-reptext_ddic = 'CC'.
tmp_fc-fieldname = 'bukrs'.
tmp_fc-tabname = 'migo_data'.
tmp_fc-outputlen = 10.
tmp_fc-do_sum = space.
append tmp_fc to it_cat.
tmp_fc-reptext_ddic = 'Document number'.
tmp_fc-fieldname = 'belnr'.
tmp_fc-tabname = 'migo_data'.
tmp_fc-outputlen = 20.
tmp_fc-do_sum = space.
append tmp_fc to it_cat.
tmp_fc-reptext_ddic = 'Entry date'.
tmp_fc-fieldname = 'cpudt'.
tmp_fc-tabname = 'migo_data'.
tmp_fc-outputlen = 20.
tmp_fc-do_sum = space.
append tmp_fc to it_cat.
tmp_fc-reptext_ddic = 'Posting date'.
tmp_fc-fieldname = 'budat'.
tmp_fc-tabname = 'migo_data'.
tmp_fc-outputlen = 20.
tmp_fc-do_sum = space.
append tmp_fc to it_cat.
tmp_fc-reptext_ddic = 'Doc type'.
tmp_fc-fieldname = 'blart'.
tmp_fc-tabname = 'migo_data'.
tmp_fc-outputlen = 10.
tmp_fc-do_sum = space.
append tmp_fc to it_cat.
tmp_fc-reptext_ddic = 'Fiscal year'.
tmp_fc-fieldname = 'gjahr'.
tmp_fc-tabname = 'migo_data'.
tmp_fc-outputlen = 10.
tmp_fc-do_sum = space.
append tmp_fc to it_cat.
LOOP AT it_cat ASSIGNING <fs_cat>.
CLEAR <fs_cat>-key.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_grid_title = 'Invoice selected'
is_layout = wa_lay
it_fieldcat = it_cat
it_sort = it_sortcat
TABLES
t_outtab = MIGO_DATA
EXCEPTIONS
program_error = 1
OTHERS = 2.When building your sort catalog, make sure to include the tabname.
wa_sort-spos = 1.
wa_sort-fieldname = 'BUKRS'.
<b> wa_sort-tabname = 'MIGO_DATA'.</b>
wa_sort-subtot = 'X'.
wa_sort-up = 'X'.
append wa_sort to it_sortcat.
wa_sort-spos = 2.
wa_sort-fieldname = 'BELNR'.
<b> wa_sort-tabname = 'MIGO_DATA'.</b>
wa_sort-subtot = 'X'.
wa_sort-up = 'X'.
append wa_sort to it_sortcat.
Please make sure to award points and mark your post as solved. Thanks.
REgards,
Rich HEilman
Message was edited by: Rich Heilman
Message was edited by: Rich Heilman -
Hi,
I have a report to display in ALV list display, It give a runtime error when i run the report ,
error message : in INCLUDE LKKBLF99 - Field symbol not assigned.
I am not usning any field symbols in my report, can anyone suggest what could be the problem.Hi,
While creating fieldcatalog table you should give the fieldname and the tabname in capital letters.
for eg.
fcat-fieldname = 'MATNR'.
regards,
Santosh Thorat. -
Runtime Error in ALV Totaling.
Dear Friends
i am getting run time error in ALV while pressing sum button.
my alv code as follows
FIELDCATALOG-FIELDNAME = 'DMBTR'.
FIELDCATALOG-SELTEXT_M = 'Amount'.
FIELDCATALOG-COL_POS = 1.
FIELDCATALOG-ref_fieldname = 'WAERS'.
FIELDCATALOG-DO_SUM = 'X'. "Display column total
FIELDCATALOG-ref_tabname = 'BKPF'.
FIELDCATALOG-DATATYPE = 'CURR'.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
I have tried all possibilities but did not get the solution...
if anything left let me know
thank you
Avirat PatelDear Ravi
Thank you .. i am able to trace out my problem
the problem with this code
FIELDCATALOG-FIELDNAME = 'AUGBL'.
FIELDCATALOG-SELTEXT_M = 'Clearing Doc.No'.
FIELDCATALOG-COL_POS = 1.
FIELDCATALOG-DO_SUM = 'X'. "Display column total
FIELDCATALOG-DATATYPE = 'CURR'.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
i am getting an error with this code
how can i able to display this field in alv column.?
- Avirat Patel
*SORRY FRIENDS I HAVE NOT DECLARED MENTIONED VARIABLE IN INTERNAL TABLE ITSELF SO THAT
I AM GETTING ERROR.*
problem has been resolved..
thank you.
Edited by: Corrtech on Dec 19, 2011 1:05 PM -
Runtime error in ALV interactive report
Hi all,
While clicking the cutomer no to get the order details am getting run time error. Your help will be rewarded.
REPORT Z_INTERACTIVE_ALV.
TYPE-POOLS : SLIS.
TABLES : KNA1.
TYPES : BEGIN OF TY_KNA1,
KUNNR TYPE KUNNR,
NAME1 TYPE NAME1,
ORT01 TYPE ORT01,
LAND1 TYPE LAND1,
END OF TY_KNA1.
TYPES: BEGIN OF TY_VBAK,
KUNNR TYPE KUNNR,
VBELN TYPE VBELN,
ERDAT TYPE ERDAT,
NETWR TYPE NETWR,
END OF TY_VBAK.
DATA : IT_KNA1 TYPE STANDARD TABLE OF TY_KNA1,
W_KNA1 LIKE LINE OF IT_KNA1,
IT_VBAK TYPE STANDARD TABLE OF TY_VBAK,
W_VBAK LIKE LINE OF IT_VBAK.
DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
W_FCAT TYPE SLIS_FIELDCAT_ALV.
DATA : IT_FCAT1 TYPE SLIS_T_FIELDCAT_ALV,
W_FCAT1 TYPE SLIS_FIELDCAT_ALV.
DATA : IT_EVENT TYPE SLIS_T_EVENT,
W_EVENT TYPE SLIS_ALV_EVENT.
W_EVENT-NAME = 'USER_COMMAND'.
W_EVENT-FORM = 'USER_COMMAND'.
APPEND W_EVENT TO IT_EVENT.
SELECT-OPTIONS : S_CUSTNO FOR KNA1-KUNNR.
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'KUNNR'.
W_FCAT-SELTEXT_M = 'CUSTOMERNO'.
APPEND w_fcat TO IT_FCAT.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'NAME1'.
W_FCAT-SELTEXT_M = 'CUSTOMERNAME'.
APPEND w_fcat TO IT_FCAT.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'ORT01'.
W_FCAT-SELTEXT_M = 'CUSTOMERCITY'.
APPEND w_fcat TO IT_FCAT.
W_FCAT-COL_POS = 4.
W_FCAT-FIELDNAME = 'LAND1'.
W_FCAT-SELTEXT_M = 'COUNTRY'.
APPEND w_fcat TO IT_FCAT.
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'KUNNR'.
W_FCAT-SELTEXT_M = 'CUSTOMERNO'.
APPEND w_fcat1 TO IT_FCAT1.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'VBELN'.
W_FCAT-SELTEXT_M = 'ORDERNO'.
APPEND w_fcat1 TO IT_FCAT1.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'ERDAT'.
W_FCAT-SELTEXT_M = 'ORDERDATE'.
APPEND w_fcat1 TO IT_FCAT1.
W_FCAT-COL_POS = 4.
W_FCAT-FIELDNAME = 'NETWR'.
W_FCAT-SELTEXT_M = 'ORDERVALUE'.
APPEND w_fcat1 TO IT_FCAT1.
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'KUNNR'.
W_FCAT-SELTEXT_M = 'CUSTOMERNO'.
APPEND w_fcat1 TO IT_FCAT1.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'VBELN'.
W_FCAT-SELTEXT_M = 'ORDERNO'.
APPEND w_fcat1 TO IT_FCAT1.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'ERDAT'.
W_FCAT-SELTEXT_M = 'ORDERDATE'.
APPEND w_fcat1 TO IT_FCAT1.
W_FCAT-COL_POS = 4.
W_FCAT-FIELDNAME = 'NETWR'.
W_FCAT-SELTEXT_M = 'ORDERVALUE'.
APPEND w_fcat1 TO IT_FCAT1.
*PERFORM user_command.
START-OF-SELECTION.
SELECT KUNNR NAME1 ORT01 LAND1 FROM KNA1 INTO TABLE IT_KNA1 WHERE KUNNR IN S_CUSTNO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'Z_INTERACTIVE_ALV'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = IT_FCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IT_EVENT
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_KNA1
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.
*& Form USER_COMM
text
--> p1 text
<-- p2 text
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
READ TABLE IT_KNA1 into w_kna1 INDEX RS_SELFIELD-TABINDEX.
SELECT KUNNR VBELN ERDAT NETWR FROM VBAK INTO TABLE IT_VBAK WHERE KUNNR = rs_selfield-value.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'Z_INTERACTIVE_ALV'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = IT_FCAT1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IT_EVENT
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_VBAK
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
JerryHi ,
Please check it. I think ur prod is solved.
REPORT z_interactive_alv.
TYPE-POOLS : slis.
TABLES : kna1.
TYPES : BEGIN OF ty_kna1,
kunnr TYPE kunnr,
name1 TYPE name1,
ort01 TYPE ort01,
land1 TYPE land1,
END OF ty_kna1.
TYPES: BEGIN OF ty_vbak,
kunnr TYPE kunnr,
vbeln TYPE vbeln,
erdat TYPE erdat,
netwr TYPE netwr,
END OF ty_vbak.
DATA : it_kna1 TYPE STANDARD TABLE OF ty_kna1,
w_kna1 LIKE LINE OF it_kna1,
it_vbak TYPE STANDARD TABLE OF ty_vbak,
w_vbak LIKE LINE OF it_vbak.
DATA : it_fcat TYPE slis_t_fieldcat_alv,
w_fcat TYPE slis_fieldcat_alv.
DATA : it_fcat1 TYPE slis_t_fieldcat_alv,
w_fcat1 TYPE slis_fieldcat_alv.
DATA : it_event TYPE slis_t_event,
w_event TYPE slis_alv_event.
w_event-name = 'USER_COMMAND'.
w_event-form = 'USER_COMMAND'.
APPEND w_event TO it_event.
SELECT-OPTIONS : s_custno FOR kna1-kunnr.
w_fcat-col_pos = 1.
w_fcat-fieldname = 'KUNNR'.
w_fcat-seltext_m = 'CUSTOMERNO'.
APPEND w_fcat TO it_fcat.
w_fcat-col_pos = 2.
w_fcat-fieldname = 'NAME1'.
w_fcat-seltext_m = 'CUSTOMERNAME'.
APPEND w_fcat TO it_fcat.
w_fcat-col_pos = 3.
w_fcat-fieldname = 'ORT01'.
w_fcat-seltext_m = 'CUSTOMERCITY'.
APPEND w_fcat TO it_fcat.
w_fcat-col_pos = 4.
w_fcat-fieldname = 'LAND1'.
w_fcat-seltext_m = 'COUNTRY'.
APPEND w_fcat TO it_fcat.
w_fcat-col_pos = 1.
w_fcat-fieldname = 'KUNNR'.
w_fcat-seltext_m = 'CUSTOMERNO'.
APPEND w_fcat1 TO it_fcat1.
w_fcat-col_pos = 2.
w_fcat-fieldname = 'VBELN'.
w_fcat-seltext_m = 'ORDERNO'.
APPEND w_fcat1 TO it_fcat1.
w_fcat-col_pos = 3.
w_fcat-fieldname = 'ERDAT'.
w_fcat-seltext_m = 'ORDERDATE'.
APPEND w_fcat1 TO it_fcat1.
w_fcat-col_pos = 4.
w_fcat-fieldname = 'NETWR'.
w_fcat-seltext_m = 'ORDERVALUE'.
APPEND w_fcat1 TO it_fcat1.
w_fcat-col_pos = 1.
w_fcat-fieldname = 'KUNNR'.
w_fcat-seltext_m = 'CUSTOMERNO'.
APPEND w_fcat1 TO it_fcat1.
w_fcat-col_pos = 2.
w_fcat-fieldname = 'VBELN'.
w_fcat-seltext_m = 'ORDERNO'.
APPEND w_fcat1 TO it_fcat1.
w_fcat-col_pos = 3.
w_fcat-fieldname = 'ERDAT'.
w_fcat-seltext_m = 'ORDERDATE'.
APPEND w_fcat1 TO it_fcat1.
w_fcat-col_pos = 4.
w_fcat-fieldname = 'NETWR'.
w_fcat-seltext_m = 'ORDERVALUE'.
APPEND w_fcat1 TO it_fcat1.
*PERFORM user_command.
START-OF-SELECTION.
SELECT kunnr name1 ort01 land1
FROM kna1
INTO TABLE it_kna1
WHERE
kunnr IN s_custno.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fcat[]
it_events = it_event
TABLES
t_outtab = it_kna1[]
EXCEPTIONS
program_error = 1
OTHERS = 2
IF sy-subrc <> 0.
ENDIF.
IF sy-subrc <> 0.
ENDIF.
**& Form USER_COMM
* text
* --> p1 text
* <-- p2 text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
READ TABLE it_kna1 INTO w_kna1 INDEX rs_selfield-tabindex.
SELECT kunnr vbeln erdat netwr FROM vbak INTO TABLE it_vbak WHERE
kunnr = rs_selfield-value.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fcat1
it_events = it_event
TABLES
t_outtab = it_vbak
EXCEPTIONS
program_error = 1
OTHERS = 2 .
IF sy-subrc <> 0.
ENDIF.
ENDFORM. "user_command -
Runtime Error while summing a column in ALV output
Dear All,
I have developed an ALV Report and the report is giving output without any flaws.
I have defined proper field catalog and displaying the results using REUSE_ALV_GRID function module.
Now the report is generating Runtime Error while the user selects a column and click the SUM icon.
The fields like Qty, or amounts are also theowing runtime error while summing up their column in the ALV output.
What might be the reason and how to resolve this issu?
Regards
PavanHi ,
I don't know how you have write down the code but follow the below coding example:
FOR TOTAL:
there is a property of fieldcatalog, that is do_sum.
USE COED LIKE:
PERFORM fieldcat USING:
'1' 'MATNR' 'I_MARD' 'MATERIAL NO' 'MARD' 'MATNR ' ' ',
'2' 'NETWR' 'I_MARD' 'PLANT' 'MARD' 'WERKS' ' ',
FORM fieldcat USING value(p_0029)
value(p_0030)
value(p_0031)
value(p_0032)
wa_fieldcat-col_pos = p_0029.
wa_fieldcat-fieldname = p_0030.
wa_fieldcat-tabname = p_0031.
wa_fieldcat-reptext = p_0032.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
ENDFORM. " FIELDCAT
in final output you will get the total of currency field.
FOR SUB TOTAL:
decleare: i_sort type standard table of slis_sortinfo_alv,
wa_sort type slis_t_sortinfo_alv.
wa_sort-spos = '1'.
wa_sort-fieldname = 'field1'.
wa_sort-subtot = 'X'.
append wa_tab to i_sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fieldcat
it_sort = i_sort
Hope this can solve your pbs.
If you need more inputs let me know.
Regards,
Tutun -
Runtime error while trying to execute custom F4 help in OOP ALV grid.
Dear All,
I am trying to add custom search help for one of my column in ALV grid. I'm using OOP ALV, when i click for search help for that column, the system shows runtime error like below.
I am new to OOP concept and tried to follow program BCALV_EDIT_03. But not getting this error occur. Please help me.
With regards.Hi,
In order to be able to provide a search help for a field in an ALV you must do the following things.
1) The field where F4 help need to be attached needs to be made editable.
2) Create an event handler class to handle the ONF4 event. You can refer the following code:
CLASS lcl_alv1_handler DEFINITION.
PUBLIC SECTION.
"Tohandle F4 helps
METHODS handle_f4 FOR EVENT onf4 OF cl_gui_alv_grid
IMPORTING e_fieldname e_fieldvalue es_row_no er_event_data
et_bad_cells e_display.
ENDCLASS.
CLASS lcl_alv1_handler IMPLEMENTATION.
METHOD handle_f4.
CASE e_fieldname.
WHEN 'LIFNR'. "Set F4 for courier vendor
SELECT lifnr name1 FROM lfa1 INTO TABLE lt_lifnr.
IF lt_lifnr IS NOT INITIAL.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'LIFNR'
window_title = 'Vendors'
value_org = 'S'
TABLES
value_tab = lt_lifnr
return_tab = lt_return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc = 0.
READ TABLE gt_final INTO wa_final_t INDEX es_row_no-row_id.
IF sy-subrc = 0.
READ TABLE lt_return INTO wa_return INDEX 1.
IF sy-subrc = 0.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_return-fieldval
IMPORTING
output = lv_lifnr.
wa_final_t-lifnr = lv_lifnr.
MODIFY gt_final FROM wa_final_t INDEX es_row_no-row_id.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDCASE.
CALL METHOD o_alv->refresh_table_display.
ENDMETHOD.
ENDCLASS.
In the above method, GT_FINAL-LIFNR is being overwritten by the LIFNR you had selected from F4 help. So we will call the refresh_table_display after it to see the result in the ALV.
3) After creating the ALV object, add the fields to which the F4 has to be added. For this you
need to declare an internal table based on lvc_t_f4. Use the following code. Here O_ALV is my ALV object.:
CREATE OBJECT o_container
EXPORTING
container_name = 'CUSTCON'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT o_alv
EXPORTING
i_parent = o_container
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR : gt_f4, wa_f4.
wa_f4-fieldname = 'LIFNR'.
wa_f4-register = 'X'.
wa_f4-getbefore = space.
wa_f4-chngeafter = space.
APPEND wa_f4 TO gt_f4.
Here I am assigning F4 to LIFNR field in the final internal table that is displayed using ALV.
After this register this field for F4.
CALL METHOD o_alv->register_f4_for_fields
EXPORTING
it_f4 = gt_f4.
CREATE OBJECT o_alv_handler.
SET HANDLER : o_alv_handler->handle_f4 FOR o_alv1.
The object o_alv_handler is created based on the event handler class.
I hope that this will solve your issue. Revert if this is solved.
Rgards,
Abijith -
Runtime error while executing ALV
Hi all,
I have implemented an ALV in OOPS concept and whenevr I am executing it I am getting a runtime error as GET WA NOT ASSIGNED
Error analysis:
You attempted to access an unassigned field symbol
(data segment 32821).
This error may occur if
- You address a typed field symbol before it has been set with
ASSIGN
- You address a field symbol that pointed to the line of an
internal table that was deleted
- You address a field symbol that was previously reset using
UNASSIGN or that pointed to a local field that no
longer exists
- You address a global function interface, although the
respective function module is not active - that is, is
not in the list of active calls. The list of active calls
can be taken from this short dump.
Trigger Location of Runtime Error
Program SAPLSLVC
Include LSLVCF36
Row 3.231
Module type (FORM)
Module Name FILL_DATA_TABLE
3201 alv_style_align_center_top.
3202 endif.
3203
3204 append ls_lvc_data to ct_lvc_data.
3205 endif.
3206
3207 ************************************
3208 * Column per Fieldcat Entry
3209 ************************************
3210 loop at it_fcat_local assigning <ls_fcat>.
3211 clear: ls_lvc_data-href_hndl,
3212 ls_lvc_data-drdn_hndl,
3213 ls_lvc_data-style,
3214 ls_lvc_data-style2,
3215 ls_lvc_data-style3,
3216 ls_lvc_data-style4,
3217 ls_lvc_data-maxlen.
3218
3219 clear: lt_color_lvc, lt_color_slis.
3220
3221 add 1 to ls_lvc_data-col_pos.
3222
3223 if not <ls_fcat>-indx_field is initial.
3224 assign component <ls_fcat>-indx_field
3225 of structure <ls_data> to <l_field_value>.
3226 else.
3227 assign component <ls_fcat>-fieldname
3228 of structure <ls_data> to <l_field_value>.
3229 endif.
3230
>>>> macro_cell_data_get
3232 <ls_fcat>
3233 <ls_data>
3234 <l_field_value>
3235 ls_lvc_data-value.
3236
3237 *>>> new API
3238 if ir_salv_adapter is bound.
3239 clear ls_lvc_data-style.
3240
3241 * color
3242 if g_gui_type ne 1.
3243 if <ls_fcat>-key eq abap_true.
3244 ls_lvc_data-style = alv_style_color_int_key.
3245 elseif l_style_color is initial
3246 and ( <ls_fcat>-emphasize is initial or
3247 <ls_fcat>-emphasize = '$' ).
3248 if <ls_stin>-counter is initial.
3249 ls_lvc_data-style = alv_style_color_normal.
3250 else.
Please help me to sort out this issueFORM s_build_fldctlg .
v_repid = sy-repid.
DATA lw_fldctlg TYPE lvc_s_fcat.
REFRESH i_fldctlg[].
v_cpos = 0.
* Column 1
lw_fldctlg-col_pos = v_cpos.
lw_fldctlg-row_pos = c_1.
lw_fldctlg-ref_table = 'I_OUTPUT'.
lw_fldctlg-fieldname = c_unlpt.
lw_fldctlg-coltext = 'Unloading Point'. "Unloading Point
APPEND lw_fldctlg TO i_fldctlg.
CLEAR lw_fldctlg.
* Column 2
v_cpos = v_cpos + 1.
lw_fldctlg-col_pos = v_cpos.
lw_fldctlg-row_pos = c_1.
lw_fldctlg-ref_table = 'I_OUTPUT'.
lw_fldctlg-fieldname = c_vdrloc. "Vendor Location
lw_fldctlg-coltext = text-003.
APPEND lw_fldctlg TO i_fldctlg.
CLEAR lw_fldctlg.
* Column 3
v_cpos = v_cpos + 1.
lw_fldctlg-col_pos = v_cpos.
lw_fldctlg-row_pos = c_1.
lw_fldctlg-ref_table = 'I_OUTPUT'.
lw_fldctlg-fieldname = c_nopkgs. "No of packages
lw_fldctlg-coltext = text-004.
APPEND lw_fldctlg TO i_fldctlg.
CLEAR lw_fldctlg.
* Column 4
v_cpos = v_cpos + 1.
lw_fldctlg-col_pos = v_cpos.
lw_fldctlg-row_pos = c_1.
lw_fldctlg-ref_table = 'I_OUTPUT'.
lw_fldctlg-fieldname = c_delnote. "Delivery Note
lw_fldctlg-coltext = text-005.
APPEND lw_fldctlg TO i_fldctlg.
CLEAR lw_fldctlg.
* Column 5
v_cpos = v_cpos + 1.
lw_fldctlg-col_pos = v_cpos.
lw_fldctlg-row_pos = c_1.
lw_fldctlg-ref_table = 'I_OUTPUT'.
lw_fldctlg-fieldname = c_reason. "Reason
lw_fldctlg-coltext = text-006.
APPEND lw_fldctlg TO i_fldctlg.
CLEAR lw_fldctlg.
* Column 6
v_cpos = v_cpos + 1.
lw_fldctlg-col_pos = v_cpos.
lw_fldctlg-row_pos = c_1.
lw_fldctlg-ref_table = 'I_OUTPUT'.
lw_fldctlg-fieldname = c_status.
lw_fldctlg-coltext = text-007.
APPEND lw_fldctlg TO i_fldctlg.
CLEAR lw_fldctlg.
ENDFORM. " S_BUILD_FLDCTLG
This is my code.
When i execute it without any values in my final table the ALV is getting displayed.
But when I put some data in the final table I am getting this error -
Runtime error in Downloading and printing ALV
Hi Gurus,
I have created a ALV with subtotal text and hotspot click event using OO ABAP.
When ever I am trying to download the ALV to Excel it's generating a runtime error, same is happening when
I am pressing the Print button in the ALV.
Please Help !!!!Hi avik2005uitbu,
in debugger, before or just when ALV display is called, check the internal tables for field catalog and the date to be displayed. From debugger, you can save the internal tables contents as local files (rigth-click mouse, save as local file or CTRL->F11 in classical debugger, Save as local file with rogth-click on internal table name in variables or table display, no shortcut ). After saving both as excel, have a look at the fieldnames in the internal table and in the field catalog. Additionally, you should check all other parameters as layout and sort for fieldnames not present in field catalog and display table.
After having done these steps, you will definitely know what is wrong.
Also, when in GRID display, point the mouse outside (right of or below) the table display area, SHIFT-DOUBLE-RIGTH-CLICK invokes the ALV consistency check.
Please just do it.
Regards,
Clemens -
Runtime Error : MOVE_TO_LIT_NOTALLOWED_NODATA after ALV execution
Hi experts
I'm facing this runtime error after execute an interface and show an ALV grid for data processed.
ShrtText
Assignment error: Overwriting a protected field.
What happened?
Error in ABAP application program.
The current ABAP program "SAPLKKBL" had to be terminated because one of the
statements could not be executed.
This is probably due to an error in the ABAP program.
Error analysis
The program tried to assign a new value to the field "<L_UNIT>" even though
it is protected against changes.
The following objects are protected:
- Character or numeric literals
- Constants (CONSTANTS)
- Parameters of the category IMPORTING REFERENCE for functions
and methods
- Untyped field symbols to which a field has not yet been assigned
using ASSIGN
- TABLES parameters if the corresponding actual parameter is protected
against changes
- USING reference parameters and CHANGING parameters for FORMs if
the actual parameter for this is protected against changes
- Field symbols if the field assigned using ASSIGN or ASSIGNING
is protected against changes
- External write accesses to READ-ONLY attributes
- Key components of lines in internal tables of the type HASHED or
SORTED TABLE
SORTED TABLE.
What I must check on ABAP code for fix it. When I debug I found that the totals(in Yellow) are of two lines. The first line displays with the total values of the respective columns, but the second line is blank. So During the debug it clears the value "lflg_show" which causes the short dump.
Pleaase help me with this.
Thanks in advance.Hi experts
I'm facing this runtime error after execute an interface and show an ALV grid for data processed.
ShrtText
Assignment error: Overwriting a protected field.
What happened?
Error in ABAP application program.
The current ABAP program "SAPLKKBL" had to be terminated because one of the
statements could not be executed.
This is probably due to an error in the ABAP program.
Error analysis
The program tried to assign a new value to the field "<L_UNIT>" even though
it is protected against changes.
The following objects are protected:
- Character or numeric literals
- Constants (CONSTANTS)
- Parameters of the category IMPORTING REFERENCE for functions
and methods
- Untyped field symbols to which a field has not yet been assigned
using ASSIGN
- TABLES parameters if the corresponding actual parameter is protected
against changes
- USING reference parameters and CHANGING parameters for FORMs if
the actual parameter for this is protected against changes
- Field symbols if the field assigned using ASSIGN or ASSIGNING
is protected against changes
- External write accesses to READ-ONLY attributes
- Key components of lines in internal tables of the type HASHED or
SORTED TABLE
SORTED TABLE.
What I must check on ABAP code for fix it. When I debug I found that the totals(in Yellow) are of two lines. The first line displays with the total values of the respective columns, but the second line is blank. So During the debug it clears the value "lflg_show" which causes the short dump.
Pleaase help me with this.
Thanks in advance. -
ALV: Runtime error when calling only few columns of tables in ALV rpt
Dear ABAP Gurus N Experts,
I am new for ABAP.
I am creating an ALV for fetching the data from ztable. It works fine, If I select all column than .
SELECT * FROM zshipment01 INTO TABLE gi_zshipment01.
But when I try to select only few column it gives an error. Runtime errors: DBIF_RSQL_INVALID_RSQL, Exception: CX_SY_OPEN_SQL_DB
SELECT container shipment_no bill_of_lad bl_date DATE_OF_PORT ARRIVAL_NO1 ED_TRUCKING
FROM zshipment01 INTO TABLE gi_zshipment01.
I am using following function:, which is called in program as PERFORM load_data_into_grid.
FORM load_data_into_grid.
SELECT * FROM zshipment01 INTO TABLE gi_zshipment01.
Load data into the grid and display them
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'zshipment01'
CHANGING it_outtab = gi_zshipment01.
ENDFORM. " load_data_into_grid
Early response will be highly appreciated.
With thanks,
DSC
Moderator Messge: Basic questions are not allowed. Search before you post.
Edited by: kishan P on Feb 29, 2012 2:22 PMHi Devendra,
Try to use "corresponding" statement.
SELECT field1 field1 etc FROM zshipment01 *INTO CORRESPONDING FIELD OF TABLE* gi_zshipment01.
Regards,
Dondi.
Points unassigned
Edited by: kishan P on Feb 29, 2012 2:22 PM -
Runtime Error - TABLE_FREE_IN_LOOP in editable ALV GRID
While modifying editable ALV Grid, (CL_GUI_ALV_GRID) I am getting an unexpected dump as follows -
"Runtime Error TABLE_FREE_IN_LOOP".
In a Editable ALV grid whenever new row is added using standard append row button, And while saving, i check for any initial values, in that case iam displaying a warning message. So after that when i try to modify the row, and press enter key, Iam getting this dump "TABLE_FREE_IN_LOOP".
Can you please help on this regard.
Thanks in advance..
Best regards,
Prasad.Hello Krishna
take a additional internal table which is exactly of same type of the internal table which you want to modify . try modifying the second internal table. and then proceed for db update(if required).
Regards,
Suvendu -
Getting runtime Error 'UC_OBJECTS_NOT_CHARLIKE' for ALV grid
Hi,
When I call method SET_TABLE_FOR_FIRST_DISPLAY of ALV I get runtime error 'UC_OBJECTS_NOT_CHARLIKE'.
Actually i have set in the fieldcatalog the field 'CHK' of internal table as checkbox.
wa_fcat-fieldname = 'CHK' .
wa_fcat-coltext = 'Clear' .
wa_fcat-seltext = 'Clear' .
wa_fcat-checkbox = 'X' .
wa_fcat-edit = 'X' .
APPEND wa_fcat to p_lt_fieldcatalog .
Field CHK is of type c.
when i dont set the field as checkbox, I stop getting the error.
Please find a solution.
regards,
auroRelevant parts of code are:
Data Declaration:
types: begin of tt_revenue_det,
chk type c,
budat like zefit0006-zefibudat,
racct_txt like skat-txt50,
amount like zefit0006-zefihsl,
pbar_txt like tgsbt-gtext,
sgtxt like zefit0006-zefisgtxt,
costcentertxt like cskt-ktext,
bar_txt like skat-txt50,
doctype like zefit0006-zefiblart,
ch_flag type c,
end of tt_revenue_det,
data: gt_revenue_det type table of tt_revenue_det.
FIELD CATALOG
*& Form set_fieldcatalog_rev_det
text
-->P_LT_FIELDCATALOG text
form set_fieldcatalog_rev_det using p_lt_fieldcatalog type lvc_t_fcat.
data:wa_fcat type lvc_s_fcat.
wa_fcat-fieldname = 'P_GT_REVENUE_DET-CHK' .
wa_fcat-coltext = 'Clear' .
wa_fcat-seltext = 'Clear' .
wa_fcat-checkbox = 'X' .
wa_fcat-edit = 'X' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'BUDAT' .
wa_fcat-coltext = 'Posting Date' .
wa_fcat-seltext = 'Posting Date' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'RACCT_TXT' .
wa_fcat-coltext = 'Account Item Text' .
wa_fcat-seltext = 'Account Item Text' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'AMOUNT' .
wa_fcat-coltext = 'Amount' .
wa_fcat-seltext = 'Amount' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'PBAR_TXT' .
wa_fcat-coltext = 'Partner Business Area' .
wa_fcat-seltext = 'Partner Business Area' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'SGTXT' .
wa_fcat-coltext = 'Item Text' .
wa_fcat-seltext = 'Item Text' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'COSTCENTERTXT' .
wa_fcat-coltext = 'Cost Center' .
wa_fcat-seltext = 'Cost Center' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'BAR_TXT' .
wa_fcat-coltext = 'Business Area' .
wa_fcat-seltext = 'Business Area' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'DOCTYPE' .
wa_fcat-coltext = 'Type' .
wa_fcat-seltext = 'Type' .
APPEND wa_fcat to p_lt_fieldcatalog .
wa_fcat-fieldname = 'CH_FLAG' .
wa_fcat-coltext = 'Split' .
wa_fcat-seltext = 'Split' .
APPEND wa_fcat to p_lt_fieldcatalog .
endform. " set_fieldcatalog_rev_det
CREATE ALV
*& Form create_alv_revenue_det
text
-->P_GT_REVENUE_DET text
form create_alv_revenue_det using p_gt_revenue_det.
ALV related data declaration
DATA: lf_layout TYPE lvc_s_layo, "alv layout
lt_fieldcatalog type table of lvc_s_fcat, "field catalog internal table
wa_fieldcatalog type lvc_s_fcat. "work area for field catalog
create alv only if container is initial
IF G_CUSTOM_CONTAINER_REV_DET IS INITIAL.
lf_layout-no_toolbar = 'X'. " no toolbar
lf_layout-sel_mode = 'B'.
populate field catalog
perform set_fieldcatalog_rev_det using lt_fieldcatalog.
create instance of container class
CREATE OBJECT G_CUSTOM_CONTAINER_REV_DET
EXPORTING CONTAINER_NAME = G_CONTAINER_REV2.
create instance of alv grid class
CREATE OBJECT GR_ALVGRID_REV_DET
EXPORTING I_PARENT = G_CUSTOM_CONTAINER_REV_DET.
call method to display table in alv grid by passing layout and fieldcatalog
CALL METHOD GR_ALVGRID_REV_DET->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
is_layout = lf_layout
CHANGING
IT_OUTTAB = p_gt_revenue_det
IT_FIELDCATALOG = lt_fieldcatalog.
ENDIF.
endform. " create_alv_revenue_det
Maybe you are looking for
-
Error assigning users to application Role in Obiee 11.1.1.7.0
Hello I installed Obiee 11.1.1.7.0 both on Windows and Linux platform and after that, I successfully set Active Directory integration. I have a problem assigning users to Application Role in EM. When I'm trying to search a user on Display name, the P
-
Just say no to iTunes 6.0.3
After installing 6.0.3 and downloading some mp3's to my ipod, I was shocked to see that all of my playlists in the ipod were gone. The playlists are still intact in iTunes. I'e enver had this castrophic of a problem with iTunes before. Has anyone els
-
Hi, How to use the 'Tab' key to open a lookup table, E.g. BP Code, Name? Alternatively, how to use the 'Tab' key to call a formatted search? I hope to follow the standard in SBO and do away the Shift-F2. I am using VB and 2004B. Your input will be ap
-
Logic Express 9.1.5 won't boot
I just bought a refurbished 27" iMag 3.4ghs i7 from Apple and picked up Logic Express. I installed it and then did the update for 9.1.5. It opened fine. I played around a bit and closed it. I opened it again and it worked. Closed it, came back a bit
-
Fans And Voume after FirmWare Upgrade
Hey there! I have two very positive pieces of information, some repeated: 1) The volume of my speakers and "line out" was weak at best prior to the FirmWare upgrade. Now, it is positively explosive! I mean, the volume control works just like I would