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
474

Its a simple question but dont know how to solve it . I will get a pop up window for customer number 'seledir' and 'empldir'.if i simply press enter on the pop up it displays an error saying 'enter the postal code' but if i simply press enter again it displays the error saying 'field pstlz in table kna1 cannot be specified twice' which is not understandable to the user how do i make it to display the same error 'enter the postal code ' again.

AT SELECTION-SCREEN.

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

IVALS-TABNAME = 'KNA1'.

IVALS-FIELDNAME = 'PSTLZ'.

APPEND IVALS.

IVALS-TABNAME = 'KNA1'.

IVALS-FIELDNAME = 'REGIO'.

APPEND IVALS.

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.

READ TABLE IVALS WITH KEY FIELDNAME = 'PSTLZ'.

IF NOT IVALS-VALUE IS INITIAL.

PSTLZ = IVALS-VALUE.

ELSE.

MESSAGE E017 with 'Enter the postal code'.

ENDIF.

READ TABLE IVALS WITH KEY FIELDNAME = 'REGIO'.

IF NOT IVALS-VALUE IS INITIAL.

REGIO = IVALS-VALUE.

ELSE.

MESSAGE E018 WITH 'Enter the Region'.

ENDIF.

ENDIF.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
438

Please make sure to refresh the IVAL table each time.




AT SELECTION-SCREEN.

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

<b>refresh iVALS.</b>

IVALS-TABNAME = 'KNA1'.
IVALS-FIELDNAME = 'PSTLZ'.
APPEND IVALS.

IVALS-TABNAME = 'KNA1'.
IVALS-FIELDNAME = 'REGIO'.
APPEND IVALS.


Regards,

Rich Heilman

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
439

Please make sure to refresh the IVAL table each time.




AT SELECTION-SCREEN.

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

<b>refresh iVALS.</b>

IVALS-TABNAME = 'KNA1'.
IVALS-FIELDNAME = 'PSTLZ'.
APPEND IVALS.

IVALS-TABNAME = 'KNA1'.
IVALS-FIELDNAME = 'REGIO'.
APPEND IVALS.


Regards,

Rich Heilman

Read only

0 Likes
438

Or fill IVALS in the INITIALIZATION event.

<b>INITIALIZATION.

IVALS-TABNAME = 'KNA1'.
IVALS-FIELDNAME = 'PSTLZ'.
APPEND IVALS.

IVALS-TABNAME = 'KNA1'.
IVALS-FIELDNAME = 'REGIO'.
APPEND IVALS.</b>


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



Regards,

Rich Heilman

Read only

Former Member
0 Likes
438

Why dont you set the field Field_OBL in your table IVALS for both post code and regio...in that case you would not need to give error message.