We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

RE:[sap-dev] Save Button Not Working in ALV Grid

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Reply from TerryB on Jul 15 at 11:26 AM
Soumya,
ERNAM and ERSDA are fields designed to capture the created-by user and date for the material master record. This is "runtime" information, not "transactional" information, and probably should not be changed by any means. If you have been asked to use this field to store some other informaion, I would suggest that you suggest a different approach: append a field to table MARA, and use that field to save your data. With an appended field there is less of an issue with doing a direct database update (although you can also extend a BAPI to do the update).
Cheers,
TerryB

---------------Original Message---------------
From: Soumya
Sent: Monday, July 15, 2013 3:07 AM
Subject: Save Button Not Working in ALV Grid

*matnr ersda should be as i/p.
*after executing it should show fields from mara table as grid_display.
*there ernam field should be editable n have a custom save button in standard
* toolbar to save the changed ernam field to mara table(updating ernam).
*i can edit the field ernam but while saving the internal table is not refreshing
* and the edited value is not update in the mara table.HOW to do this?
*if after editing i m double clicking the cell n den saving it is updating.
*But i supposed to do bu simply editing the cell and click the save button.
*Help me.
*Thanks in advance.
My program:
REPORT ZDEMO10.
TYPE-POOLS :slis.
TABLES : mara,makt.
TYPES:BEGIN OF ty_mara,
matnr TYPE matnr,
ersda TYPE ersda,
ernam TYPE ernam,
mtart TYPE mtart,
matkl TYPE matkl,
END OF ty_mara.

DATA :fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat_mara TYPE slis_fieldcat_alv,
it_mara TYPE TABLE OF ty_mara,
wa_mara TYPE ty_mara,
wa_mara_str TYPE mara,
list_top TYPE TABLE OF slis_listheader,
wa_list_top TYPE slis_listheader.

SELECT-OPTIONS: s_matnr FOR mara-matnr,
s_ersda FOR mara-ersda.

START-OF-SELECTION.
SELECT matnr ersda ernam mtart matkl
FROM mara
INTO TABLE it_mara
WHERE matnr IN s_matnr
AND ersda IN s_ersda.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'IT_MARA'
i_structure_name = 'MARA'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_INCLNAME =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = fieldcat
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

LOOP AT fieldcat INTO wa_fieldcat_mara.
IF wa_fieldcat_mara-fieldname = 'ERNAM'.
wa_fieldcat_mara-edit = 'X'.
wa_fieldcat_mara-key = 'X'.
MODIFY fieldcat FROM wa_fieldcat_mara.
endif.

ENDLOOP.

wa_list_top-typ = 'H'.
wa_list_top-info = 'Grid Display of MARA Table'.
APPEND wa_list_top TO list_top.
CLEAR wa_list_top.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
i_grid_title = 'Editable field : Created By'
* I_GRID_SETTINGS =
* IS_LAYOUT =
it_fieldcat = fieldcat
* 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
* 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_mara
* 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.

*&

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
Copyright © 2013 Ziff Davis, Inc. and message author.
Ziff Davis, Inc. 28 E 28th Street New York, NY 10016
TerryB  

Senior SAP Developer
10 achievements
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Earn Recognition for Your Contributions at Toolbox for IT. Gain Points for Community Achievements

_.____.__

0 comments:

Post a Comment