2007 Dec 17 9:44 PM
Hello all,
I wrote this code for dynpro and there is an error .. Could you please see this and tell me where is it?
Code::
REPORT z_sm_test_dynpro .
DATA sy_ucomm_1 TYPE sy-ucomm.
DATA ok_code_1 type ok_code.
DATA ok_code_2 type ok_code.
*call the screen you want
CALL SCREEN 2000.
*event PBO starts
process before output.
*module for holding code of PBO
MODULE status_2000 OUTPUT.
Gui status is set: For details doubleclick 'STATUS_1'
SET PF-STATUS 'STATUS_1'.
*set the titlebar
SET TITLEBAR '100'.
*that is all for PBO
ENDMODULE.
*optional to tell this event below
PAI event starts.
process after input.
*module for holding code of PAI
MODULE user_command_2000.
ok_code_1 = ok_code.
*Question: why clear it?
CLEAR ok_code.
*do things based on input
CASE ok_code_1.
when 'BACK' or 'EXIT' or 'CANCEL'.
leave program.
when others.
output = save_ok.
endcase.
*thats all for PAI
ENDMODULE.
Thanks,
Charles.
2007 Dec 18 7:53 PM
Hello Charles
The flow logic of a standard screen looks like:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
The modules can be coded within your report again.
A typical USER_COMMAND module looks like:
TRANSLATE gd_okcode TO UPPER CASE.
go_grid->check_changed_data( ).
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
PERFORM handle_changed_data.
PERFORM validate_output.
CALL METHOD go_grid->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
finished = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR: gd_okcode. " Define as TYPE sy-ucomm (I prefer TYPE ui_func).
At the end of the USER_COMMAND module we always clear the ok_code because we do not want to have a preset ok_code at the next display of the screen.
Regards,
Uwe
2007 Dec 17 9:52 PM
Well, it would sure help if you would tell us the error.
OK - I think I see. You have to put the PAI and the PBO statments in the screen, not the report. If you just double click on the screen number, you will be able to do this.
Rob
Edited by: Rob Burbank on Dec 17, 2007 4:57 PM
2007 Dec 17 10:03 PM
Hi,
the only error I found is this...
the type OK_CODE does not exist in your program. you will need to declare OK_CODE in the screen first.
use the following declaration in ur program
data: ok_code_1 type sy-ucomm,
ok_code type sy-ucomm.
in PAI.
ok_code_1 = ok_code.
case ok_code_1.
-
-
endcase.
Note: OK_CODE should be declared inthe screen element list.
It would be more clear if you could mail the details of the error.
Regards,
Vamsi.
2007 Dec 17 11:20 PM
copy and paste the fo.. code in se38.
DATA sy_ucomm_1 TYPE sy-ucomm.
DATA ok_code_1 type ok_code.
DATA ok_code_2 type ok_code.
*call the screen you want
CALL SCREEN 2000.
*event PBO starts
*process before output.
*module for holding code of PBO
MODULE status_2000 OUTPUT.
*Gui status is set: For details doubleclick 'STATUS_1'
SET PF-STATUS 'STATUS_1'.
*set the titlebar
SET TITLEBAR '100'.
*that is all for PBO
ENDMODULE.
*optional to tell this event below
*PAI event starts.
*process after input.
*module for holding code of PAI
MODULE user_command_2000.
ok_code_1 = sy-ucomm.
*Question: why clear it?
*CLEAR ok_code.
*do things based on input
CASE ok_code_1.
when 'BACK' or 'EXIT' or 'CANCEL'.
leave program.
when others.
*output = save_ok.
endcase.
*thats all for PAI
ENDMODULE.
after this double click on screen 2000. and uncomment modules, active it.
and again come back to se38 and double click on pf_status, set req. tools there and activate it.
2007 Dec 18 5:02 AM
hi,
do this..
DATA sy_ucomm_1 TYPE sy-ucomm.
DATA ok_code_1 type sy-ucomm.
DATA ok_code_2 type sy-ucomm.
u get error because ok_code is not an abap dictionary type..
2007 Dec 18 7:35 PM
Hello all,
I have this ques.. Kamini above said that the element OK_code is not a data dictionary type so you cannot define variable of this type. But it is an element in the dictionary, so it should work.. eg MATNR is an element but still the code below works:
*code::
REPORT z_test1.
DATA a type MATNR.
a = '2242'.
WRITE: 'a holds', a.
Thanks,
Charles.
2007 Dec 18 7:45 PM
Hi Charles,
Here u r declaring A type matnr.
Matnr is a data element which is type CHAR with length 18.
so ur code is same as A type C.and ur moving 2242 into A.
after that u r printing.
I think u got my point.
Naveen.
2007 Dec 18 7:53 PM
Hello Charles
The flow logic of a standard screen looks like:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
The modules can be coded within your report again.
A typical USER_COMMAND module looks like:
TRANSLATE gd_okcode TO UPPER CASE.
go_grid->check_changed_data( ).
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
PERFORM handle_changed_data.
PERFORM validate_output.
CALL METHOD go_grid->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
finished = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR: gd_okcode. " Define as TYPE sy-ucomm (I prefer TYPE ui_func).
At the end of the USER_COMMAND module we always clear the ok_code because we do not want to have a preset ok_code at the next display of the screen.
Regards,
Uwe
2007 Dec 18 9:10 PM
Hello,
Uwe, you are using gd_okcode and I used OK_CODE but the question is how do I define/declare this variable and where? If the right way is DATA ok_code TYPE sy-ucomm. then how will SAP know that this is the variable to be populated with the Function code from the screen?
One more thing.. Can we paste any screenshot in the posts here (eg to illustrate a question or answer)
Thanks,
Charles.
2007 Dec 18 9:16 PM
Hi,
Use this way
data : gd_okcode like sy-ucomm. "<<<<<<<<
gd_okcode = sy-ucomm. "<<<<<<<<
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
a®