09-23-2012 8:12 AM
REPORT ZALV1111.
data : lv_vbeln type vbeln.
select-options so_vbeln for lv_vbeln.
data: o_ct type ref to cl_gui_custom_container,
o_g type ref to cl_gui_alv_grid.
types : begin of ty_vbak.
include structure zmyvbak.
types: rc(4) type c,
lights type c.
types end of ty_vbak.
data : lt_vbak type table of ty_vbak,
ls_vbak type ty_vbak.
data: lt_fcat type lvc_t_fcat with header line.
data: lt_layo type lvc_s_layo.
data: lt_exp type ui_functions,
ls_exp like line of lt_exp.
initialization.
so_vbeln-low = '4980'.
so_vbeln-high = '4995'.
append so_vbeln.
start-of-selection.
call screen 100.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ABC'.
if o_ct is initial.
CREATE OBJECT O_CT
EXPORTING
CONTAINER_NAME = 'CST'.
CREATE OBJECT O_G
EXPORTING
I_PARENT = o_ct.
perform getdata.
if lt_vbak[] is not initial.
perform fldcat.
perform layout.
perform excluding.
perform cl.
perform display.
else .
CALL METHOD O_G->REFRESH_TABLE_DISPLAY.
endif.
endif.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE USER_COMMAND_0100 INPUT.
case sy-ucomm.
when 'BACK'.
leave program.
endcase.
ENDMODULE. " USER_COMMAND_0100 INPUT
FORM getdata .
select vbeln erdat erzet ernam from vbak into table lt_vbak where vbeln in so_vbeln.
ENDFORM. " getdata
FORM display .
CALL METHOD O_G->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'ZMYVBAK'
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
IS_LAYOUT = lt_layo
* IS_PRINT =
* IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING = lt_exp
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
* IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = lt_vbak[]
IT_FIELDCATALOG = lt_fcat[].
* IT_SORT =
* IT_FILTER =
* EXCEPTIONS
* INVALID_PARAMETER_COMBINATION = 1
* PROGRAM_ERROR = 2
* TOO_MANY_LINES = 3
* others = 4
.
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
FORM fldcat .
lT_fcat-FIELDNAME = 'VBELN'.
lT_fcat-COL_POS = 1.
lT_fcat-COLTEXT = 'SALES DOCUMENT'.
lT_fcat-OUTPUTLEN = 10.
append lt_fcat.
clear lT_fcat.
lT_fcat-FIELDNAME = 'ERDAT'.
lT_fcat-COL_POS = 2.
lT_fcat-COLTEXT = ' DATE'.
lT_fcat-OUTPUTLEN = 12.
append lt_fcat.
clear lT_fcat.
lT_fcat-FIELDNAME = 'ERZET'.
lT_fcat-COL_POS = 3.
lT_fcat-COLTEXT = 'TIME'.
lT_fcat-OUTPUTLEN = 14.
append lt_fcat.
clear lT_fcat.
lT_fcat-FIELDNAME = 'ERNAM'.
lT_fcat-COL_POS = 4.
lT_fcat-COLTEXT = ' BY'.
lT_fcat-OUTPUTLEN = 16.
append lt_fcat.
ENDFORM. " fldcat
FORM layout .
clear lt_layo.
lt_layo-grid_title = 'Sales Documet Header Data'.
lt_layo-no_toolbar = 'X'.
lt_layo-info_fname = 'RC'.
lt_layo-excp_fname = 'LIGHTS'.
ENDFORM. " layout
FORM excluding .
ls_exp = cl_gui_alv_grid=>mc_fc_sum.
append ls_exp to lt_exp.
ls_exp = cl_gui_alv_grid=>mc_fc_find.
append ls_exp to lt_exp.
ls_exp = cl_gui_alv_grid=>mc_fc_detail.
append ls_exp to lt_exp.
ENDFORM. " excluding
FORM cl .
loop at lt_vbak into ls_vbak.
if ls_vbak-erdat = '19970121'.
ls_vbak-rc = 'c420'.
ls_vbak-lights = '3'.
else .
* ls_vbak-erdat = '19970121'.
ls_vbak-rc = 'c720'.
ls_vbak-lights = '1'.
endif.
endloop.
ENDFORM. " cl
09-23-2012 1:18 PM
You really need to be more specific with your question. The subject says something about field symbols not being assigned, but after looking at your code, you don't even have a field symbol defined, let alone assigned.
If you don't modify this post soon, the mods will lock it.
09-24-2012 5:20 AM
hi
when i am trying to execute te above program i am getting this run time error as
this error is generating when i execute my program
Field symbol has not yet been assigned.
Error in the ABAP Application Program
The current ABAP program "SAPLSLVC" had to be terminated because i
come across a statement that unfortunately cannot be executed.
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.
but i have not taken any field symbol
09-24-2012 7:23 AM
This message is raised by standard ALV as it try to interpret your data, so some field name should not be correct (layout, field catalog and other)
- check that the fields of the field catalog exist in the internal table (lowercase, typo, etc.)
- check that the fields mentioned in the layout (box, light name, etc.) also exist in the internal table
- if you are able to display the ALV, perform The Consistency Check
Regards,
Raymond
09-24-2012 10:33 AM
Hi Tej,
While going through the code, I found that the fields which are used in the ALV Layout i.e., (RC & LIGHTS) are not added to the Field Catalog. Since the field, which is not present in the Field Catalog, is addressed in the Layout Properties, the system is resulting in a Dump.
Create the Field Catalog entry for these two mentioned fields and rerun the Program. I hope your issue will get resolved.
Regards,
Chakra
09-24-2012 11:03 AM
Comment with * the line:
I_STRUCTURE_NAME = 'ZMYVBAK'
ZMYVBAK # lt_vbak[] ( it_vbak has 2 extra field -> RC and lights ).
See the program: BCALV_GRID_04
09-24-2012 11:46 AM
Check your fieldcatalog. You probably must have mistyped some field or missed some field.