Skip to Content
0
Former Member
Nov 29, 2006 at 02:37 PM

selection screen

46 Views

for some particular customer number in the selection screen a pop up screen comes asking for the postal code and region . I have used the function popup_get_values function for that . its like this if i enter the values in the selection screen and if i give customer number as 'seledir' or 'empldir' then press enter the popup screen comes i enter the region and postal code and press enter , now if i press execute it works fine and gives the output but now if i press enter again it gives the error saying " the number of fields to be displayed is 0" . when i debugged i can see that the error is from popup_get_values . I appreciate your immediate response.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS : P_KUNNR LIKE KNA1-KUNNR OBLIGATORY, " customer number

P_MATNR LIKE VBAP-MATNR OBLIGATORY, " material number

QUANTITY LIKE BAPIITEMIN-REQ_QTY OBLIGATORY,

" required quantity

P_VKORG LIKE VBAK-VKORG OBLIGATORY, " Sales organization

P_VTWEG LIKE VBAK-VTWEG OBLIGATORY, " distribution channel

P_SPART LIKE VBAK-SPART OBLIGATORY, " division

COUPON(12). " coupon number

SELECTION-SCREEN END OF BLOCK B1.

----


  • INITIALIZATION *

----


INITIALIZATION.

  • Internal table for taking postal code and region values from pop

  • up window

IVALS-TABNAME = 'KNA1'.

IVALS-FIELDNAME = 'PSTLZ'.

APPEND IVALS.

IVALS-TABNAME = 'KNA1'.

IVALS-FIELDNAME = 'REGIO'.

APPEND IVALS.

----


  • At SELECTION-SCREEN *

----


AT SELECTION-SCREEN.

IF P_KUNNR = 'SELEDIR' OR P_KUNNR = 'EMPLDIR'.

CALL FUNCTION 'POPUP_GET_VALUES'

EXPORTING

  • NO_VALUE_CHECK = ' '

POPUP_TITLE = 'Enter Sold-to party''s Postal code and Region'

START_COLUMN = '25'

START_ROW = '10'

  • IMPORTING

  • RETURNCODE =

TABLES

FIELDS = ivals

  • EXCEPTIONS

  • ERROR_IN_FIELDS = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Reading the values from the internal table

READ TABLE IVALS WITH KEY FIELDNAME = 'PSTLZ'.

IF NOT IVALS-VALUE IS INITIAL.

  • postal code validation

SELECT SINGLE PSTLZ

INTO PSTLZ1

FROM ZZIPS

WHERE PSTLZ = IVALS-VALUE.

IF SY-SUBRC = 0.

PSTLZ = IVALS-VALUE.

ELSE.

MESSAGE E017 WITH 'Enter the valid Postal code'.

ENDIF.

ELSE.

MESSAGE E018 WITH 'Enter the Postal code'.

ENDIF.

READ TABLE IVALS WITH KEY FIELDNAME = 'REGIO'.

IF NOT IVALS-VALUE IS INITIAL.

  • Region validation

SELECT SINGLE REGIO

INTO REGIO1

FROM ZZIPS

WHERE REGIO = IVALS-VALUE.

IF SY-SUBRC = 0.

REGIO = IVALS-VALUE.

ELSE.

MESSAGE E019 WITH 'Enter the valid Region'.

ENDIF.

ELSE.

MESSAGE E020 WITH 'Enter the Region'.

ENDIF.

REFRESH IVALS.

ENDIF.