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

ERROR

Former Member
0 Likes
806

Hi.

i am getting error in screen printer its showing like this

Unable to interpret "OK_CODE " as a number .

am using CASE SY-UCOMM statement. what may be the problem

my code.

module CLEAR INPUT.

CASE SY-UCOMM.

WHEN 'DISPLAY'.

LOOP AT SCREEN.

IF Screen-name = 100.

Screen-input = 0.

ENDIF.

ENDLOOP.

ta = 1.

IF SY-UNAME = 'SKOKANE'.

CLEAR ITAB.

SELECT * FROM ZSETTLEMENT INTO ITAB WHERE SLNO = ITAB1-SLNO.

APPEND ITAB.

ENDSELECT.

ITAB1-ECOD = ITAB-ECOD.

APPEND ITAB1.

ENDIF.

ENDCASE.

endmodule. " CLEAR OUTPUT

1 ACCEPTED SOLUTION
Read only

varma_narayana
Active Contributor
0 Likes
785

Hi..

There are several errors in you code.

1) You can use LOOP AT SCREEN.. in a PAI module it works only in PBO module

2) IF SCREEN-NAME = 100

Here NAME stores the Screen field names , not the Screen number.

So you have to use

MODULE TEST OUTPUT. "this is called in PBO

LOOP AT SCREEN.

<b> IF SCREEN-NAME = 'MARA-MATNR'. </b> "Screen field

SCREEN-INPUT = 0.

<b> MODIFY SCREEN .</b> "This line is missing in ur code

ENDIF.

ENDLOOP.

Here you are getting the error for OK_CODE bcoz you are using

IF SCREEN-NAME = 100. "Without quotes

<b>Reward if Helpful.</b>

module CLEAR INPUT.

CASE SY-UCOMM.

WHEN 'DISPLAY'.

LOOP AT SCREEN.

IF Screen-name = 100.

Screen-input = 0.

ENDIF.

ENDLOOP.

ta = 1.

IF SY-UNAME = 'SKOKANE'.

CLEAR ITAB.

SELECT * FROM ZSETTLEMENT INTO ITAB WHERE SLNO = ITAB1-SLNO.

APPEND ITAB.

ENDSELECT.

ITAB1-ECOD = ITAB-ECOD.

APPEND ITAB1.

ENDIF.

ENDCASE.

endmodule. " CLEAR OUTPUT

5 REPLIES 5
Read only

Former Member
0 Likes
785

Hi ,

Enclose the screen name in quotes

Screen-name = ' '.

And u cant pass the screen name as number..give the name in capital letter.

Hope this would work.

Read only

Former Member
0 Likes
785

Hi

You have to pass the function code for the Sy-ucomm as a 4 digit code

WHEN 'DISPLAY'.

declare as DISP as function code for the display button and use and see

use WHEN 'DISP'.

and give the field name in caps and quotes instead of number like

screen-name = 'ITAB-KUNNR'.

<b>Reward points for useful Answers</b>

Regards

Anji

Message was edited by:

Anji Reddy Vangala

Read only

0 Likes
785

ITS giving same error no change.

if u have any working code please give me .

regards

prajwal

Read only

Former Member
0 Likes
785

Hi Prajwal,

If you declare a Variable as Character[ Data Type : C" means, you must give your data's with in the Quote.

Example :

Data : Name(10) Type C.

Name = ' prajwal'.

otherwise it shows error as like you get.

Thanks,

Reward If Helpful.

Read only

varma_narayana
Active Contributor
0 Likes
786

Hi..

There are several errors in you code.

1) You can use LOOP AT SCREEN.. in a PAI module it works only in PBO module

2) IF SCREEN-NAME = 100

Here NAME stores the Screen field names , not the Screen number.

So you have to use

MODULE TEST OUTPUT. "this is called in PBO

LOOP AT SCREEN.

<b> IF SCREEN-NAME = 'MARA-MATNR'. </b> "Screen field

SCREEN-INPUT = 0.

<b> MODIFY SCREEN .</b> "This line is missing in ur code

ENDIF.

ENDLOOP.

Here you are getting the error for OK_CODE bcoz you are using

IF SCREEN-NAME = 100. "Without quotes

<b>Reward if Helpful.</b>

module CLEAR INPUT.

CASE SY-UCOMM.

WHEN 'DISPLAY'.

LOOP AT SCREEN.

IF Screen-name = 100.

Screen-input = 0.

ENDIF.

ENDLOOP.

ta = 1.

IF SY-UNAME = 'SKOKANE'.

CLEAR ITAB.

SELECT * FROM ZSETTLEMENT INTO ITAB WHERE SLNO = ITAB1-SLNO.

APPEND ITAB.

ENDSELECT.

ITAB1-ECOD = ITAB-ECOD.

APPEND ITAB1.

ENDIF.

ENDCASE.

endmodule. " CLEAR OUTPUT