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

Select-options error.

Former Member
0 Likes
2,611

Hi Friends,

I am using a select-options statement for a field in my program like the one below.

P_MTH(6) FOR C, where C has been declared as six character field. the requirement is like the users would be inputting the fields in MMYYYY format for e.g.: if they give 022005 to 122005 they are able to get the desired output, but if they give the input like 122005 to 022006,the system throws an Error message like" Lowe limit is GT upper limitu201D. Please suggest how this can be corrected as it comes from SAP standard coding.

I tried even changing the data type for the field but it didn't work.

Thanks

Meenakshi

1 ACCEPTED SOLUTION
Read only

ravi_lanjewar
Contributor
0 Likes
2,102

Hi,

You can do one think

define following way


select-option:     sl_spmon for s031-spmon OBLIGATORY.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR sl_spmon-low.
   PERFORM monat_f4.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sl_spmon-high.
   PERFORM monat_f4.

Define the help


FORM  monat_f4.

  DATA: BEGIN OF mf_dynpfields OCCURS 1.
          INCLUDE STRUCTURE dynpread.
  DATA: END   OF mf_dynpfields.
  DATA: mf_returncode   LIKE sy-subrc,
        mf_monat        LIKE isellist-month,
        mf_hlp_repid    LIKE sy-repid.

  FIELD-SYMBOLS: <mf_feld>.

* Wert von Dynpro lesen
  GET CURSOR FIELD mf_dynpfields-fieldname.
  APPEND mf_dynpfields.
  mf_hlp_repid = sy-repid.
  DO 2 TIMES.
    CALL FUNCTION 'DYNP_VALUES_READ'
      EXPORTING
        dyname               = mf_hlp_repid
        dynumb               = sy-dynnr
      TABLES
        dynpfields           = mf_dynpfields
      EXCEPTIONS
        invalid_abapworkarea = 01
        invalid_dynprofield  = 02
        invalid_dynproname   = 03
        invalid_dynpronummer = 04
        invalid_request      = 05
        no_fielddescription  = 06
        undefind_error       = 07.
    IF sy-subrc = 3.
*     Aktuelles Dynpro ist Wertemengenbild
      mf_hlp_repid = 'SAPLALDB'.
    ELSE.
      READ TABLE mf_dynpfields INDEX 1.
*     Unterstriche durch Blanks ersetzen
      TRANSLATE mf_dynpfields-fieldvalue USING '_ '.
      EXIT.
    ENDIF.
  ENDDO.
  IF sy-subrc = 0.
*   Konvertierung ins interne Format
    CALL FUNCTION 'CONVERSION_EXIT_PERI_INPUT'
      EXPORTING
        input         = mf_dynpfields-fieldvalue
      IMPORTING
        output        = mf_monat
      EXCEPTIONS
        error_message = 1.
    IF mf_monat IS INITIAL.
*     Monat ist initial => Vorschlagswert aus akt. Datum ableiten
      mf_monat = sy-datlo(6).
    ENDIF.
    CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
      EXPORTING
        actual_month               = mf_monat
      IMPORTING
        selected_month             = mf_monat
        return_code                = mf_returncode
      EXCEPTIONS
        factory_calendar_not_found = 01
        holiday_calendar_not_found = 02
        month_not_found            = 03.
    IF sy-subrc = 0 AND mf_returncode = 0.
*     ASSIGN (MF_DYNPFIELDS-FIELDNAME) TO <MF_FELD>. 
*     <MF_FELD> = MF_MONAT.
      CALL FUNCTION 'CONVERSION_EXIT_PERI_OUTPUT'
        EXPORTING
          input  = mf_monat
        IMPORTING
          output = mf_dynpfields-fieldvalue.
      COLLECT mf_dynpfields.
      CALL FUNCTION 'DYNP_VALUES_UPDATE'
        EXPORTING
          dyname               = mf_hlp_repid
          dynumb               = sy-dynnr
        TABLES
          dynpfields           = mf_dynpfields
        EXCEPTIONS
          invalid_abapworkarea = 01
          invalid_dynprofield  = 02
          invalid_dynproname   = 03
          invalid_dynpronummer = 04
          invalid_request      = 05
          no_fielddescription  = 06
          undefind_error       = 07.           
    ENDIF.
  ENDIF.
ENDFORM.                                                    "MONAT_F4

It will display data in to mm.yyyy formate and process internally yyyymm formate.

Moderator message: please mention the source when copy/pasting code (here: RMCS0F0M)

Edited by: Thomas Zloch on May 31, 2011 11:18 AM

10 REPLIES 10
Read only

Former Member
0 Likes
2,102

Hi,

you can define as below declaration...

data var(6) type c.

select-options s_var for var.

Ram.

Read only

ThomasZloch
Active Contributor
0 Likes
2,102

Try referencing your selection field to a data element with a domain of type "ACCP" (accounting period), e.g. BUPER, and enter in YYYYMM format.

Thomas

Edited by: Thomas Zloch on May 30, 2011 11:06 AM

Read only

Former Member
0 Likes
2,102

hi,

try making it a numeric type field and check if it works

rgds

shivraj

Read only

Former Member
0 Likes
2,102

Hi Meenakshi,

As the Ascii value of 122005 is more than 022006 , hence system is giving such a error...

to sort this out , try giving data in slightly different format as 200512 t0 200602, as done in all standard fields for date..

otherwise you have to use two different fields to input data.

Regards,

Talwinder

Read only

0 Likes
2,102

Hi Please have a look below code.

DATA LF_MATH(6).

SELECT-OPTIONS : P_MTH FOR LF_MATH.

Thanks,

Sriram.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,102

Use or create a domain and dataelement of datatype ACCP (YYYYMM internally as wrote) but with a conversion exit so user can input MM.YYYY on screen. Look for domain of datatype ACCP and conversion exits PERKK or PERI.

REPORT zyyyymm.
DATA yyyymm TYPE POSTPER_KK.
SELECT-OPTIONS so FOR yyyymm.
BREAK-POINT.

Regards,

Raymond

Read only

koolspy_ultimate
Active Contributor
0 Likes
2,102

This message was moderated.

Read only

ravi_lanjewar
Contributor
0 Likes
2,103

Hi,

You can do one think

define following way


select-option:     sl_spmon for s031-spmon OBLIGATORY.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR sl_spmon-low.
   PERFORM monat_f4.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sl_spmon-high.
   PERFORM monat_f4.

Define the help


FORM  monat_f4.

  DATA: BEGIN OF mf_dynpfields OCCURS 1.
          INCLUDE STRUCTURE dynpread.
  DATA: END   OF mf_dynpfields.
  DATA: mf_returncode   LIKE sy-subrc,
        mf_monat        LIKE isellist-month,
        mf_hlp_repid    LIKE sy-repid.

  FIELD-SYMBOLS: <mf_feld>.

* Wert von Dynpro lesen
  GET CURSOR FIELD mf_dynpfields-fieldname.
  APPEND mf_dynpfields.
  mf_hlp_repid = sy-repid.
  DO 2 TIMES.
    CALL FUNCTION 'DYNP_VALUES_READ'
      EXPORTING
        dyname               = mf_hlp_repid
        dynumb               = sy-dynnr
      TABLES
        dynpfields           = mf_dynpfields
      EXCEPTIONS
        invalid_abapworkarea = 01
        invalid_dynprofield  = 02
        invalid_dynproname   = 03
        invalid_dynpronummer = 04
        invalid_request      = 05
        no_fielddescription  = 06
        undefind_error       = 07.
    IF sy-subrc = 3.
*     Aktuelles Dynpro ist Wertemengenbild
      mf_hlp_repid = 'SAPLALDB'.
    ELSE.
      READ TABLE mf_dynpfields INDEX 1.
*     Unterstriche durch Blanks ersetzen
      TRANSLATE mf_dynpfields-fieldvalue USING '_ '.
      EXIT.
    ENDIF.
  ENDDO.
  IF sy-subrc = 0.
*   Konvertierung ins interne Format
    CALL FUNCTION 'CONVERSION_EXIT_PERI_INPUT'
      EXPORTING
        input         = mf_dynpfields-fieldvalue
      IMPORTING
        output        = mf_monat
      EXCEPTIONS
        error_message = 1.
    IF mf_monat IS INITIAL.
*     Monat ist initial => Vorschlagswert aus akt. Datum ableiten
      mf_monat = sy-datlo(6).
    ENDIF.
    CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
      EXPORTING
        actual_month               = mf_monat
      IMPORTING
        selected_month             = mf_monat
        return_code                = mf_returncode
      EXCEPTIONS
        factory_calendar_not_found = 01
        holiday_calendar_not_found = 02
        month_not_found            = 03.
    IF sy-subrc = 0 AND mf_returncode = 0.
*     ASSIGN (MF_DYNPFIELDS-FIELDNAME) TO <MF_FELD>. 
*     <MF_FELD> = MF_MONAT.
      CALL FUNCTION 'CONVERSION_EXIT_PERI_OUTPUT'
        EXPORTING
          input  = mf_monat
        IMPORTING
          output = mf_dynpfields-fieldvalue.
      COLLECT mf_dynpfields.
      CALL FUNCTION 'DYNP_VALUES_UPDATE'
        EXPORTING
          dyname               = mf_hlp_repid
          dynumb               = sy-dynnr
        TABLES
          dynpfields           = mf_dynpfields
        EXCEPTIONS
          invalid_abapworkarea = 01
          invalid_dynprofield  = 02
          invalid_dynproname   = 03
          invalid_dynpronummer = 04
          invalid_request      = 05
          no_fielddescription  = 06
          undefind_error       = 07.           
    ENDIF.
  ENDIF.
ENDFORM.                                                    "MONAT_F4

It will display data in to mm.yyyy formate and process internally yyyymm formate.

Moderator message: please mention the source when copy/pasting code (here: RMCS0F0M)

Edited by: Thomas Zloch on May 31, 2011 11:18 AM

Read only

rathishr_nair
Explorer
0 Likes
2,102

Hi Meenakshi,

Change the Select-Options to Parameters. Like 'From Month' and 'To Month'. Later on you can build a range for this in your program.

Thanks

Rathish

Read only

Former Member
0 Likes
2,102

you can add an event called initlization there you will get fielsd low . high, option ,sign ..... and also use syste variable sy-datum in declaring

thanking you