Can't get perfrom to work in my include

Okay I have a basic question.  I try to do this code in my include and it keeps saying. Incorrec nesting before the Form, ths structure introduced by function must have end function.  I don't have any fuciton in the code.
CASE I_VNAM.
WHEN 'ZF_DIFDATEBEG'.
DATA:
          IMP_DATE_BEG LIKE SCAL-DATE,
          IMP_DATE_ENTERED LIKE SCAL-DATE,
          IMP_DATE_MONTHEND LIKE SCAL-DATE,
          EXP_DATE_BEG LIKE SCAL-FACDATE,
          EXP_DATE_ENTERED LIKE SCAL-FACDATE,
          EXP_START_DATE LIKE SCAL-FACDATE,
          EXP_DATE_MONTHEND LIKE SCAL-FACDATE,
          I_D_FACTCAL_ID LIKE SCAL-FCALID,
          WS_FACTORYDATE LIKE SCAL-FACDATE.
IF i_step = 2.
      READ TABLE i_t_var_range INTO loc_var_range
      WITH KEY vnam = '0P_CSDAT'.
      CONCATENATE loc_var_range-low0(4) loc_var_range-low4(2) '01' INTO  IMP_DATE_BEG.
      IMP_DATE_ENTERED  = loc_var_range-low.
      I_D_FACTCAL_ID = 'US'.
ENDIF.
PERFORM GET_LAPSED_DAYS.
ENDCASE.
*This function module is called to convert the 1st of the month to a factory date.
FORM GET_LAPSED_DAYS.
      CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
        EXPORTING
          DATE                         = IMP_DATE_BEG
          FACTORY_CALENDAR_ID          = I_D_FACTCAL_ID
        IMPORTING
          FACTORYDATE                  = EXP_DATE_BEG
        EXCEPTIONS
          CALENDAR_BUFFER_NOT_LOADABLE = 1
          CORRECT_OPTION_INVALID       = 2
          DATE_AFTER_RANGE             = 3
          DATE_BEFORE_RANGE            = 4
          DATE_INVALID                 = 5
          FACTORY_CALENDAR_NOT_FOUND   = 6
          OTHERS                       = 7.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
This function module is called to convert the date entered to a factory date.
      CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
        EXPORTING
          DATE                         = IMP_DATE_ENTERED
          FACTORY_CALENDAR_ID          = I_D_FACTCAL_ID
        IMPORTING
          FACTORYDATE                  = EXP_DATE_ENTERED
        EXCEPTIONS
          CALENDAR_BUFFER_NOT_LOADABLE = 1
          CORRECT_OPTION_INVALID       = 2
          DATE_AFTER_RANGE             = 3
          DATE_BEFORE_RANGE            = 4
          DATE_INVALID                 = 5
          FACTORY_CALENDAR_NOT_FOUND   = 6
          OTHERS                       = 7.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CLEAR L_S_Range.
      l_s_range-low = ( EXP_DATE_ENTERED - EXP_DATE_BEG ) + 1.    "difference between beginning of month and date entered.
      L_S_Range-sign = 'I'.
      L_S_Range-opt = 'EQ'.
      APPEND L_S_RANGE TO E_T_RANGE.
      w_var_range = EXP_DATE_ENTERED.
ENDFORM.

Maybe try putting this.....
*This function module is called to convert the 1st of the month to a factory date.
FORM GET_LAPSED_DAYS.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
DATE = IMP_DATE_BEG
FACTORY_CALENDAR_ID = I_D_FACTCAL_ID
IMPORTING
FACTORYDATE = EXP_DATE_BEG
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
CORRECT_OPTION_INVALID = 2
DATE_AFTER_RANGE = 3
DATE_BEFORE_RANGE = 4
DATE_INVALID = 5
FACTORY_CALENDAR_NOT_FOUND = 6
OTHERS = 7.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* This function module is called to convert the date entered to a factory date.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
DATE = IMP_DATE_ENTERED
FACTORY_CALENDAR_ID = I_D_FACTCAL_ID
IMPORTING
FACTORYDATE = EXP_DATE_ENTERED
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
CORRECT_OPTION_INVALID = 2
DATE_AFTER_RANGE = 3
DATE_BEFORE_RANGE = 4
DATE_INVALID = 5
FACTORY_CALENDAR_NOT_FOUND = 6
OTHERS = 7.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR L_S_Range.
l_s_range-low = ( EXP_DATE_ENTERED - EXP_DATE_BEG ) + 1. "difference between beginning of month and date entered.
L_S_Range-sign = 'I'.
L_S_Range-opt = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
w_var_range = EXP_DATE_ENTERED.
ENDFORM.
after the ENDFUNCTION statement.   If all of this code is in the source code of the function module itself, then you must move the FORMS outside of the FUNCTION...ENDFUNCTION coding.
Regards,
Rich Heilman

Similar Messages

Maybe you are looking for

  • Abap Query in Web Templates

    Hi Gurus, I am working on web reporting, we have a bunch of web queries that are working fine. And now my client wants to explore the possibility of displaying ABAP Queries on the web or embed them in Web templates along with the alreaday existing bw

  • Hide link to SAPguiDetails from completed task list in UWL

    Below is the code I have in XML file to hide links to SAPGuiDetails. <Action name="launchSAPDetails" handler="SAPMiniAppLauncher"> <Properties> <Property name="display_order_priority" value="uwlExcludeFromPreviewDetail"/> </Properties> </Action> This

  • Iphone 4 IOS 7 charging problem Please read, very stressed.

    Hey all, my Iphone 4 is acting really worrying after the update, my phone isn't charging. If it dies completely, I can plug it in and it will charge enough just to reach about 2,3% and then it will stop completely. However the two nights ago, I left

  • NI cDAQ 9172 with 3 USB 9233 for collecting impact hammer data

    Hello,       I am collecting data on a NI cDAQ 9172 with 3 USB 9233 cRIO. The software I am using is Sound and Vibration assistant. I have setup the necessary parameters and trigger. The impact hammer is connected on the USB 9233 module one and the r

  • 64bit version of firefox, i mean mine field has so many bugs

    MineField beta 4 (FireFox x64) has many bugs, i don't know, maybe it's so common, because in every update none of them were fixed, for example my bookmark not only doesn't work, but also it clean up my previous one each time i close and open mine fie