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

Ranges From and To Checking Validation

Former Member
0 Likes
844

Hi all,

I have a selection screen

with select-options barcode which have from and to

came with 12 characters..

eg..From XXXXXXXXA101 to XXXXXXXXA100.

The 1st 8 char is must same From and To..

for the last 4 char must be in running alphabet.

eg.

From To

XXXXXXXXA001 XXXXXXXXA100. - Correct

XXXXXXXXA100 XXXXXXXXA001 - Wrong

XXXXXXXXA999 XXXXXXXXB100. - Correct

XXXXXXXxC101 XXXXXXXXA100. - Wrong

Any standard fucntion can use?

anyone good with checking..?

Thanks.

Hi all,

I have a selection screen

with select-options barcode which have from and to

came with 12 characters..

eg..From XXXXXXXXA101 to XXXXXXXXA100.

The 1st 8 char is must same From and To..

for the last 4 char must be in running alphabet.

eg.

From To

XXXXXXXXA001 XXXXXXXXA100. - Correct

XXXXXXXXA100 XXXXXXXXA001 - Wrong

XXXXXXXXA999 XXXXXXXXB100. - Correct

XXXXXXXxC101 XXXXXXXXA100. - Wrong

Any standard fucntion can use?

anyone good with checking..?

Thanks.

3 REPLIES 3
Read only

Former Member
0 Likes
692

I don't think there is any standard function available for this purpose.You have to do the validations yourself in the "At selection-screen output " event.

Read only

uwe_schieferstein
Active Contributor
0 Likes
692

Hello

There is a standard function module which does at least part of the required validation.

*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_SELOPT_BARCODE_CHECK
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zus_sdn_selopt_barcode_check.

TABLES: rsdsselopt.





SELECT-OPTIONS:
  o_barcod      FOR rsdsselopt-low.


AT SELECTION-SCREEN.
  PERFORM check_barcode_range.

START-OF-SELECTION.

END-OF-SELECTION.
*&---------------------------------------------------------------------*
*&      Form  CHECK_BARCODE_RANGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM check_barcode_range .
* define local data
  DATA:
    ld_msg          TYPE bapi_msg,
    ls_selopt       TYPE rsdsselopt.

  LOOP AT o_barcod.
<b>*   Check first 8 chars</b>
    IF ( o_barcod-high IS NOT INITIAL ).
      IF ( o_barcod-low+0(8) <> o_barcod-high+0(8) ).
        CONCATENATE 'Invalid high value =' o_barcod-high+0(8)
          INTO ld_msg SEPARATED BY space.
        MESSAGE ld_msg TYPE 'E'.
      ENDIF.
    ENDIF.

    CALL FUNCTION 'SELOPTS_INPUT_ADJUST'
      CHANGING
        sign                    = o_barcod-sign
        option                  = o_barcod-option
        low                     = o_barcod-low
        high                    = o_barcod-high
      EXCEPTIONS
        illegal_interval        = 1
        illegal_sign            = 2
        illegal_option          = 3
        low_different_from_high = 4
        OTHERS                  = 5.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.


  ENDLOOP.

ENDFORM.                    " CHECK_BARCODE_RANGE

Regards

Uwe

Read only

Former Member
0 Likes
692

hi execute this code ..

u can build a logic using the same ..

<b>give the input in select options as

xxxxxxxxa001 and xxxxxxxxa333.</b>

regards,

Vijay

-


REPORT ZEX4 .

data : gv_char(12),

GV_CHAR1(12),

C_VAR(4).

SELECT-OPTIONS : SO_CHAR FOR GV_CHAR.

ranges :gv_charsel for gv_char,

GV_CHARSEL1 FOR GV_CHAR.

START-OF-SELECTION.

gv_charsel-sign = 'I'.

gv_charsel-option = 'BT'.

gv_charsel-low = 'XXXXXXXXA001'.

gv_charsel-high = 'XXXXXXXXA100'.

APPEND gv_charsel.

gv_charsel1-sign = 'I'.

gv_charsel1-option = 'BT'.

gv_charsel1-low = 'XXXXXXXXA999'.

gv_charsel1-high = 'XXXXXXXXB100'.

APPEND gv_charsel1.

      • Logic

MOVE SO_CHAR-LOW8(4) TO GV_CHAR0(4).

MOVE SO_CHAR-HIGH8(4) TO GV_CHAR10(4).

IF GV_CHAR CA GV_CHARSEL-LOW+8(4).

WRITE:/ 'OKAY' .

ELSE .

WRITE:/ 'NOT OKAY'.

ENDIF.

IF GV_CHAR1 CA GV_CHARSEL-HIGH+8(4).

WRITE:/ 'OKAY' .

ELSE .

WRITE:/ 'NOT OKAY'.

ENDIF.

Message was edited by: Vijay