Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Below Example based on Material Master , to fetch the Material Number Just like Use of F4 help .

Case # 1 :   If  Material Number Start with "2*".

Output : Display all Material Number who's Start with "2".

 

 

Case # 2 :    Material Number End with "*2".

 

Output :  Material Number Display Ending with "*2".

 

Case # 3 :    Material Number   Start , End and Mid Value with  "*2*".

 

 

Output :

 

 

Error rendering macro 'code': Invalid value specified for parameter 'lang'
REPORT  YSCN_SELECTION_SCREEN.

TYPES: BEGIN OF TY_TAB,
  MATNR TYPE MATNR,
  MTART TYPE MTART,
  END OF TY_TAB.
DATA : ITAB TYPE STANDARD TABLE OF TY_TAB WITH HEADER LINE INITIAL SIZE 0,
      WA TYPE TY_TAB,
      SLEN TYPE I ,
      BLEN TYPE I ,
      LAST(1) TYPE C ,
      FIRST(1) TYPE C,
      MAT(18) TYPE C.
PARAMETERS : S_MATNR TYPE MATNR .

SLEN = STRLEN( S_MATNR ) - 1.
BLEN = SLEN - 1 .
LAST = S_MATNR+SLEN(1).
FIRST = S_MATNR+0(1).

IF SLEN <= '18'.
  IF LAST = '*' AND FIRST = '*'.
    CONCATENATE '%' S_MATNR+1(BLEN) '%' INTO S_MATNR .
  ELSEIF LAST = '*'.
    CONCATENATE S_MATNR+0(SLEN) '%' INTO S_MATNR .
  ELSEIF FIRST = '*'.
    CONCATENATE '%' S_MATNR+1(SLEN) INTO S_MATNR .
  ELSE.
    MESSAGE 'Wrong Input ' TYPE 'W' DISPLAY LIKE 'E'.
    LEAVE TO SCREEN SY-DYNNR.
  ENDIF.
ENDIF.
SELECT MATNR MTART INTO CORRESPONDING FIELDS OF TABLE ITAB FROM MARA
  WHERE MATNR LIKE S_MATNR .
LOOP AT ITAB INTO WA.
  CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
    EXPORTING
      INPUT  = WA-MATNR
    IMPORTING
      OUTPUT = MAT.
  WRITE : /1 MAT , WA-MTART .
  CLEAR : MAT , WA.
ENDLOOP.
  • No labels