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

Issue modifying parameters using at selection-screen on event

Former Member
0 Likes
526

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.

4 REPLIES 4
Read only

Former Member
0 Likes
463

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

Read only

Former Member
0 Likes
463

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:

Read only

0 Likes
463

Like I said - I think you'll find it doesn't work in AT SELECTION-SCREEN ON kunnr.

Rob

Read only

0 Likes
463

Thanks for the heads up Rob. I guess I over looked that.