‎2010 Jan 12 9:16 PM
Hi Gurus! I'm working on a program where I have to set the value of certain selection-screen fields according to the value of the other parameter (kunnr). When I enter kunnr for the first time, all fields get their values, but when entering a second and different kunnr, parameters ctaest and name1 change for the new values, but not for the others (firmant1, dnif1, firmant2 and dnif2): they keep their original value.
This is the code I'm using:
* Parameter declaration
PARAMETERS: bukrs TYPE bukrs.
PARAMETERS: kunnr TYPE kunnr MODIF ID g1.
PARAMETERS: ctaesp TYPE saknr.
PARAMETERS: name1 TYPE name1_gp.
PARAMETERS firmant1 TYPE zfirmante MODIF ID g1.
PARAMETERS dnif1 TYPE zdni MODIF ID g1.
PARAMETERS firmant2 TYPE zfirmante MODIF ID g1.
PARAMETERS dnif2 TYPE zdni MODIF ID g1.
AT SELECTION-SCREEN ON kunnr.
* Determinar cuenta anterior
IF NOT kunnr IS INITIAL.
SELECT SINGLE altkn INTO t_document-accnt
FROM knb1
WHERE bukrs = bukrs AND
kunnr = kunnr.
IF sy-subrc NE 0.
MESSAGE 'El cliente seleccionado no posee cuenta anterior' TYPE 'E'.
ENDIF.
ctaesp = t_document-accnt.
SELECT SINGLE name1 INTO name1
FROM kna1
WHERE kunnr = kunnr.
* Se obtiene información de firmates: " TKT0086.01.sn
DATA: pass TYPE n LENGTH 1.
CLEAR pass.
SELECT SINGLE *
FROM zpf_firmantes
INTO gt_firmantes
WHERE bukrs = bukrs AND
kunnr = kunnr.
IF sy-subrc EQ 0.
firmant1 = gt_firmantes-firmante1.
dnif1 = gt_firmantes-dnif1.
firmant2 = gt_firmantes-firmante2.
dnif2 = gt_firmantes-dnif2.
ELSE.
firmant1 = ''.
dnif1 = ''.
firmant2 = ''.
dnif2 = ''.
ENDIF.
MODIFY SCREEN.
ENDIF.
The only difference I found is that the Input property of both working fieds is set to 0, and the others are set to 1.
If I change the Input property of all fields to 0 they refresh perfectly but, as customer requirement, some fields must be editable, so it's impossible for me to disable screen input for them.
Is there anything I could do about this? Is there any mistake in my code?
Thanks a lot and best regards,
Fernando.
‎2010 Jan 12 9:28 PM
To start with, the MODIFY SCREEN belongs in a LOOP AT SCREEN in the AT SELECTION-SCREEN OUTPUT event, not where it now is.
Rob
‎2010 Jan 12 9:39 PM
Modify Screen should be used only within a LOOP AT SCREEN ... ENDLOOP.
AT SELECTION-SCREEN ON kunnr.
* Determinar cuenta anterior
IF NOT kunnr IS INITIAL.
LOOP TA SCREEN.
SELECT SINGLE altkn INTO t_document-accnt
FROM knb1
WHERE bukrs = bukrs AND
kunnr = kunnr.
IF sy-subrc NE 0.
MESSAGE 'El cliente seleccionado no posee cuenta anterior' TYPE 'E'.
ENDIF.
ctaesp = t_document-accnt.
SELECT SINGLE name1 INTO name1
FROM kna1
WHERE kunnr = kunnr.
* Se obtiene información de firmates: " TKT0086.01.sn
DATA: pass TYPE n LENGTH 1.
CLEAR pass.
SELECT SINGLE *
FROM zpf_firmantes
INTO gt_firmantes
WHERE bukrs = bukrs AND
kunnr = kunnr.
IF sy-subrc EQ 0.
firmant1 = gt_firmantes-firmante1.
dnif1 = gt_firmantes-dnif1.
firmant2 = gt_firmantes-firmante2.
dnif2 = gt_firmantes-dnif2.
ELSE.
firmant1 = ''.
dnif1 = ''.
firmant2 = ''.
dnif2 = ''.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDAT.
Check this link for more details:
‎2010 Jan 12 9:52 PM
Like I said - I think you'll find it doesn't work in AT SELECTION-SCREEN ON kunnr.
Rob
‎2010 Jan 12 10:48 PM