2019 Oct 30 2:20 AM
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.
2019 Oct 30 1:18 PM
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.
2019 Oct 30 8:23 AM
2019 Oct 30 8:43 AM
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
...
2019 Oct 30 10:06 AM
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).
2019 Oct 30 10:09 AM
2019 Oct 30 12:21 PM
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 😉
2019 Oct 30 1:18 PM
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.
2019 Oct 30 1:45 PM