<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Error while saving new data in DB in OOPs  ALV in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316388#M4623</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am new to OOPS ALV and I am trying to save a data by using editable OOPS ALV. But every time I hit "SAVE" button an error is getting displayed. I have created a structure and an internal table for this. I am attaching a screen-shot. Please provide me the solution. &lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/4449-sap-oops-alv.jpg" /&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 21 Jan 2024 21:43:20 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2024-01-21T21:43:20Z</dc:date>
    <item>
      <title>Error while saving new data in DB in OOPs  ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316388#M4623</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am new to OOPS ALV and I am trying to save a data by using editable OOPS ALV. But every time I hit "SAVE" button an error is getting displayed. I have created a structure and an internal table for this. I am attaching a screen-shot. Please provide me the solution. &lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/4449-sap-oops-alv.jpg" /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jan 2024 21:43:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316388#M4623</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2024-01-21T21:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Error while saving new data in DB in OOPs  ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316389#M4624</link>
      <description>&lt;P&gt;It is better if you mentione any code , if it is a small program. &lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 05:27:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316389#M4624</guid>
      <dc:creator>former_member196331</dc:creator>
      <dc:date>2016-11-03T05:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: Error while saving new data in DB in OOPs  ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316390#M4625</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;REPORT zoops_alv.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;TABLES: ztmm_wfdoa,icon.
CLASS lcl_event_receiver DEFINITION DEFERRED.

DATA: "event_receiver1 TYPE REF TO lcl_event_receiver,
 i_selected_rows TYPE lvc_t_row, "Selected Rows
 w_selected_rows TYPE lvc_s_row.
DATA: i_modified TYPE STANDARD TABLE OF ztmm_wfdoa, "For getting modified rows
 w_modified TYPE ztmm_wfdoa.

TYPES: BEGIN OF ty_ztmm_wfdoa,
 apprtype TYPE ztmm_wfdoa-apprtype,
 uname TYPE ztmm_wfdoa-uname,
 firstname TYPE ztmm_wfdoa-firstname,
 lastname TYPE ztmm_wfdoa-lastname,
 doavalue TYPE ztmm_wfdoa-doavalue,
 zzwbs_doavalue TYPE ztmm_wfdoa-zzwbs_doavalue,
 END OF ty_ztmm_wfdoa.
DATA: it_ztmm_wfdoa TYPE STANDARD TABLE OF ty_ztmm_wfdoa,
 wa_ztmm_wfdoa TYPE ty_ztmm_wfdoa,
 alv_container TYPE REF TO cl_gui_custom_container,
 alv_grid TYPE REF TO cl_gui_alv_grid,
 ok_code TYPE sy-ucomm,
 it_fcat TYPE lvc_t_fcat,
 wa_fcat TYPE lvc_s_fcat,
 wa_layout TYPE lvc_s_layo,
 g_container TYPE scrfname VALUE 'CONTAINER'.
DATA: or_doc TYPE REF TO cl_gui_docking_container,
 event_receiver TYPE REF TO lcl_event_receiver.",

DATA : obj_lcl TYPE REF TO lcl_event_receiver.

DATA it_ztmm_wfdoa_old TYPE STANDARD TABLE OF ty_ztmm_wfdoa.
SELECTION-SCREEN BEGIN OF BLOCK b1.
SELECT-OPTIONS: s_appr FOR ztmm_wfdoa-apprtype NO-EXTENSION NO INTERVALS.
SELECT-OPTIONS: s_uname FOR ztmm_wfdoa-uname NO-EXTENSION NO INTERVALS.
SELECTION-SCREEN END OF BLOCK b1.

CLASS lcl_event_receiver DEFINITION.
ENDCLASS.
START-OF-SELECTION.
 CALL SCREEN 100.

CLASS lcl_event_receiver IMPLEMENTATION.

ENDCLASS.
*&amp;amp;---------------------------------------------------------------------*

*&amp;amp; Module STATUS_0100 OUTPUT

*&amp;amp;---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

MODULE status_0100 OUTPUT.

 SET PF-STATUS 'PF_STATUS'.
* SET TITLEBAR 'PF_STATUS'.
 PERFORM select_ztmm_wfdoa.
 CREATE OBJECT alv_container
 EXPORTING
 container_name = g_container.

 CREATE OBJECT alv_grid
 EXPORTING
 i_parent = alv_container.

 PERFORM get_fcat.
 PERFORM layout.
 PERFORM fcat.
 
ENDMODULE.
MODULE user_command_0100 INPUT.

DATA: lv_valid TYPE xfeld,

lv_refresh TYPE xfeld.
 WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.

 LEAVE PROGRAM.
 CALL METHOD alv_grid-&amp;gt;refresh_table_display
 EXCEPTIONS
 finished = 1
 OTHERS = 2.
 IF sy-subrc &amp;lt;&amp;gt; 0.
 ENDIF.

 WHEN 'SAVE'.
     PERFORM save_database.
 call method alv_grid-&amp;gt;check_changed_data
 IMPORTING
 e_valid = lv_valid
 CHANGING
 c_refresh = lv_refresh.
 CALL METHOD alv_grid-&amp;gt;refresh_table_display
 EXCEPTIONS
 finished = 1
 OTHERS = 2.
 ENDCASE.
ENDMODULE.
END-OF-SELECTION.
FORM get_fcat.

 REFRESH: it_fcat.
 CLEAR:wa_fcat.
 wa_fcat-reptext = 'Approval Type'.
 wa_fcat-fieldname = 'APPRTYPE'.
 wa_fcat-ref_table = 'IT_ZTMM_WFDOA'.
 wa_fcat-edit = 'X'.
 APPEND wa_fcat TO it_fcat.

 wa_fcat-reptext = 'User Name'.
 wa_fcat-fieldname = 'UNAME'.
 wa_fcat-ref_table = 'IT_ZTMM_WFDOA'.
 wa_fcat-edit = 'X'.
 APPEND wa_fcat TO it_fcat.

 wa_fcat-reptext = 'First name'.
 wa_fcat-fieldname = 'FIRSTNAME'.
 wa_fcat-ref_table = 'IT_ZTMM_WFDOA'.
 wa_fcat-edit = 'X'.
 APPEND wa_fcat TO it_fcat.

 wa_fcat-reptext = 'Last name'.
 wa_fcat-fieldname = 'LASTNAME'.
 wa_fcat-ref_table = 'IT_ZTMM_WFDOA'.
 wa_fcat-edit = 'X'.
 APPEND wa_fcat TO it_fcat.

 wa_fcat-reptext = 'Total value at time of release'.
 wa_fcat-fieldname = 'DOAVALUE'.
 wa_fcat-ref_table = 'IT_ZTMM_WFDOA'.
 wa_fcat-edit = 'X'.
 APPEND wa_fcat TO it_fcat.

 wa_fcat-reptext = 'WBS based DOA Value'.
 wa_fcat-fieldname = 'ZZWBS_DOAVALUE'.
 wa_fcat-ref_table = 'IT_ZTMM_WFDOA'.
 wa_fcat-edit = 'X'.
 APPEND wa_fcat TO it_fcat.
ENDFORM.
FORM fcat.
 CALL METHOD alv_grid-&amp;gt;set_table_for_first_display
 EXPORTING
 is_layout = wa_layout
 i_save = 'A'
* i_default = 'X'
 CHANGING
 it_outtab = it_ztmm_wfdoa[]
 it_fieldcatalog = it_fcat[]
 EXCEPTIONS
 invalid_parameter_combination = 1
 program_error = 2
 too_many_lines = 3
 OTHERS = 4.
ENDFORM.
FORM select_ztmm_wfdoa.
 SELECT apprtype
 uname
 firstname
 lastname
 doavalue
 zzwbs_doavalue
 FROM ztmm_wfdoa
 INTO TABLE it_ztmm_wfdoa
 WHERE apprtype IN s_appr AND
 uname IN s_uname.
 IF sy-subrc = 0.
 SORT it_ztmm_wfdoa AS TEXT BY lastname.
 ENDIF.
ENDFORM.

FORM layout.
 wa_layout-cwidth_opt = 'X'.
 wa_layout-zebra = 'X'.
 wa_layout-grid_title = 'Work Flow Authorization Report' .
ENDFORM.
FORM save_database .
*--- Getting the selected rows index
 CALL METHOD alv_grid-&amp;gt;get_selected_rows
 IMPORTING
 et_index_rows = i_selected_rows.
*--- Through the index capturing the values of selected rows
 LOOP AT i_selected_rows INTO w_selected_rows.
 READ TABLE it_ztmm_wfdoa INTO wa_ztmm_wfdoa INDEX w_selected_rows-index.
 IF sy-subrc EQ 0.
* MOVE-CORRESPONDING wa_ztmm_wfdoa TO w_modified.
 w_modified-mandt = sy-mandt.
 w_modified-apprtype = wa_ztmm_wfdoa-apprtype .
 w_modified-uname = wa_ztmm_wfdoa-uname .
 w_modified-firstname = wa_ztmm_wfdoa-firstname.
 w_modified-lastname = wa_ztmm_wfdoa-lastname .
 w_modified-doavalue = wa_ztmm_wfdoa-doavalue.
 w_modified-zzwbs_doavalue = wa_ztmm_wfdoa-zzwbs_doavalue.

 APPEND w_modified TO i_modified.
 ENDIF.
 ENDLOOP.

 MODIFY ztmm_wfdoa FROM TABLE i_modified.

* MESSAGE 'Value Saved' type 'S'.

ENDFORM.
ENDFORM. " SAVE_DATABASE&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Nov 2016 05:53:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316390#M4625</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-11-03T05:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: Error while saving new data in DB in OOPs  ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316391#M4626</link>
      <description>&lt;P&gt;Hi Sauptik,&lt;BR /&gt;&lt;BR /&gt;     Could you please check the table "ztmm_wfdoa" , is it having all the columns what you mention in the select query?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Krishna&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 06:39:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316391#M4626</guid>
      <dc:creator>krishna_k19</dc:creator>
      <dc:date>2016-11-03T06:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Error while saving new data in DB in OOPs  ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316392#M4627</link>
      <description>&lt;P&gt;Replace&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;wa_fcat-ref_table = 'IT_ZTMM_WFDOA'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;with &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;wa_fcat-ref_table = 'ZTMM_WFDOA'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Systeme expects a database table/structure ddic name not an local type. (reference at &lt;A href="https://help.sap.com/saphelp_erp60_sp/helpdata/en/52/5f060de02d11d2b47d006094192fe3/content.htm?frameset=/en/52/5f060de02d11d2b47d006094192fe3/frameset.htm&amp;amp;current_toc=/en/c5/3bd1369f2d280ee10000009b38f889/plain.htm&amp;amp;node_id=89"&gt;Generating the Field Catalog Manually&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Raymond&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 07:07:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316392#M4627</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2016-11-03T07:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Error while saving new data in DB in OOPs  ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316393#M4628</link>
      <description>&lt;P&gt;Hi Raymond,&lt;/P&gt;&lt;P&gt;I replaced it. The error is not coming anymore but then again the data is not getting saved. In debugger the sy-subrc is coming as 4 and the 'i_modified' is not getting filled.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sauptik&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 08:06:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316393#M4628</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-11-03T08:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: Error while saving new data in DB in OOPs  ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316394#M4629</link>
      <description>&lt;P&gt;Yes, it has all the columns.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sauptik&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 08:08:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316394#M4629</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-11-03T08:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Error while saving new data in DB in OOPs  ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316395#M4630</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;The issue has been solved. I just removed the '&lt;STRONG&gt;r&lt;/STRONG&gt;&lt;STRONG&gt;efresh_table_display&lt;/STRONG&gt;' method and interchanged the &lt;STRONG&gt;'perform save_database' &lt;/STRONG&gt;with '&lt;STRONG&gt;check_changed_data&lt;/STRONG&gt;' method.&lt;/P&gt;&lt;P&gt;Thanks everyone for your help.&lt;/P&gt;&lt;P&gt;Sauptik&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 09:56:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316395#M4630</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-11-03T09:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Error while saving new data in DB in OOPs  ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316396#M4631</link>
      <description>&lt;P&gt;Add a &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

CALL METHOD cl_gui_cfw=&amp;gt;flush.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After the get_selected_rows call.&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Raymond&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 06:27:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-while-saving-new-data-in-db-in-oops-alv/m-p/316396#M4631</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2016-11-04T06:27:27Z</dc:date>
    </item>
  </channel>
</rss>

