2

I created these three radio buttons to define values to the variable TEST.

The first two work just fine: if I click in p_r1 it assigns B and if I click p_r2 it assigns A.

I wanted the third to assign * to get all status i.e A, B, C.

Why doesn't it work? Isn't * a special character that means all like % in SQL?

DATA: TEST TYPE C.

PARAMETERS:
  P_R1 RADIOBUTTON GROUP GRP1 DEFAULT 'X',
  P_R2 RADIOBUTTON GROUP GRP1,
  P_R3 RADIOBUTTON GROUP GRP1.

IF P_R1 = 'X'.
  TEST = 'B'.

ELSEIF P_R2 = 'X'.
  TEST = 'A'.

ELSEIF P_R3 = 'X'.
  TEST = '*'.

ENDIF.

SELECT  VBELN,GBSTK
  FROM LIKP
  WHERE GBSTK = @TEST
  INTO TABLE @DATA(IT_FINAL).


CL_DEMO_OUTPUT=>DISPLAY( IT_FINAL ).
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
SALTZZZZ
  • 49
  • 5

1 Answers1

3

A few things to keep in mind to make your requirement work:

  1. An = or EQ in the where condition does not allow for wildcards. I.e. when test equals '*' in your example it will only find entries in the database table where GBSTK equals '*', most probably zero entries
  2. To use wildcards you need to use LIKE instead of = or EQ
  3. The general wild card to mach any string is '%' and not '*'

For more details check the SAP help for SELECT - WHERE for your specific version. Here is the one for 752: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapwhere.htm?file=abapwhere.htm

Gert Beukema
  • 2,510
  • 1
  • 17
  • 18
  • Thanks. It worked. I changed the * being assigned to the variable Test to % and in the where clause I changed from = to like. Unfortunally I don't have enough points to upvote yet, but thanks, you solved my problem. – SALTZZZZ Aug 19 '22 at 22:42
  • @SALTZZZZ you can still accept the answer. Else your question is marked unanswered. Also as an addition: For your use-case you could also use a range table. Either it would be empty in your "*" use-case or contain ( sign = 'I' option = 'CP' low = '\*' ). – peterulb Aug 20 '22 at 20:41
  • I marked as accepted. Thanks for the information. – SALTZZZZ Aug 22 '22 at 01:47