Application Development 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: 

Validation Code Required

Former Member
0 Kudos

Hi,

I have 2 flat files and 2 internal tables. flat file1 with 5 columns and another flat file2 with 9 columns.The first internal table has 5 fields and second internal table has 9 fileds.And i kept two radio buttons R1 and R2.when i select 1st radio button (R1) and select flat file1 it is uploaded into internal table (itab1) Properly.Similarly when i select R2 and select flat file2 it is uploaded into internal table (itab2) Properly.

Now,if i select Radio Button R1 and Flat file2 then it has to show Error.Similarly if i select Radi Button R2 and Flat file1 it has to show error.

How can i write Code for this One?.

Thanks in Advance

Regards,

Narasimha Reddy

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

You can upload data to string type internal table.And split the data based on the delimiter.While spliting data keep one extra field.For example,if you are uploading file1 with 5 columns.Split the data and move data to corresponding 5 variables and 6th data should be moved to 6th variable.

Now check if 6th variable is intial.If it is intial file is having only 5 columns and its ok.Same can be done in case of file2 also.

<REMOVED BY MODERATOR>

Regards

Shibin

Edited by: Alvaro Tejada Galindo on Mar 4, 2008 2:20 PM

9 REPLIES 9

Former Member
0 Kudos

Hi,

Have u kept parameter for the flat file..that is thru f4 help?? if u r using separate parameter for the flat file., the validation can be done..

Regards,

Arunsri

0 Kudos

Hi Anusri,

I kept F4 help for Flat file in Selection screen...

0 Kudos

Hi,

Does that have parameters,

then,

if r1 = 'X'.

if p1 is not initial.

do the process..

else.

raise error msg.

if r2 = 'X'.

if p2 is not initial.

do the process..

else.

raise error msg.

where r1 and r2 r the radio button and p1 and p2 r the parameters..

or,

in the below case only the coressponding parameters will be displayed for the particular radio button.

tables sscrfields.

parameters: p_r1 radiobutton group grp1 user-command us default 'X',

p_r2 radiobutton group grp1.

parameters: p_pfile type rlgrap-filename modif id bl1 ,

p_afile type rlgrap-filename modif id bl2.

at selection-screen output.

loop at screen.

case screen-group1.

when 'bl1'.

if p_r1 = 'X'.

screen-active = 1.

else.

screen-active = 0.

endif.

when 'bl2'.

if p_r1 = 'X'.

screen-active = 1.

else.

screen-active = 0.

endif.

endcase.

modify screen.

endloop.

Hope this solves the problem,

Regards,

Arunsri

0 Kudos

Hi Anusri,

I haven't given file name by default.i will select files through f4 help..

0 Kudos

Hi,

ya ok.. do u get the file in F4 help with parameters(input field) or just it pop ups a window to select a file.

if it is the second case, then u need to check which radio button is selected by if r1 = 'X', then do the remaining process.

Regards,

Arunsri

Edited by: Arunsri on Mar 4, 2008 12:40 PM

dhruv_shah3
Active Contributor
0 Kudos

Hi,

Simply check this combination in the IF.. ENDIF condition.

and put the error message there can use call transaction <tcode> between the IF and ENDIF statements.

HTH,

Regards,

Dhruv Shah

Former Member
0 Kudos

hi narasimaha reddy

hi if select radio button 1 write

perform gui_upload using table itab type i_tab1 .

else

perform gui_upload using table itab type i_tab2 .

this time it's didn't get error .

hi

medi kadapa na reddy kada andhuke adiga

regards

kk.

Former Member
0 Kudos

hi do like this,

if r1 = 'X' and f1 = 'X'.

write:/ 'something'.

elseif r1 = 'X' and f2 = 'X'.

write:/ 'something.

elseif r1 = 'X' and f2 = 'X'.

write:/ 'error'.

elseif r2 = 'X' and f1 = 'X'.

write:/ 'error'.

endif.

<REMOVED BY MODERATOR>

venkat.

Edited by: Alvaro Tejada Galindo on Mar 4, 2008 2:19 PM

Former Member
0 Kudos

Hi,

You can upload data to string type internal table.And split the data based on the delimiter.While spliting data keep one extra field.For example,if you are uploading file1 with 5 columns.Split the data and move data to corresponding 5 variables and 6th data should be moved to 6th variable.

Now check if 6th variable is intial.If it is intial file is having only 5 columns and its ok.Same can be done in case of file2 also.

<REMOVED BY MODERATOR>

Regards

Shibin

Edited by: Alvaro Tejada Galindo on Mar 4, 2008 2:20 PM