‎2008 Jan 16 10:46 AM
Let's say I've got on my selection screen
PARAMETERS: werks LIKE t001w-werks.
I'd like the programm after writing the werks and pressing enter button to check some condition. If werks meets some condition then I'd like to modify my selection screen (add one more PARAMETERS below the werks). How to do this simply? Greetings. P.
‎2008 Jan 16 11:13 AM
Hello P,
This is what you want.
TABLES: T001W.
PARAMETERS: WERKS LIKE T001W-WERKS." USER-COMMAND CHECK.
PARAMETERS: BUKRS LIKE EKKO-BUKRS MODIF ID BUK.
AT SELECTION-SCREEN OUTPUT.
IF WERKS IS INITIAL.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'BUK'.
SCREEN-ACTIVE = 0.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
SELECT SINGLE * FROM T001W WHERE WERKS = WERKS.
IF SY-SUBRC = 0.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'BUK'.
SCREEN-INVISIBLE = 0.
SCREEN-INPUT = 1.
SCREEN-ACTIVE = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
Cheers,
Vasanth
‎2008 Jan 16 10:49 AM
Hi Piotr,
In dialog program PAI will check the input values .
PAI event will do all the actions whatever the user did.
cheers,
Hema.
‎2008 Jan 16 10:51 AM
Here an example of code using this possibility
************************************************************************
ABAP name : ZBTA0001 *
*
Created by : Frédéric GIROD / Sébastien COLLOMB *
*
Date : 14/03/2005 *
*
Description : BCxxxx Chargement / Dechargement de tables *
transparentes SAP. *
*
*
************************************************************************
MODIFICATIONS *
************************************************************************
Date * Author * Marking code * Description *
************************************************************************
* * * *
************************************************************************
REPORT ZBC_SAUVEGARDE_TABLE
NO STANDARD PAGE HEADING.
*----
TABLES -
*
TABLES : dd02t.
*----
DATA -
*
DATA : wt_fieldcat TYPE lvc_t_fcat ,
ws_fieldcat TYPE lvc_s_fcat ,
BEGIN OF wt_tablist OCCURS 0 ,
tabname TYPE tabname ,
ddtext TYPE as4text ,
END OF wt_tablist .
FIELD-SYMBOLS : TYPE ANY . " Structure de la table
*----
SELECTION SCREEN -
*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
PARAMETERS p_table TYPE tabname.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
PARAMETERS : p_imp RADIOBUTTON GROUP ra1 ,
p_exp RADIOBUTTON GROUP ra1
DEFAULT 'X' ,
p_clear AS CHECKBOX .
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
PARAMETERS : p_file TYPE localfile
OBLIGATORY .
SELECTION-SCREEN SKIP 1.
PARAMETERS : p_excl RADIOBUTTON GROUP ra2 ,
p_flat RADIOBUTTON GROUP ra2 .
SELECTION-SCREEN END OF BLOCK b3.
*----
MAIN -
*
START-OF-SELECTION.
Vérification des options de sélection.
PERFORM p_check.
Déchargement de la table.
IF p_exp EQ 'X'.
PERFORM p_dechargement.
Chargement de la table.
ELSE.
PERFORM p_chargement.
ENDIF.
END-OF-SELECTION.
*----
*
Form P_CHECK. *
*----
*
*----
*
FORM p_check.
DATA : wlv_tabname TYPE tabname.
Verifie que la table existe.
SELECT tabname
UP TO 1 ROWS
INTO wlv_tabname
FROM dd02t
WHERE tabname EQ p_table
AND as4local EQ 'A'.
ENDSELECT.
IF sy-subrc NE space.
WRITE : /3 text-001.
STOP.
ENDIF.
On ne traite que le chargement des tables Z*.
IF p_imp EQ 'X' AND p_table+0(1) NE 'Z'.
WRITE : /1 text-007.
STOP.
ENDIF.
ENDFORM. " P_CHECK.
*----
*
Form P_DECHARGEMENT. *
*----
*
Déchargement de la table. *
*----
*
FORM p_dechargement.
Création de la table interne dynamique du type de la table.
PERFORM p_create_dyntable
USING p_table.
Lecture de la table ( et oui un joli select * ! )
SELECT *
INTO TABLE
FROM (p_table).
Si déchargen en format Excel.
IF p_excl EQ 'X'.
CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
EXPORTING
i_filename = p_file
TABLES
i_tab_sap_data =
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc NE space.
WRITE : /3 text-003.
ENDIF.
Si fichier plat.
ELSEIF p_flat EQ 'X'.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab =
EXCEPTIONS
OTHERS = 10.
IF sy-subrc NE space.
WRITE : /3 text-003.
ENDIF.
ENDIF.
ENDFORM. " P_DECHARGEMENT.
*----
*
Form P_CHARGEMENT. *
*----
*
Chargement. *
*----
*
FORM p_chargement.
DATA : wlv_count_col TYPE i ,
wlv_flag_row TYPE kcd_ex_row_n ,
wlt_file TYPE TABLE OF alsmex_tabline
WITH HEADER LINE ,
wlv_char1 TYPE char1.
FIELD-SYMBOLS : TYPE ANY.
Création de la table interne dynamique du type de la table.
PERFORM p_create_dyntable
USING p_table.
Lecture du fichier.
Si déchargen en format Excel.
IF p_excl EQ 'X'.
Seek number of column.
DESCRIBE TABLE wt_fieldcat LINES wlv_count_col.
Function to read the Microsoft Excel file.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = wlv_count_col
i_end_row = '10000'
TABLES
intern = wlt_file
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc NE space.
WRITE : /3 text-003.
STOP.
ENDIF.
Set data.
LOOP AT wlt_file.
IF wlt_file-row NE wlv_flag_row.
MOVE wlt_file-row TO wlv_flag_row.
IF wlt_file-row NE 1.
APPEND .
ENDCATCH.
IF sy-subrc EQ 1.
" A FAIRE
ENDIF.
ENDLOOP.
Append last time.
APPEND .
Si fichier plat.
ELSEIF p_flat EQ 'X'.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab =
EXCEPTIONS
OTHERS = 10.
IF sy-subrc NE space.
WRITE : /3 text-003.
STOP.
ENDIF.
ENDIF.
Si vide la table avant.
IF p_clear EQ 'X'.
Verification avant la suppression de la table.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = text-004
text_question = text-005
IMPORTING
answer = wlv_char1
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF wlv_char1 EQ '2'.
STOP.
ENDIF.
On supprime tout.
DELETE FROM (p_table) CLIENT SPECIFIED
WHERE mandt EQ sy-mandt.
IF sy-subrc NE space.
WRITE : /3 text-003.
STOP.
ENDIF.
ENDIF.
Chargement de la base.
MODIFY (p_table) FROM TABLE .
IF sy-subrc NE space.
WRITE : /3 text-003.
STOP.
ENDIF.
ENDFORM. " P_CHARGEMENT.
*----
*
Form P_CREATE_DYNTABLE. *
*----
*
*----
*
FORM p_create_dyntable
USING wpv_tabname TYPE tabname.
DATA : wlt_table TYPE REF TO data ,
wls_table TYPE REF TO data .
On assigne le nom de la table.
IF .
Recherche de la description du dictionnaire.
REFRESH wt_fieldcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name =
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = wt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc NE space.
WRITE : /1 text-003.
STOP.
ENDIF.
Création de la table interne dynamique.
IF .
Création de la structure du type de la table.
IF .
ENDFORM. " P_CREATE_DYNTABLE.
*----
EVENTS -
*
Au démarage de l'application.
INITIALIZATION.
On desactive la zone vider la table, elle n'est active que pour
le chargement.
LOOP AT SCREEN.
IF screen-name EQ 'P_CLEAR'.
MOVE '0' TO screen-active.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
A l'événement rafraichissement de l'écran.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
Si on charge alors on active la zone P_CLEAR.
IF p_imp EQ 'X'.
IF screen-name EQ 'P_CLEAR'.
MOVE '1' TO screen-active.
MODIFY SCREEN.
ENDIF.
ELSE.
IF screen-name EQ 'P_CLEAR'.
MOVE '0' TO screen-active.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
Evenement F4 sur P_FILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
‎2008 Jan 16 11:01 AM
Hi,
Try this:
At selection-screen.
if werks <> '1000'.
message E001. "Plant is not 1000
endif.
‎2008 Jan 16 11:02 AM
Hi,
try the following code.
data: gt_vbap type standard table of vbap.
parameters p_vbeln type vbak-vbeln.
at selection-screen output.
if p_vbeln is not initial.
select * into table gt_vbap from vbap where vbeln = p_vbeln.
endif.
reward points if useful,
Regards,
Niyaz
‎2008 Jan 16 11:13 AM
Hello P,
This is what you want.
TABLES: T001W.
PARAMETERS: WERKS LIKE T001W-WERKS." USER-COMMAND CHECK.
PARAMETERS: BUKRS LIKE EKKO-BUKRS MODIF ID BUK.
AT SELECTION-SCREEN OUTPUT.
IF WERKS IS INITIAL.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'BUK'.
SCREEN-ACTIVE = 0.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
SELECT SINGLE * FROM T001W WHERE WERKS = WERKS.
IF SY-SUBRC = 0.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'BUK'.
SCREEN-INVISIBLE = 0.
SCREEN-INPUT = 1.
SCREEN-ACTIVE = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
Cheers,
Vasanth