2008 Jan 11 12:33 PM
hi experts,
1. I have devloped one screen 0100 and diaplayed 4 fields from ztable in input/output format. i hv also created 2 buttons for inserting and deletion.
so when i give input for the fields and when i click insert the data is inserting into ztable properly. but when the same data again given as input it is modifying the data. so wht i want is when we give aleady existing data as input is shoud give message as 'DATA ALREADY EXITS IN ZTABLE ' and also it should dispaly options want to change data if i click YES it should CONTINUE modify existing data if no it should not modify the existing record.
2. Also the fields which i hv displayed are in input / output form so i want to make them as active and deactive according to the requiment. i want to keep one button on application tool bar when i click change the fields will be in input mode or else when i again click that it will show me in display mode. i hv seen some demo programes in abap docu but unable to understand it please any body can give me clear idea about this code.
report:demo_dynpro_tabcont_loop_at
when 'TOGGLE'.
loop at flights-cols into cols where index gt 2.
if cols-screen-input = '0'.
cols-screen-input = '1'.
elseif cols-screen-input = '1'.
cols-screen-input = '0'.
endif.
how can i use this one when i am using ztable fields displayed on screen.?
<b>points will be rewared</b>
regards,
priyanka reddy.
2008 Jan 11 3:19 PM
Hi Priyanka,
I worked on a project with similar requirement.
To check if the data entered is already present in the Z Table or not check this code:
Here, CREATE is the function code of my push button in the screen.This is similar to the INSERT button in your case.ZTM09_EKKO is the name of the Z table and the purchase order number EBELN is beoing checked.If the value is alreadypresent in the table,then sy-subrc value will be equal to 0 as the select querry has successfully retrieved EBELN from ZTM09_EKKO.
In the screen,I have given the name of the input/output field name same as the ztable field name i.e., ZTM09_EKKO-EBELN.
Hence if duplicate entry is enterd in the input/output field,then the error message is displayed.
And to change the data.You can use this code.
Th function modeul will display a pop-up window. In my case if i click on Yes,the data has to be saved in Ztable.If I click on No,The program should exit.If I click on Cancel,The popup window has to close and the data would remain in th fields of the screen.
You can code according to ypur requirement for YEs,No and Cancel buttons in the Pop-up.
DATA answer TYPE c.
case sy-ucomm.
when 'CREATE'.
SELECT SINGLE EBELN FROM ZTM09_EKKO INTO ITAB_P WHERE EBELN =
ZTM09_EKKO-EBELN.
IF SY-SUBRC EQ 0.
MESSAGE 'PURCHASE ORDER NUMBER ALREADY EXISTS' type 'I'.
CALL TRANSACTION 'ZCREATE09'.
***Call funtion to display popup asking for modify or mot*****
CALL FUNCTION 'C14A_POPUP_SAVE_WITH_CANCEL'
IMPORTING
e_answer = answer.
IF answer = 'N'.
***Leaving the program****
LEAVE PROGRAM.
ELSEIF answer = 'J'.
****Holding the data on the screen when YES is selected****
set hold data on.
ENDIF.
ENDIF.
For making the input/output fields active or deactive,
check this piece of code:
Here on clicking on the TOGGLE button,the screen will be looped and it will check the screen names.
IF any of the screen names i.e.s the input/output fields are in active modde(i.e., 1)then they are made inactive.If they are in inactive modee(i.e., 0)then they are made active.
case SY_UCOMM.
when 'TOGGLE'.
loop at screen.
if screen-input = '0'.
screen-input = '1'.
elseif screen-input = '1'.
screen-input = '0'.
endif.
endloop.
AS far as the code that you have put in the querry,
it also works the same way.
The only difference is that in the code that you provided,the fields are made active or inactive in the table control.
So the looping is at the table control.
cols is the name of the table control.
Revert if you have any other querries.
Reward if helpfull.
Regards,
Kashyap Ivaturi
hi experts,
1. I have devloped one screen 0100 and diaplayed 4 fields from ztable in input/output format. i hv also created 2 buttons for inserting and deletion.
so when i give input for the fields and when i click insert the data is inserting into ztable properly. but when the same data again given as input it is modifying the data. so wht i want is when we give aleady existing data as input is shoud give message as 'DATA ALREADY EXITS IN ZTABLE ' and also it should dispaly options want to change data if i click YES it should CONTINUE modify existing data if no it should not modify the existing record.
2. Also the fields which i hv displayed are in input / output form so i want to make them as active and deactive according to the requiment. i want to keep one button on application tool bar when i click change the fields will be in input mode or else when i again click that it will show me in display mode. i hv seen some demo programes in abap docu but unable to understand it please any body can give me clear idea about this code.
report:demo_dynpro_tabcont_loop_at
when 'TOGGLE'.
loop at flights-cols into cols where index gt 2.
if cols-screen-input = '0'.
cols-screen-input = '1'.
elseif cols-screen-input = '1'.
cols-screen-input = '0'.
endif.
how can i use this one when i am using ztable fields displayed on screen.?
<b>points will be rewared</b>
regards,
priyanka reddy.
2008 Jan 11 3:19 PM
Hi Priyanka,
I worked on a project with similar requirement.
To check if the data entered is already present in the Z Table or not check this code:
Here, CREATE is the function code of my push button in the screen.This is similar to the INSERT button in your case.ZTM09_EKKO is the name of the Z table and the purchase order number EBELN is beoing checked.If the value is alreadypresent in the table,then sy-subrc value will be equal to 0 as the select querry has successfully retrieved EBELN from ZTM09_EKKO.
In the screen,I have given the name of the input/output field name same as the ztable field name i.e., ZTM09_EKKO-EBELN.
Hence if duplicate entry is enterd in the input/output field,then the error message is displayed.
And to change the data.You can use this code.
Th function modeul will display a pop-up window. In my case if i click on Yes,the data has to be saved in Ztable.If I click on No,The program should exit.If I click on Cancel,The popup window has to close and the data would remain in th fields of the screen.
You can code according to ypur requirement for YEs,No and Cancel buttons in the Pop-up.
DATA answer TYPE c.
case sy-ucomm.
when 'CREATE'.
SELECT SINGLE EBELN FROM ZTM09_EKKO INTO ITAB_P WHERE EBELN =
ZTM09_EKKO-EBELN.
IF SY-SUBRC EQ 0.
MESSAGE 'PURCHASE ORDER NUMBER ALREADY EXISTS' type 'I'.
CALL TRANSACTION 'ZCREATE09'.
***Call funtion to display popup asking for modify or mot*****
CALL FUNCTION 'C14A_POPUP_SAVE_WITH_CANCEL'
IMPORTING
e_answer = answer.
IF answer = 'N'.
***Leaving the program****
LEAVE PROGRAM.
ELSEIF answer = 'J'.
****Holding the data on the screen when YES is selected****
set hold data on.
ENDIF.
ENDIF.
For making the input/output fields active or deactive,
check this piece of code:
Here on clicking on the TOGGLE button,the screen will be looped and it will check the screen names.
IF any of the screen names i.e.s the input/output fields are in active modde(i.e., 1)then they are made inactive.If they are in inactive modee(i.e., 0)then they are made active.
case SY_UCOMM.
when 'TOGGLE'.
loop at screen.
if screen-input = '0'.
screen-input = '1'.
elseif screen-input = '1'.
screen-input = '0'.
endif.
endloop.
AS far as the code that you have put in the querry,
it also works the same way.
The only difference is that in the code that you provided,the fields are made active or inactive in the table control.
So the looping is at the table control.
cols is the name of the table control.
Revert if you have any other querries.
Reward if helpfull.
Regards,
Kashyap Ivaturi
2008 Jan 12 4:29 AM
Hi Kashyap,
Thanx for ur early reply, i have small doubt when we click TOGGLE and when it gets loop at screen is it requied to give group name or screen name? or simply giving loop at screen works??
CALL FUNCTION 'C14A_POPUP_SAVE_WITH_CANCEL'
IMPORTING
e_answer = answer.
IF answer = 'N'.
***Leaving the program****
LEAVE PROGRAM.
ELSEIF answer = 'J'.
****Holding the data on the screen when YES is selected****
set hold data on.
ENDIF.
you hv given me this function module shall i give answer in importing parameter? wht is answer here is it variable or we can use anyother name?
thanx for ur reply ....
regards,
priyanka reddy
2008 Jan 12 7:00 AM
2008 Jan 12 12:35 PM
Hi Priyanka,
answer is the name of the variable which I have created.
You can give any name of your choice.
Thanks and Regards,
Kashyap