‎2009 Apr 23 3:14 PM
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
‎2009 Apr 23 3:27 PM
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&
/: ENDPERFORMIn 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
‎2009 Apr 23 3:27 PM
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&
/: ENDPERFORMIn 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
‎2009 Apr 23 3:44 PM
Ravi,
Thanks, I shall implement and get back if I have any questions.
VG
‎2009 Apr 23 3:48 PM
You can use the FM MONTH_NAMES_GET too, or take month name directly from table T247.
Regards.
‎2009 Apr 23 5:33 PM
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