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

validate user input with the screen flow logic.

Former Member
0 Likes
1,003

Hello guys, im facing some troubles with the following code

field mara-matnr SELECT * 
                    from mara
                    into table itab_mara
                    where  matnr = mara-matnr
                    and  matnr = mara-matkl
                    WHENEVER NOT FOUND SEND ERRORMESSAGE 107
                               WITH  mara-matnr .

the editor doest recognize this code in PAI., is the same with VALUES clause.

what im doing wrong ? . thank you very mch.

Hello guys, im facing some troubles with the following code

field mara-matnr SELECT * 
                    from mara
                    into table itab_mara
                    where  matnr = mara-matnr
                    and  matnr = mara-matkl
                    WHENEVER NOT FOUND SEND ERRORMESSAGE 107
                               WITH  mara-matnr .

the editor doest recognize this code in PAI., is the same with VALUES clause.

what im doing wrong ? . thank you very mch.

6 REPLIES 6
Read only

Former Member
0 Likes
855

Hi,

Please check code in where condition. Is the condition is right?

field mara-matnr SELECT *

from mara

into table itab_mara

where matnr = mara-matnr

and matnr = mara-matkl

WHENEVER NOT FOUND SEND ERRORMESSAGE 107

WITH mara-matnr .

MATNR is comparing with MATNR and also MATKL.

When you are doing the valiation make sure that use the chain and endchain stamt.

PAI

CHAIN:

MODULE VALI_DATA.

END CHAIN.

Like above do the code.

Read only

Former Member
0 Likes
855

In PAI you have to write

chain.

field mara-matnr module check_material.
endchain.

now dbl click on the check_material it will ask for the program name just write the select query in the program.

module check_material input.
SELECT * 
                    from mara
                    into table itab_mara
                    where  matnr = mara-matnr
                    and  matnr = mara-matkl
                    WHENEVER NOT FOUND SEND ERRORMESSAGE 107
                               WITH  mara-matnr .

endmodule.

Regards

Shiba Prasad Dutta

Read only

Read only

Former Member
0 Likes
855

i guess im going to do it like you told me , however i think i could write the select in pbo directly

Read only

0 Likes
855

Hi,

It will not work in PBO module. Do as SHIBA write This is the only way to do it

Read only

TMNielsen
Contributor
0 Likes
855

Hi José

Actually the syntax works fine, but there are as already mentioned by Thiru the problem that you compare matnr wit matkl. That doesn't make sense.

A second problem is that the editor (even when you get the correct syntax) will paint some of the words in the select statement red as if some error still exists. Don't worry about this. The dynpro will generate ok and all will work.

Ex. of correct syntax:

FIELD MARA-MATNR SELECT * FROM  mara

            WHERE matnr = MARA-MATNR

            WHENEVER NOT FOUND SEND ERRORMESSAGE 221.

Finally you must make sure to have the messag-id addition to the program statement in top of your program. Like this:

REPORT ztest123 message-id M3.

Best regards

Thomas Madsen Nielsen