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

include program

Former Member
0 Likes
509

hi gurus,

my reqirement is that, i hava an itab, on which numeric validations have to be performed,

, i want to place the validation code in an include program and

call it from this program when needed,

i thought of doing this way:

put all the validation code in an include program under one subroutine named validation,

and in the main program i would call this validation like

perform validation using itab.

but i want to get back the news whether the validation was successfull or not.

if yes , remaining part of program should go ahead or display

which all records failed the test.

can someone give me some hints on this.

thank you.

4 REPLIES 4
Read only

Former Member
0 Likes
481

Hi

U should delete the records fails the validation from ITAB and move them in a second new table (just like ITAB), in this way the rest of the program will elaborate only the good recordsand at the end you can print the data of the new (error) table in order to displya the failed records.

Max

Read only

Former Member
0 Likes
481

Hi Sanjana,

Do as below:


Data: message type standard table of bapiret2.
perform validation using itab tables message 

Form validation using itab tables lt_message structure bapiret2.
Do the validations and move the error/information/warning messages into message table.
Return.
EndForm.

In your main program read the message table and delete the records for which there is an error message.

process rest of the records.

Lokesh

pls. reward if the post helps.

Read only

Former Member
0 Likes
481

hi max and lokesh,

thanks for your replies,

i am also sorry for confusing you,

actually this is just a validation part of program,

so i had already done some code for validation , where in i store all the error data and dont delete it , infact we donnot need to, we just display what is wrong, so teh client goes back make all changes, where error occured, and resubmit it, so dont go ahead till everything is correct.

so i thought of putting all the validations and storing of error data i itab, and also displaying that with write stmt in include program itself, the only thing returningback is yes or no if it was successfull, while sending we send the whole itab.

if return value is no, we just quit the program., bcos already the display is done in include program,

am i thinking in a wrong way.

Read only

former_member191735
Active Contributor
0 Likes
481

perform validation in program (zxy) using subrc Itab. You can fill sy-subrc value or whatever you want in subrc based on the type. then you can check it in your main program to continue or stop the program.