Skip to Content
0
Former Member
Sep 23, 2012 at 07:12 AM

field symbol has yet to be assigned for following code

253 Views

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