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

Modify SCREEN after fill in parameter

naotoxxx
Participant
0 Likes
5,579

Hello i have a problem that i haven't solved

I have a screen with 3 parameter: center, invoice, copies ; so when i fill in center i need to do aquery to search in a table the invoice and display it on the screen in my parameter invoice (it's just for information). I tried with at-selection-screen output but i htink this is not a solution for me be cause this is pbo and is not called each time that i change mi parameter werks ( am i right?)

Any ideas ? Please help :'C

SELECTION-SCREEN BEGIN OF BLOCK a.

PARAMETERS: p_werks  TYPE t001w-werks  OBLIGATORY,            " Centro
            p_folios TYPE zclsd_tb_031-num_fol,               " N° Folio Actual
            p_copies TYPE zclsd_tb_031-num_fol OBLIGATORY.    " Cantidad a imprimir
SELECTION-SCREEN END OF BLOCK a.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks.
  PERFORM selection_screen.
END-OF-SELECTION.


AT SELECTION-SCREEN OUTPUT.
  PERFORM conf_param.
END-OF-SELECTION.

START-OF-SELECTION.
  PERFORM obtener_data. "get data
  PERFORM llamar_impresion. "call smartforms




FORM conf_param.
  LOOP AT SCREEN.
    IF screen-name = 'P_FOLIOS'.
      screen-input = ''.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
ENDFORM.


FORM selection_screen.
  DATA:
    w_dynpfields TYPE dynpread,
    i_dynpfields LIKE STANDARD TABLE OF dynpread.


*  IF p_werks IS NOT INITIAL.
    SELECT SINGLE num_fol
       FROM zclsd_tb_031 INTO lv_fol
       WHERE werks EQ p_werks.


    WRITE lv_fol TO lv_fol.
    CONCATENATE 'Folio: ' lv_fol INTO lv_fol.

    w_dynpfields-fieldname    = 'P_FOLIOS'.
    w_dynpfields-fieldvalue   = lv_fol.
    APPEND w_dynpfields TO i_dynpfields.
    CLEAR w_dynpfields.

    CALL FUNCTION 'DYNP_VALUES_UPDATE'
      EXPORTING
        dyname               = sy-repid
        dynumb               = sy-dynnr
      TABLES
        dynpfields           = i_dynpfields
      EXCEPTIONS
        invalid_abapworkarea = 1
        invalid_dynprofield  = 2
        invalid_dynproname   = 3
        invalid_dynpronummer = 4
        invalid_request      = 5
        no_fielddescription  = 6
        undefind_error       = 7
        OTHERS               = 8.
*  ENDIF.
ENDFORM.
1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
4,763

The event AT SELECTION-SCREEN (without any addition) is triggered right after the user has pressed ENTER or any other non-exit function key, so you may change P_FOLIOS at that time (no need to use DYNP_VALUES_UPDATE because this latter is only needed for value help i.e. AT SELECTION-SCREEN ON VALUE-REQUEST ...):

AT SELECTION-SCREEN.
  DATA lv_fol TYPE zclsd_tb_031-num_fol.
  SELECT SINGLE num_fol
       FROM zclsd_tb_031 INTO lv_fol
       WHERE werks EQ p_werks.
  WRITE lv_fol TO lv_fol.
  CONCATENATE 'Folio: ' lv_fol INTO lv_fol.
  P_FOLIOS = lv_fol.

Hello i have a problem that i haven't solved

I have a screen with 3 parameter: center, invoice, copies ; so when i fill in center i need to do aquery to search in a table the invoice and display it on the screen in my parameter invoice (it's just for information). I tried with at-selection-screen output but i htink this is not a solution for me be cause this is pbo and is not called each time that i change mi parameter werks ( am i right?)

Any ideas ? Please help :'C

SELECTION-SCREEN BEGIN OF BLOCK a.

PARAMETERS: p_werks  TYPE t001w-werks  OBLIGATORY,            " Centro
            p_folios TYPE zclsd_tb_031-num_fol,               " N° Folio Actual
            p_copies TYPE zclsd_tb_031-num_fol OBLIGATORY.    " Cantidad a imprimir
SELECTION-SCREEN END OF BLOCK a.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks.
  PERFORM selection_screen.
END-OF-SELECTION.


AT SELECTION-SCREEN OUTPUT.
  PERFORM conf_param.
END-OF-SELECTION.

START-OF-SELECTION.
  PERFORM obtener_data. "get data
  PERFORM llamar_impresion. "call smartforms




FORM conf_param.
  LOOP AT SCREEN.
    IF screen-name = 'P_FOLIOS'.
      screen-input = ''.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
ENDFORM.


FORM selection_screen.
  DATA:
    w_dynpfields TYPE dynpread,
    i_dynpfields LIKE STANDARD TABLE OF dynpread.


*  IF p_werks IS NOT INITIAL.
    SELECT SINGLE num_fol
       FROM zclsd_tb_031 INTO lv_fol
       WHERE werks EQ p_werks.


    WRITE lv_fol TO lv_fol.
    CONCATENATE 'Folio: ' lv_fol INTO lv_fol.

    w_dynpfields-fieldname    = 'P_FOLIOS'.
    w_dynpfields-fieldvalue   = lv_fol.
    APPEND w_dynpfields TO i_dynpfields.
    CLEAR w_dynpfields.

    CALL FUNCTION 'DYNP_VALUES_UPDATE'
      EXPORTING
        dyname               = sy-repid
        dynumb               = sy-dynnr
      TABLES
        dynpfields           = i_dynpfields
      EXCEPTIONS
        invalid_abapworkarea = 1
        invalid_dynprofield  = 2
        invalid_dynproname   = 3
        invalid_dynpronummer = 4
        invalid_request      = 5
        no_fielddescription  = 6
        undefind_error       = 7
        OTHERS               = 8.
*  ENDIF.
ENDFORM.
7 REPLIES 7
Read only

Sandra_Rossi
Active Contributor
0 Likes
4,763

Can you explain what you changed and why?

Read only

FredericGirod
Active Contributor
0 Likes
4,763

Hola sandra.rossi, it is not so easy to explain, because I am not totally sure to understand why he used some statement.

I do not understand the usage of the event AT ... ON VALUE-REQUEST

I do not understand the usage of the DYNP_VALUES_UPDATE

...

Read only

Sandra_Rossi
Active Contributor
0 Likes
4,763

I understand that after pressing F4 (or the "F4" button) on P_WERKS input field, to display the list of possible values, if you select one value, it's returned in the input field, and additionally your code initializes P_FOLIOS which corresponds to the P_WERKS you have selected.

Now, your question is, how to change P_FOLIOS if the value of P_WERKS is manually input instead of using F4 button. Is that it?

NB: you don't understand what END-OF-SELECTION is for, it's only to be used with logical databases, please remove the line (currently, it has no effect in your code).

Read only

Sijin_Chandran
Active Contributor
0 Likes
4,763

sandra.rossi That multiple usage of END-OF-SELECTION though 😞

Read only

naotoxxx
Participant
0 Likes
4,763

Thanks sandra.rossi for your reply

how to change P_FOLIOS if the value of P_WERKS is manually input instead of using F4 button. Is that it?, Yes! that is my question 😄

I'll delete the end-of-selection 😉

Read only

Sandra_Rossi
Active Contributor
0 Likes
4,764

The event AT SELECTION-SCREEN (without any addition) is triggered right after the user has pressed ENTER or any other non-exit function key, so you may change P_FOLIOS at that time (no need to use DYNP_VALUES_UPDATE because this latter is only needed for value help i.e. AT SELECTION-SCREEN ON VALUE-REQUEST ...):

AT SELECTION-SCREEN.
  DATA lv_fol TYPE zclsd_tb_031-num_fol.
  SELECT SINGLE num_fol
       FROM zclsd_tb_031 INTO lv_fol
       WHERE werks EQ p_werks.
  WRITE lv_fol TO lv_fol.
  CONCATENATE 'Folio: ' lv_fol INTO lv_fol.
  P_FOLIOS = lv_fol.
Read only

0 Likes
4,763

Really thanks, it's working ;D