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

ok_code

Former Member
0 Kudos
633

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 ....

1 ACCEPTED SOLUTION
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Kudos
587

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

8 REPLIES 8
Read only

Former Member
0 Kudos
587

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>

Read only

Former Member
0 Kudos
587

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.

Read only

Former Member
0 Kudos
587

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.

Read only

Former Member
0 Kudos
587

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

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Kudos
588

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

Read only

former_member673464
Active Contributor
0 Kudos
587

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

Read only

Former Member
0 Kudos
587

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

Read only

Former Member
0 Kudos
587

Thanks its help full,

i have given points.

Jim,