2007 Jul 25 12:46 PM
Dear all,
in my module pool program
i have table control ,
when i type some value in it and click on save button its not saving enter data in it.
but
when i type some value in table control and press Enter key and then i click on
save button then its saving.
why like this ?
****point is assurd for right answer ....
2007 Jul 25 12:51 PM
Hi,
<b>WHERE IS YOUR PAI module of SAVE? is it BEFORE LOOP AT itab ENDLOOP or AFTER?
It has to be after LOOP AT itab and ENDLOOP.</b>
When you Press ENTER, you will goto PAI event and there in your LOOP AT itab ENDLOOP is actually pushing the data from screen to itab.
And then when you click save the ITAB is saved.
WHere as when you directly click on SAVE, i think you save PAI module is defore the LOOP ENDLOOP.
SO put your PAI module of SAVE functionality after the LOOP ENDLOOP.
Regards,
Sesh
2007 Jul 25 12:48 PM
hi
clear th eok code before using it and assigning sy-ucom to it,
u are clearing ok code somewhere in the code thatswhy when u press enter ur save code is executing
degug ur code u will come to know where excatlu u have cleared ur ok-code
regards
ravish
<b>plz dont forget to reward points if useful</b>
2007 Jul 25 12:49 PM
this is because of the control level
contol level is different when cursor is the table control and is different when the cursor is at the screen level
see this program for eg
PROGRAM YTABLEDML .
TABLES : KNA1.
DATA : ITAB LIKE KNA1 OCCURS 0 WITH HEADER LINE.
CONTROLS : VCONTROL TYPE TABLEVIEW USING SCREEN '100'.
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'INSERT'.
MOVE KNA1 TO ITAB.
APPEND ITAB.
INSERT INTO KNA1 VALUES ITAB.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'INSERTED'.
ELSE.
MESSAGE E001(0) WITH 'NOTINSERTED'.
ENDIF.
WHEN 'UPDATE'.
MOVE KNA1 TO ITAB.
APPEND ITAB.
UPDATE KNA1 FROM TABLE ITAB.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'UPDATED'.
ELSE.
MESSAGE E001(0) WITH 'NOTUPDATED'.
ENDIF.
WHEN 'DELETE'.
MOVE KNA1 TO ITAB.
APPEND ITAB.
DELETE FROM KNA1 WHERE KUNNR = ITAB-KUNNR.
MESSAGE I000(0) WITH 'DELETED'.
IF SY-SUBRC = 0.
ELSE.
MESSAGE E001(0) WITH 'NOTDELETED'.
ENDIF.
ENDCASE.
ENDMODULE.
2007 Jul 25 12:50 PM
By hitting enter you are executing the PAI. When you hit the save button this will also execute the same event, however you may not be taking the data from the screen as you would if you hit enter.
I think you should debug both methods. There will be something different.
2007 Jul 25 12:51 PM
and one thing more when u debug ur code check if Function code of save button is getting into sy-ucomm and then to ok-code and before ur save opeartion executes check if func code of save button is there in OK-code
regards
ravish
2007 Jul 25 12:51 PM
Hi,
<b>WHERE IS YOUR PAI module of SAVE? is it BEFORE LOOP AT itab ENDLOOP or AFTER?
It has to be after LOOP AT itab and ENDLOOP.</b>
When you Press ENTER, you will goto PAI event and there in your LOOP AT itab ENDLOOP is actually pushing the data from screen to itab.
And then when you click save the ITAB is saved.
WHere as when you directly click on SAVE, i think you save PAI module is defore the LOOP ENDLOOP.
SO put your PAI module of SAVE functionality after the LOOP ENDLOOP.
Regards,
Sesh
2007 Jul 25 12:54 PM
hi...
you might have wrote the code for your save button before the module for updating the internal table so the data you are entering is not saved until you press ENTER and then SAVE it.
Write the module for save button after the loop and endloop statement in the PAI.
regards,
veeresh
2007 Jul 25 12:54 PM
After the Change are you modifying the Internal table. I think in your case you are doing the modifcation under 'ENTER' Action.
So once data is modified then you will not be having any problem.But if you don't press enter and Directly if you Press SAVE button then it will not be having the Saved content.
You need to change your PAI logic.
Include all the logic under SAVE action.
Regards
Vijay
2007 Jul 25 2:17 PM