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

help needed

Former Member
0 Likes
354

hi experts,

plz help me how to code for the following given description.

Number of months entered by user.

Validate number between 1 and 12. From this number, calculate the value “Count Months” where Count Months = 12 divided by # number of months entered by user. Example, 1 times bins counted per year results in Count Months = 12.

regards,

siri

2 REPLIES 2
Read only

Laxmana_Appana_
Active Contributor
0 Likes
324

Hi,

Check this code:

take user entered months into variable x_months.

then write this code to find count months:

if x_months between 1 and 12.
         x_CountMonths = 12 / x_months .
      else.
         message s000(xxx) 'Invalid month'.
      endif.

Regards

Appana

Read only

Former Member
0 Likes
324

sounds pretty simple...

something like

parameter: p_count type i.

if not p_count is initial.

if not ( p_count ge '1' and p_count le '12' ).

message 'Error'.

endif.

endif.

count_months = 12 / p_count.

(count_months will give u a value depending on the type u declare it with..if its type i, u ll get integer values, else decimal values )..

hope it helps..