‎2014 Dec 30 11:43 AM
Hi all,
i've a Problem with a modification of an VC.
My vc has 3 views, and after creating or changing an entry, in every one of this three, the creator or changer need to be saved.
the event time is befoer saving (04).
i have create a report with a form add_user.
REPORT vc_prc_exits.
INCLUDE lsvcmcod.
TYPES: BEGIN OF ty_prc .
INCLUDE STRUCTURE t_prc.
INCLUDE STRUCTURE vimflagtab.
TYPES: END OF ty_prc.
DATA: gs_prc TYPE ty_prc.
*&---------------------------------------------------------------------*
FORM add_user.
DATA:
lv_error_flag TYPE vcl_flag_type.
DATA:
lt_prc TYPE TABLE OF /prego/t_prc.
IF vcl_last_view EQ 'V_PRC'.
PERFORM vcl_set_table_access_for_obj
USING
vcl_last_view
CHANGING
lv_error_flag.
IF lv_error_flag IS INITIAL.
CLEAR gs_prc.
LOOP AT <vcl_extract> INTO gs_prc.
CASE gs_prc-mark.
WHEN 'M'.
EXIT.
WHEN 'U'. "Eintrag wurde modifiziert.
gs_prc-aedat = sy-datum.
gs_prc-aenam = sy-uname.
WHEN 'D'. "Eintrag wurde gelöscht
WHEN 'Y'. "Eintrag wurde zunächst geändert und anschließend gelöscht
WHEN 'X'. "Eintrag wurde neu angelegt und anschließend gelöscht
WHEN 'N'. "Eintrag wurde neu angelegt
gs_prc-erdat = sy-datum.
gs_prc-ernam = sy-uname.
WHEN OTHERS. "<Leerzeichen>: Eintrag ist unmodifiziert*
ENDCASE.
ENDLOOP.
ENDIF.
ENDIF.
the problem is, i don't know, how to change <vcl_total>, tha my added data will be written to the database.
i'm trying this:
* PERFORM edit_view_entry IN PROGRAM (...) (i've look for a programm, that i can used, but it doesn't work.
* TABLES <vcl_extract>
* <vcl_total>
* <vcl_header>
* <vcl_namtab>
* <vcl_dpl_sellist>
*USING gs_prc 'UPD'.
could someone help me, please?
thank you and good bye
adalbert
‎2014 Dec 30 8:04 PM
Hi,
you will get better and standardized results by
- set the 'record changes' flag in technical settings
- make sure that system parameter rec/client is set to ALL in your system.
Now you have standard change documents written that can be evaluated in the context menu of the view cluster tables.
SAP recommends to switch rec/client on in development and productive systems just to make sure any customizing changes are recorded and visible for revision tasks. I have seen a couple of systems where rec/client is set to ALL in all systems without any impact on performance. SAP customizing tables are all set to record changes. If you include a customer customizing table into the customizing, you will get a warning if it is not set to record changes.
Sorry, it is too simple and has a much wider impact than you want.
Regards,
Clemens
‎2015 Jan 02 11:51 AM
hi,
happy new Year!
thank your for your Answer, i've solved the problem as folowing:
TYPES: BEGIN OF ty_prc .
INCLUDE STRUCTURE v_prc.
INCLUDE STRUCTURE vimflagtab.
TYPES: END OF ty_prc.
DATA: gs_prc TYPE ty_prc.
DATA:
lv_error_flag TYPE vcl_flag_type,
header_wa LIKE vimdesc,
wa_prc LIKE v_prc.
PERFORM vcl_set_table_access_for_obj
USING
vcl_last_view
CHANGING
lv_error_flag.
IF lv_error_flag IS NOT INITIAL.
EXIT.
ENDIF.
READ TABLE <vcl_header> INDEX 1 INTO header_wa.
CASE vcl_last_view.
WHEN 'V_PRC'.
LOOP AT <vcl_extract> INTO gs_prc.
CASE gs_prc-action.
WHEN 'U'. "Eintrag wurde MODIFIZIERT
MOVE-CORRESPONDING gs_prc TO wa_prc.
wa_prc-aedat = sy-datum.
wa_prc-aenam = sy-uname.
PERFORM edit_view_entry IN PROGRAM (header_wa-fpoolname)
TABLES <vcl_extract>
<vcl_total>
<vcl_header>
<vcl_namtab>
<vcl_dpl_sellist>
USING wa_prc 'UPD'.
CLEAR wa_prc.
WHEN 'N'. "Eintrag wurde neu angelegt
MOVE-CORRESPONDING gs_prc TO wa_prc.
wa_prc-erdat = sy-datum.
wa_prc-ernam = sy-uname.
PERFORM edit_view_entry IN PROGRAM (header_wa-fpoolname)
TABLES <vcl_extract>
<vcl_total>
<vcl_header>
<vcl_namtab>
<vcl_dpl_sellist>
USING wa_prc 'UPD'.
CLEAR wa_prc.
ENDCASE.
ENDLOOP.
endcase.
regards
Adalbert