2013 Nov 19 6:14 PM
HI All,
I have requirement to create the entries and maintain at TMG level.
I have used to TMG event 05(Create new entry) to create new entry.
And i used TMG event 01(Before save to the database) to update the changes to database for existing entries.
Here i am facing with issue that data is not updating to the database. when i modify the existing the entries.
Please find below code i have written for the populating Profit center description and cost center description when user click on save button for the corresponding profit center and Cost center respectively.
Please help me if any of action i was missed in below code?
DATA : l_ktext TYPE ktext, " Profit center description
l_kostl_ktext TYPE ktext, " Cost center description
l_index TYPE sy-tabix. " Record number
break ibm_shga.
* Loop the internal table TOTAL to get the Changed records
LOOP AT total.
IF <action> = 'U'. " Action = 'U'
CLEAR zps_av.
MOVE total TO zps_av.
READ TABLE extract WITH KEY total.
IF sy-subrc EQ 0.
l_index = sy-tabix.
ELSE.
CLEAR l_index.
ENDIF.
* Get the Profit center description
SELECT ltext " Get the Profit center description
FROM cepct
INTO l_ktext UP TO 1 ROWS
WHERE prctr = zps_av-prctr
AND spras = sy-langu.
ENDSELECT.
IF sy-subrc EQ 0.
zps_av-prctr_desc = l_ktext.
ENDIF.
* Get the Cost center description
SELECT ktext " Cost center description
FROM cskt
INTO l_kostl_ktext UP TO 1 ROWS
WHERE kostl = zps_av-kostl
AND spras = sy-langu.
IF sy-subrc EQ 0.
zps_av-kostl_desc = l_kostl_ktext.
ENDIF.
ENDSELECT.
MOVE zps_av TO total.
MODIFY total.
CHECK l_index GT 0.
extract = total.
MODIFY extract INDEX l_index.
ENDIF.
ENDLOOP.
sy-subrc = 0.
ENDFORM. "POPULATE_DESC
HI All,
I have requirement to create the entries and maintain at TMG level.
I have used to TMG event 05(Create new entry) to create new entry.
And i used TMG event 01(Before save to the database) to update the changes to database for existing entries.
Here i am facing with issue that data is not updating to the database. when i modify the existing the entries.
Please find below code i have written for the populating Profit center description and cost center description when user click on save button for the corresponding profit center and Cost center respectively.
Please help me if any of action i was missed in below code?
DATA : l_ktext TYPE ktext, " Profit center description
l_kostl_ktext TYPE ktext, " Cost center description
l_index TYPE sy-tabix. " Record number
break ibm_shga.
* Loop the internal table TOTAL to get the Changed records
LOOP AT total.
IF <action> = 'U'. " Action = 'U'
CLEAR zps_av.
MOVE total TO zps_av.
READ TABLE extract WITH KEY total.
IF sy-subrc EQ 0.
l_index = sy-tabix.
ELSE.
CLEAR l_index.
ENDIF.
* Get the Profit center description
SELECT ltext " Get the Profit center description
FROM cepct
INTO l_ktext UP TO 1 ROWS
WHERE prctr = zps_av-prctr
AND spras = sy-langu.
ENDSELECT.
IF sy-subrc EQ 0.
zps_av-prctr_desc = l_ktext.
ENDIF.
* Get the Cost center description
SELECT ktext " Cost center description
FROM cskt
INTO l_kostl_ktext UP TO 1 ROWS
WHERE kostl = zps_av-kostl
AND spras = sy-langu.
IF sy-subrc EQ 0.
zps_av-kostl_desc = l_kostl_ktext.
ENDIF.
ENDSELECT.
MOVE zps_av TO total.
MODIFY total.
CHECK l_index GT 0.
extract = total.
MODIFY extract INDEX l_index.
ENDIF.
ENDLOOP.
sy-subrc = 0.
ENDFORM. "POPULATE_DESC
2013 Nov 20 11:58 AM
Hi Siva,
I am not getting the exact Req. Your req is to create the new entries in ztable for MATNR and PRCTR with the help of TMG events mentioned below and also you want to modify the existing entries and SAVE the same in ztable. But you are not able to do the same in case of modifying the entries in ztable but able to do in case of creating the new ones.
Have I understood correct?
BR
Sumeet
2013 Nov 20 12:11 PM
Hi Sumeet,
Thanks for the reply,
Your understand is correct.
I am not able to update the changes to data base to the existing entry using TMG events.
i had used TMG event 01 for the this .
2013 Nov 20 12:22 PM
Hi Siva
In order to update the description you have to update EXTRACT internal table then it will refelct.
Try changing EXTRACT table in debugging and check
Nabheet
2014 Feb 28 1:23 PM
In order to modify records in the maintenance screen of the TMG u have to write on chain request on the field which you are going to change. Then it will modify the record.
Find the below example code for the same.mentioned fields are going to get changed)
CHAIN.
FIELD <table name>-<field name> .
FIELD <table name>-<field name> .
FIELD <table name>-<field name> .
FIELD <table name>-<field name> .
FIELD <table name>-<field name> .
MODULE <module_name> ON CHAIN-REQUEST.
ENDCHAIN.
inside the module u can wirte ur code if u want to update any fields.
Message was edited by: Manoj Reddy
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |