‎2006 Nov 08 8:14 PM
i have five fields in selection screen including quantity and customer number. for a particular value of the customer number a window pops up asking for region and postal code. if i enter a wrong value an error message gets displayed . everything is working fine with that but if i simply close that window without entering the values to change the customer number to any other value, the quantity field is lost.Its made mandatory before and just the ? displays indicating the user to enter the value .Its not a big problem but how to restore the quantity value in the selection screen this happens only if the quantity is 0.
‎2006 Nov 08 8:17 PM
‎2006 Nov 08 8:17 PM
‎2006 Nov 08 8:17 PM
‎2006 Nov 08 8:27 PM
I have solved the previous problem by giving the code in initialization event. This is a different problem again at the same place.
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.
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.
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.
‎2006 Nov 08 8:49 PM
I see the problem now, what you are seeing is just the way that that type of field is handled in the gui, sometimes if you want 0 to show, you need to make the field as a character field, so in order to fix this problem, you need to adjust the typeing of the parameter field.
...
quantity(15) type c obligatory ,
...
Regards,
Rich Heilman