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

sapscript issue

Former Member
0 Likes
672

Hi,

I am dsiplaying the month name on the header of my sapscript form. I used the sapscript symbol '&NAMEOFMONTH&' to display it. Now, I need to display the next month's name.

For ex; generating the report using sapscript for current month april, i need to display the month name as 'May 2009' on the form?

How to enable the change in the form? I tried looking for a sapscript symbol for it. I did not find it.

Any ideas how to do it?

Thanks,

VG

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
646

I don't think there is a standard symbol available.

You have to write a PERFORM in your SUb routine.

YOu have to pass the current date .

In your FORM, you can return the next month name.

In Script:

/: DEFINE &NEXT_MONTH& = '          '
/: PERFORM NEXT_MONTH IN PROGRAM Z_SAPSCRIPT_PERFORMS
/: USING &MONTH&
/: CHANGING &NEXT_MONTH&
/: ENDPERFORM

In program Z_SAPSCRIPT_PERFORMS

FORM NEXT_MONTH TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

data v_current_month(2).
data v_next_month(10).
READ TABLE in_tab INDEX 1.
v_current_month = in_tab-value.
case v_current_month.
when '01'.
v_next_month = 'February'.
when '02'.
v_next_month = 'March'.
when '03'.
v_next_month = 'April'.
when '04'.
v_next_month = 'May'.
when '05'.
v_next_month = 'June'.
when '06'.
v_next_month = 'July'.
when '07'.
v_next_month = 'August'.
when '08'.
v_next_month = 'September'.
when '09'.
v_next_month = 'October'.
when '10'.
v_next_month = 'November'.
when '11'.
v_next_month = 'December'.
when '12'.
v_next_month = 'January'.
endcase.

out_tab-value = V_next_month.
MODIFY out_tab INDEX 1.

ENDFORM.

Regards,

Ravi

4 REPLIES 4
Read only

Former Member
0 Likes
647

I don't think there is a standard symbol available.

You have to write a PERFORM in your SUb routine.

YOu have to pass the current date .

In your FORM, you can return the next month name.

In Script:

/: DEFINE &NEXT_MONTH& = '          '
/: PERFORM NEXT_MONTH IN PROGRAM Z_SAPSCRIPT_PERFORMS
/: USING &MONTH&
/: CHANGING &NEXT_MONTH&
/: ENDPERFORM

In program Z_SAPSCRIPT_PERFORMS

FORM NEXT_MONTH TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

data v_current_month(2).
data v_next_month(10).
READ TABLE in_tab INDEX 1.
v_current_month = in_tab-value.
case v_current_month.
when '01'.
v_next_month = 'February'.
when '02'.
v_next_month = 'March'.
when '03'.
v_next_month = 'April'.
when '04'.
v_next_month = 'May'.
when '05'.
v_next_month = 'June'.
when '06'.
v_next_month = 'July'.
when '07'.
v_next_month = 'August'.
when '08'.
v_next_month = 'September'.
when '09'.
v_next_month = 'October'.
when '10'.
v_next_month = 'November'.
when '11'.
v_next_month = 'December'.
when '12'.
v_next_month = 'January'.
endcase.

out_tab-value = V_next_month.
MODIFY out_tab INDEX 1.

ENDFORM.

Regards,

Ravi

Read only

0 Likes
646

Ravi,

Thanks, I shall implement and get back if I have any questions.

VG

Read only

0 Likes
646

You can use the FM MONTH_NAMES_GET too, or take month name directly from table T247.

Regards.

Read only

0 Likes
646

Ravi,

I am having a problem with the parameters on the 'PERFORM' statement in sapscript. My 'PERFORM' statement in the program is PERFORM NEXT_MONTH. The program is fetching the current value. However in the sapscript while calling the PERFORM statement is causing the error 'TOO MANY PARAMETERS SPECIFIED WITH PERFORM'.

I shall try this statement.

PERFORM NEXT_MONTH IN PROGRAM ZSAP_PROGRAM CHANGING &NEXT_MONTH&

Does this look OK?

Thanks,

VG