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

selection screen

Former Member
0 Likes
584

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
538

hi,

try writing start-of-selection event after ur popup fm.

if u can paste the str of ivals also.

santhosh

4 REPLIES 4
Read only

Former Member
0 Likes
539

hi,

try writing start-of-selection event after ur popup fm.

if u can paste the str of ivals also.

santhosh

Read only

0 Likes
538

i have given the start-of-selection only after at selection screen

Read only

0 Likes
538

or else try this , write the If condition before calling popup

if not ival[] is initial.

  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
.

endif.

Read only

Former Member
0 Likes
538

Hi,

You had written the code for Popup in AT SELECTION-SCREEN even , so it will trigger everytime u press enter in selection-screen

write the popup code in STRART-OF-SELECTION event