2007 Oct 02 3:43 AM
hi,
i find difficulties in tracing an error in my program, everytime i click the a certain column of an alv table for me to know the totals and when i click the summation button it will dump and the runtime error that appears on screen is from the ABAP program. So i trace it and compare it to my program. The structures used in ABAP and in my program are the same...
here is the error:
assign component
<ls_fieldcat>-fieldname of structure rt_data of <g_field>.
if sy-subrc ne 0.
message x000(ok). " the error points in this message
endif.
here is my declaration:
TYPES:
BEGIN OF t_output,
ovkorg TYPE vbak-vkorg, "sales organization
ovtweg TYPE vbak-vtweg, "distribution channel
oauart TYPE vbak-auart, "order type
ovbeln TYPE vbak-vbeln, "sales order
okunnr TYPE vbak-kunnr, "sold-to party
oname1 TYPE kna1-name1, "sold-to name
obstnk TYPE vbak-bstnk, "cust. purch. order
oposnr TYPE vbap-posnr, "order item
omatnr TYPE vbap-matnr, "material
oarktx TYPE vbap-arktx, "material description
ospart TYPE vbap-spart, "division
oprodh TYPE vbap-prodh, "prod. hierarchy
ovtext TYPE t179t-vtext, "prod. hierarchy description
okwmeng TYPE vbap-kwmeng, "order qty.
oedatu TYPE vbep-edatu, "1st promised CSD
ovbeln2 TYPE likp-vbeln, "delivery note
okunnr2 TYPE likp-kunnr, "ship-to party
okunnr3 TYPE kna1-kunnr, "ship-to name
oposnr2 TYPE lips-posnr, "delivery item
olfimg TYPE lips-lfimg, "delivery qty.
owadat_ist TYPE likp-wadat_ist, "PGI date
ohit?(10) TYPE c, "hit?
END OF t_output.
DATA: i_output TYPE STANDARD TABLE OF t_output,
wa_layout TYPE lvc_s_layo,
wa_fcat TYPE lvc_s_fcat,
wa_print LIKE lvc_s_prnt,
wa_fieldcat TYPE lvc_t_fcat.
.
.
.
FORM f_catalog USING p_fname
p_fieldtext.
CLEAR wa_fcat.
wa_fcat-fieldname = p_fname.
wa_fcat-scrtext_l = p_fieldtext.
APPEND wa_fcat TO wa_fieldcat.
ENDFORM. "F_CATALOG
FORM f_alv_grid_display.
Create a container
IF g_container IS INITIAL.
CREATE OBJECT g_container
EXPORTING
container_name = text-036.
IF sy-subrc EQ 0.
create an instance of the ALV control
CREATE OBJECT g_grid
EXPORTING
i_parent = g_container.
ENDIF.
ENDIF.
display alv grid in screen 0100
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_variant = wa_variant
i_save = c_x
is_layout = wa_layout
is_print = wa_print
CHANGING
it_outtab = i_output
it_fieldcatalog = wa_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
do nothing.
ENDIF.
ENDFORM. "f_alv_grid_display
i hope u understand my declaration....
( as what I've understand in ALV is that, there is no need for me to code for a computation since it is already in the ALV and my co worker told me that if i click thatt button it will automatically compute and display the totals at the buttom of the table )
thnks,
BRYAN
hi,
i find difficulties in tracing an error in my program, everytime i click the a certain column of an alv table for me to know the totals and when i click the summation button it will dump and the runtime error that appears on screen is from the ABAP program. So i trace it and compare it to my program. The structures used in ABAP and in my program are the same...
here is the error:
assign component
<ls_fieldcat>-fieldname of structure rt_data of <g_field>.
if sy-subrc ne 0.
message x000(ok). " the error points in this message
endif.
here is my declaration:
TYPES:
BEGIN OF t_output,
ovkorg TYPE vbak-vkorg, "sales organization
ovtweg TYPE vbak-vtweg, "distribution channel
oauart TYPE vbak-auart, "order type
ovbeln TYPE vbak-vbeln, "sales order
okunnr TYPE vbak-kunnr, "sold-to party
oname1 TYPE kna1-name1, "sold-to name
obstnk TYPE vbak-bstnk, "cust. purch. order
oposnr TYPE vbap-posnr, "order item
omatnr TYPE vbap-matnr, "material
oarktx TYPE vbap-arktx, "material description
ospart TYPE vbap-spart, "division
oprodh TYPE vbap-prodh, "prod. hierarchy
ovtext TYPE t179t-vtext, "prod. hierarchy description
okwmeng TYPE vbap-kwmeng, "order qty.
oedatu TYPE vbep-edatu, "1st promised CSD
ovbeln2 TYPE likp-vbeln, "delivery note
okunnr2 TYPE likp-kunnr, "ship-to party
okunnr3 TYPE kna1-kunnr, "ship-to name
oposnr2 TYPE lips-posnr, "delivery item
olfimg TYPE lips-lfimg, "delivery qty.
owadat_ist TYPE likp-wadat_ist, "PGI date
ohit?(10) TYPE c, "hit?
END OF t_output.
DATA: i_output TYPE STANDARD TABLE OF t_output,
wa_layout TYPE lvc_s_layo,
wa_fcat TYPE lvc_s_fcat,
wa_print LIKE lvc_s_prnt,
wa_fieldcat TYPE lvc_t_fcat.
.
.
.
FORM f_catalog USING p_fname
p_fieldtext.
CLEAR wa_fcat.
wa_fcat-fieldname = p_fname.
wa_fcat-scrtext_l = p_fieldtext.
APPEND wa_fcat TO wa_fieldcat.
ENDFORM. "F_CATALOG
FORM f_alv_grid_display.
Create a container
IF g_container IS INITIAL.
CREATE OBJECT g_container
EXPORTING
container_name = text-036.
IF sy-subrc EQ 0.
create an instance of the ALV control
CREATE OBJECT g_grid
EXPORTING
i_parent = g_container.
ENDIF.
ENDIF.
display alv grid in screen 0100
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_variant = wa_variant
i_save = c_x
is_layout = wa_layout
is_print = wa_print
CHANGING
it_outtab = i_output
it_fieldcatalog = wa_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
do nothing.
ENDIF.
ENDFORM. "f_alv_grid_display
i hope u understand my declaration....
( as what I've understand in ALV is that, there is no need for me to code for a computation since it is already in the ALV and my co worker told me that if i click thatt button it will automatically compute and display the totals at the buttom of the table )
thnks,
BRYAN
2007 Oct 02 4:08 AM
Hello Bryan
It is important that all CHANGING parameter of method go_grid->set_table_for_first_display ( ) are <b>global </b>(and not local) variables of your report. Otherwise the report will dump as soon as you change the list (e.g. sorting).
For details please refer to my answers in threads
I think this requirement is met by your report. However, I guess that the ALV control may be unhappy with the naming of the last column (<b>OHIT?</b>). Try to replace or drop the special character (?) and see what happens.
Regards
Uwe
2007 Oct 02 4:10 AM
Hi,
Try passing the appropriate dataelement also for the corresponding quantity or the amount column in the field catalog internal table.
wa_fcat-fieldname = p_fname.
wa_fcat-scrtext_l = p_fieldtext.
wa_fcat-rollname = 'LFIMG'. " For delivery quantity..Similarly give for all columns
APPEND wa_fcat TO wa_fieldcat.
Thanks
Naren
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |