Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with CHangeView Modificatio Event

Former Member
0 Likes
3,580

Hi,

i have a Problem with the activation of an Event Modification in a change view:

i do following steps:

-> se11,

-> table maintenanve generator,

-> Environment -> modification -> events

-> add new entry "01 add_user"

here is the first Problem:

every time i should the get the code, i need to create a new subroutine in a new include. its not possible the get the first include ~01.

so i need t make a new include again and again. at this moment i've deleted the generated code, a do the generation new.

In a further try, i wrote in a new include this code

form add_user.

break-point.

endform.

-> save, back to generator view

-> generated objekts -> change -> Expert Mode all selected - >Go!

now i got the following Message:

STOP Program /PREGO/SAPLV_CALCF could not be deleted

Message Text

Program /PREGO/SAPLV_CALCF could not be deleted

Technical Data:

Message Text

Program /PREGO/SAPLV_CALCF could not be deleted

Technical Data

Message type__________A (Cancel)
Message class_________SV (View Maintenance: Customize Messages)
Message number________609
Message variable 1____/PREGO/SAPLV_CALCF
Message variable 2____
Message variable 3____
Message variable 4____

Message Attributes

Level of detail_______
Problem class_________2 (Important)
Sort criterion________
Number________________                    1

when i try to generate a new view (maintenance generator), with separate selected points from the list.(change F7) the change will be generate positve, but it's doesn't work. the form will not called

could some help?

thank you very much,

bye

adalbert

1 ACCEPTED SOLUTION
Read only

former_member210770
Active Participant
0 Likes
3,541

Hi Adalbert,

Please follow below Procedure.

For demo purpose i have created 1 table containing 3 fields. EBELN, EBELP, MATNR (Po doc number, po line item number, Material Number).

No I am creating TMG of this table.

Now I am Creating Event 01 with and Pressing Editor Button which pop up a new screen .

I am creating New Include Name ->

Click -> Continue -> Continue .

Editor will be open . Write below code.

FORM BEFORE_SAVE.

ENDFORM.

This is most important part. You have to create Form Endform for the Form Routine name which you have assigned while creating Event. In our case it is BEFORE_SAVE.

Ones your code has been written , Save it and activate it. (Don't use check button, direct save and activate).

Go back and Press Save button for  your Event as below.

GO Back -> Go to SE80 -> Function Group -> Pass your Function group name which you have created while creating your TMG.

in our case it is ZTEST_STU.

Refer Below Snapshot.

Activate Whole Function Group . Remember in your routine write proper code . Don't write just break point. You can use global Variable to fulfill your validation.

Ones this will activate again go to SE11 -> Table -> Environment-> Event -> Click on Editor button ->change the code. Activate Function Group -> And Run Se16n.

Hope this will work.

Regards,

Sagar

Hi Adalbert,

Please follow below Procedure.

For demo purpose i have created 1 table containing 3 fields. EBELN, EBELP, MATNR (Po doc number, po line item number, Material Number).

No I am creating TMG of this table.

Now I am Creating Event 01 with and Pressing Editor Button which pop up a new screen .

I am creating New Include Name ->

Click -> Continue -> Continue .

Editor will be open . Write below code.

FORM BEFORE_SAVE.

ENDFORM.

This is most important part. You have to create Form Endform for the Form Routine name which you have assigned while creating Event. In our case it is BEFORE_SAVE.

Ones your code has been written , Save it and activate it. (Don't use check button, direct save and activate).

Go back and Press Save button for  your Event as below.

GO Back -> Go to SE80 -> Function Group -> Pass your Function group name which you have created while creating your TMG.

in our case it is ZTEST_STU.

Refer Below Snapshot.

Activate Whole Function Group . Remember in your routine write proper code . Don't write just break point. You can use global Variable to fulfill your validation.

Ones this will activate again go to SE11 -> Table -> Environment-> Event -> Click on Editor button ->change the code. Activate Function Group -> And Run Se16n.

Hope this will work.

Regards,

Sagar

9 REPLIES 9
Read only

former_member210770
Active Participant
0 Likes
3,542

Hi Adalbert,

Please follow below Procedure.

For demo purpose i have created 1 table containing 3 fields. EBELN, EBELP, MATNR (Po doc number, po line item number, Material Number).

No I am creating TMG of this table.

Now I am Creating Event 01 with and Pressing Editor Button which pop up a new screen .

I am creating New Include Name ->

Click -> Continue -> Continue .

Editor will be open . Write below code.

FORM BEFORE_SAVE.

ENDFORM.

This is most important part. You have to create Form Endform for the Form Routine name which you have assigned while creating Event. In our case it is BEFORE_SAVE.

Ones your code has been written , Save it and activate it. (Don't use check button, direct save and activate).

Go back and Press Save button for  your Event as below.

GO Back -> Go to SE80 -> Function Group -> Pass your Function group name which you have created while creating your TMG.

in our case it is ZTEST_STU.

Refer Below Snapshot.

Activate Whole Function Group . Remember in your routine write proper code . Don't write just break point. You can use global Variable to fulfill your validation.

Ones this will activate again go to SE11 -> Table -> Environment-> Event -> Click on Editor button ->change the code. Activate Function Group -> And Run Se16n.

Hope this will work.

Regards,

Sagar

Read only

0 Likes
3,541

Hello Sagar,

thank you very much for you answer! It's work!

The Problem is the activation over F7 in table maintenance Dialog. Going your way it's work.

Could you say me, how it's possible change entries in the internal table total?

i try this:

LOOP AT total INTO lw_pergr.

    IF <action> = neuer_eintrag. "new Entry

      READ TABLE extract WITH KEY <vim_xtotal_key>.
      IF sy-subrc EQ 0.
        f_index = sy-tabix.
      ELSE.
        CLEAR f_index.
      ENDIF.

      lw_pergr-ernam = sy-uname.
      lw_pergr-erdat = sy-datum.

      MODIFY total FROM lw_pergr.
      <action> = neuer_eintrag.

      CHECK f_index GT 0.
      extract = total.
      MODIFY extract INDEX f_index.

    ENDIF.
  ENDLOOP.

  sy-subrc = 0.

but it doesn't work. i see, that the <active> flag will be cleared after the modify and at the end the new entry wouldn't added to the table.

i want to set the creator or changer of the line.

Read only

0 Likes
3,541

Hi Adalbert,

Can you please let me know what do you want to change in Internal Table. Means Your exact requirement . For Example, You want to validate the Value before it will save in database or anything else.

Just let me know i will give you the exact code.

Regards,

Sagar

Read only

0 Likes
3,541

Hi Sagar,

i've created a customizing table. when a user change something, the date and the user are saved in this table too. this fields are hidden and a user can't change it.

specs:

table: T_PERGR

view: V_PERGR

Fields:  aenam, aedat, ernam, erdat

if a new entry is saved, the creator (er*) fields must be filled with sy-uname and sy-datum.

if a existing entry is changed, the changer (ae*) fields must be filled with sy-uname and sy-datum.

what kind of entry it is is inside <action>.

when i change in debug-mode the ernam in table total, it works, but changing it in code (see post below) it doesn't work. i know, that my method to change total is wrong. but i don't know, how do it correct.

thank you, bye.

Read only

0 Likes
3,541

HI Adalbert,

You can direct copy paste below code. But Make sure you change the View name . Here in My case it is ZVTEST , and i have took only 1 field - UNAME.  You can add Date field as per your req.

One more thing when you are replacing ZVTEST with your Viewname don't remove _TOTAL. Use ZVTEST_TOTAL = yourviewname_TOTAL . Please replace at all places in below code and append date field.

DATA  : lv_index TYPE sy-tabix.               " Number of lines found
  CONSTANTS : lc_action_update TYPE c VALUE 'U',"Updating current record
          lc_action_create TYPE c VALUE 'N'."Creating new  record

* Clearing data objects.

  CLEAR : lv_index.

  LOOP AT zvtest_total.

IF <action> = lc_action_update.
*     Read the EXTRACT table with current record.
  READ TABLE extract WITH KEY zvtest_total.
  IF sy-subrc EQ 0.
    lv_index = sy-tabix.
  ELSE.
    CLEAR lv_index.
  ENDIF.

*   Populating updated fields to table.

  zvtest_total-uname = sy-uname."Last Update   name
*     Modify the current record in the table.
  MODIFY zvtest_total.
  CHECK lv_index GT 0.
  extract = zvtest_total.
  MODIFY extract INDEX lv_index.
*   Check the record created.
ELSEIF <action> = lc_action_create .
  READ TABLE extract WITH KEY zvtest_total.
  IF sy-subrc EQ 0.
    lv_index = sy-tabix.
  ELSE.
    CLEAR lv_index.
  ENDIF.
  zvtest_total-uname = sy-uname."Last Update   name
*     Modify the current record in the table.
  MODIFY zvtest_total.
  CHECK lv_index GT 0.
  extract = zvtest_total.
  MODIFY extract INDEX lv_index.
ELSEIF zvtest_total IS INITIAL.
  READ TABLE extract WITH KEY zvtest_total.
  IF sy-subrc EQ 0.
    lv_index = sy-tabix.
  ELSE.
    CLEAR lv_index.
  ENDIF.
*     Make desired changes to the line total.
  DELETE zvtest_total.
  CHECK lv_index GT 0.
  DELETE extract INDEX lv_index.
ENDIF.
CLEAR: lv_index.

  ENDLOOP.

Hope this will useful.

Regards,

Sagar

Read only

0 Likes
3,541

Hi Sagar,

thank you very much!!!

it works now.

my mistake was using the wrong total table. I don't understand, that it must be viewname_total.

thank you very much an i wish you a nice day.

regards

adalbert

Read only

0 Likes
3,541

Hi Adalbert,

Your most welcome. Hope it was helpful.

Cheers,

Sagar

Read only

0 Likes
3,541

Hi Sagar,

it was very helpful, you save my day

bye

Read only

Former Member
0 Likes
3,541

Hi Sagar,

how are you? I hope well.

I've a question to viewcluster. Do you know, how to make the same function (change creator and creationtime) in a viewcluster? you solution works in a view very fine.

I've tried, some times, but it doens't work. so i've read, that there are another variables and structures to change. could cou say me somthine about this?

thank you very much.

bye

Adalbert