abap alv 更改数据_动态内表生成的ALV,如何修改ALV后保存数据?

这篇博客探讨了在ABAP中如何处理ALV(List Viewer)动态内表的数据更改,并介绍了如何在用户修改ALV后保存这些数据。通过调用函数和方法,如'GET_GLOBALS_FROM_SLVC_FULLSCR'和'CHECK_CHANGED_DATA',博主展示了在ABAP应用中更新和保存ALV数据的步骤。在实现过程中遇到了未分配字段符号的错误,提示可能的原因包括未正确设置、删除或重置字段符号。
摘要由CSDN通过智能技术生成

Short text

Field symbol has not yet been assigned.

发生了什么?

Error in the ABAP Application Program

The current ABAP program "CL_GUI_ALV_GRID===============CP" had to be

terminated because it has

come across a statement that unfortunately cannot be executed.

错误分析

You attempted to access an unassigned field symbol

(data segment 32781).

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.

程序如下:

FORM listado .

g_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program       = g_repid

is_layout                = gs_layout

it_fieldcat              = gt_fieldcat[]

i_save                   = 'A'

it_events                = git_events[]

i_callback_pf_status_set = 'FRM_STATUS'                       "显示自定义toolbar

i_callback_user_command  = 'USER_COMMAND'                     "调用命令

it_sort                  = it_sort[]

TABLES

t_outtab                 =                                         “《-  动态内表

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.                    " LISTADO

FORM save_data .

DATA:  l_grid TYPE REF TO cl_gui_alv_grid.

*------------将ALV上修改的内容保存到内表---------------------------------*

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = l_grid.

CALL METHOD l_grid->check_changed_data.                                                  ”

ENDFORM.                    " SAVE_DATA

dat = sy-datum + n.

CLEAR gt_fieldcat.

gt_fieldcat-fieldname = dat.

gt_fieldcat-seltext_s  = dat.

gt_fieldcat-outputlen = 12.

gt_fieldcat-edit = 'X'.

gt_fieldcat-inttype  = t_tab1-psmng.

gt_fieldcat-seltext_m  = gt_fieldcat-seltext_s.

gt_fieldcat-seltext_l  = gt_fieldcat-seltext_s.

APPEND gt_fieldcat.

n = n + 1.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值