Sy-ucomm Vs OKcode
Hi
What is the difference between sy-ucomm and okcode????
Hi,
sy-ucomm is for doing the functions what the user wishes to do at that particular event. You use it in menus and other place . this mainly in using <pfstatus>
ok_code is generally used in screen as of I have used. You will define the function in the screen. and you can use it in the main program.
ok_code acts just as a temporary variable that stores the value of sy-ucomm.
When user interacts with the screen elements, the function code that you have assigned is filled in the sy-ucomm field which is turn gets reflected in OK_CODE.
In your ABAP programs, you should work with the OK_CODE field instead of SY-UCOMM. There are two reasons for this: Firstly, the ABAP program has full control over fields declared within it, and secondly, you should never change the value of an ABAP system field. However, you should also always initialize the OK_CODE field in an ABAP program for the following reason:
In the same way that the OK_CODE field in the ABAP program and the system field SY-UCOMM receive the contents of the corresponding screen fields in the PAI event, their contents are also assigned to the OK_CODE screen field and system field SYST-UCOMM in the PBO event. Therefore, you must clear the OK_CODE field in the ABAP program to ensure that the function code of a screen is not already filled in the PBO event with an unwanted value. This is particularly important when the next PAI event can be triggered with an empty function code (for example, using ENTER). Empty function codes do not affect SY-UCOMM or the OK_CODE field, and consequently, the old field contents are transported.
Diff bet OK-CODE and SY-UCOMM
Difference Between SY-UCOMM and OK_CODE
ok_code/ sy-ucomm usage in dialog program
Thanks.
Similar Messages
-
How to find function code for buttons on toolbar in oops alv
Hi experts,
I want to remove some buttons from toolbar in oops alv, i know the procedure like get function code and pass the value in a table and pass that table to IT_TOOLBAR_EXCLUDING of
method set_table_for_first_display but I WANT TO KNOW HOW TO FIND FUNCTION CODE FOR BUTTONS ON TOOLBAR IN OOPS ALVHi Prakash,
-->First you have to set the pf status in your alv program by,
{FORM pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'FIRST'.
ENDFORM. "PF_STATUS}
-->Pass this Subroutine name in the Function module, Reuse_alv_grid_display's parameters i.e,
i_callback_pf_status_set = 'PF_STATUS'}
*-->Then doble click on that pf status,
From the menu bar, select Extras->Adjust Template->List Viewer,
This will give you the existing statndard gui status of the program*
->Then catch that function codes in the User command Parameter of the Function module Reuse.. i.e,
i_callback_user_command = 'COMM'
And make a subroutine of the name 'COMM'i.e,
FORM comm USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
DATA: okcode TYPE sy-ucomm.
okcode = ucomm.
CASE okcode.
WHEN 'REF'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'MANSI'
txt1 = 'CREATED BY'
txt2 = SY-UNAME
TXT3 = ' '
TXT4 = ' '
endcase.
Hope it helps you
Regrds
Mansi -
Hi,
I have created a sample prog for module pool.
I took a button on layout.
in flow logic okcode like sy-ucomm.
case okcode.
when 'button'.
write:/'sffs'.
endcase.
And i have created the tcode also.
while trying to exe it is giving msg as
GUI CAPABILITY OF TRANSACTION ZSCREEN NOT YET CLASSIFIED.
What is the error pls solve it.
Regards,
SiriHi
A) have created a sample prog for module pool.
I took a button on layout.
in flow logic okcode like sy-ucomm.
case okcode.
when 'button'.
write:/'sffs'.
endcase
U have to leave the screen before using the WRITE statament:
case okcode.
when 'button'.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
write:/'sffs'.
LEAVE SCREEN.
endcase.
B) And i have created the tcode also.
while trying to exe it is giving msg as
GUI CAPABILITY OF TRANSACTION ZSCREEN NOT YET CLASSIFIED.
Check if you have choose the right attribute of trx for module pool by se93
Max -
Not diaplsy buttons on alv grid display
Hi,
In the below code,i dont understand where i made a mistake,i used a user command on alv it's working but not display the buttons on a output.Please check the below code and solve it.
REPORT Y_ALV_VERSION.
TYPE-POOLS : SLIS.
DATA : BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARC-MATNR, "Plant Data for Material-Material Number
WERKS LIKE MARC-WERKS, "Plant Data for Material-Plant
EKGRP LIKE MARC-EKGRP, "Plant Data for Material-Purchasing Group
END OF ITAB.
DATA : BEGIN OF ITAB1 OCCURS 0,
MATNR LIKE MARD-MATNR, "Storage Location Data for Material-Material Number
WERKS LIKE MARD-WERKS, "Storage Location Data for Material-Plant
LGORT LIKE MARD-LGORT, "Storage Location Data for Material-Storage Location
END OF ITAB1.
DATA : REPID LIKE SY-REPID.
DATA : V_LINE TYPE SY-TABIX.
DATA : X_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA : I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : I_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.
DATA : X_ALV_EVENTS TYPE SLIS_ALV_EVENT.
DATA : T_ALV_EVENTS TYPE SLIS_T_EVENT.
DATA : X_ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
*********************START-OF-SELECTION***************
START-OF-SELECTION.
PERFORM SUB_SELECT_RECORD.
PERFORM SUB_PREPARE_FIELDCATALOG.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = T_ALV_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE T_ALV_EVENTS INTO X_ALV_EVENTS WITH KEY NAME = 'USERCOMMAND'.
IF SY-SUBRC = 0.
X_ALV_EVENTS-FORM = 'USER_ACTION'.
MODIFY T_ALV_EVENTS FROM X_ALV_EVENTS INDEX SY-TABIX.
ENDIF.
READ TABLE T_ALV_EVENTS INTO X_ALV_EVENTS WITH KEY NAME = 'PF_STATUS_SET'.
IF SY-SUBRC = 0.
X_ALV_EVENTS-FORM = 'PF_STATUS'.
MODIFY T_ALV_EVENTS FROM X_ALV_EVENTS INDEX SY-TABIX.
ENDIF.
PERFORM SUB_DETERMINE_ALV_LAYOUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = REPID
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = X_ALV_LAYOUT
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS = T_ALV_EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*& Form PF_STATUS
text
-->RT_EXTAB text
FORM PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'ALV_PF_STATUS'. " excluding rt_extab.
ENDFORM. "PF_STATUS
*& Form user_action
text
-->R_UCOMM text
-->RS_SELFIELD text
FORM USER_ACTION USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
DATA : OKCODE TYPE SY-UCOMM.
OKCODE = R_UCOMM.
CLEAR R_UCOMM.
V_LINE = RS_SELFIELD-TABINDEX.
CASE OKCODE.
WHEN 'PICK'.
READ TABLE ITAB INDEX V_LINE.
PERFORM SUB_SELECT_RECORD1.
PERFORM SUB_PREPARE_FIELDCATALOG1.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'REPID'
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS-SET'
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT =
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WHEN 'EXIT'.
RS_SELFIELD-EXIT = 'X'.
ENDCASE.
ENDFORM. "user_action
*& Form SUB_PREPARE_FIELDCATALOG
text
--> p1 text
<-- p2 text
FORM SUB_PREPARE_FIELDCATALOG .
X_FIELDCAT-SELTEXT_L = 'MATERIAL'.
X_FIELDCAT-DATATYPE = 'CHAR'.
X_FIELDCAT-OUTPUTLEN = 18.
X_FIELDCAT-FIELDNAME = 'MATNR'.
X_FIELDCAT-HOTSPOT = 'X'.
APPEND X_FIELDCAT TO I_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-SELTEXT_L = 'PLANT'.
X_FIELDCAT-DATATYPE = 'CHAR'.
X_FIELDCAT-OUTPUTLEN = 4.
X_FIELDCAT-FIELDNAME = 'WERKS'.
APPEND X_FIELDCAT TO I_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-SELTEXT_L = 'PUR.GROUP'.
X_FIELDCAT-DATATYPE = 'CHAR'.
X_FIELDCAT-OUTPUTLEN = 4.
X_FIELDCAT-FIELDNAME = 'EKGRP'.
X_FIELDCAT-EDIT = 'X'.
APPEND X_FIELDCAT TO I_FIELDCAT.
CLEAR X_FIELDCAT.
ENDFORM. " SUB_PREPARE_FIELDCATALOG
*& Form SUB_SELECT_RECORD
text
--> p1 text
<-- p2 text
FORM SUB_SELECT_RECORD.
SELECT MATNR WERKS EKGRP FROM MARC INTO TABLE ITAB UP TO 10 ROWS WHERE WERKS = '1000'.
ENDFORM. " SUB_SELECT_RECORD
*& Form SUB_DETERMINE_ALV_LAYOUT
text
--> p1 text
<-- p2 text
FORM SUB_DETERMINE_ALV_LAYOUT .
X_ALV_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
X_ALV_LAYOUT-F2CODE = 'PICK'.
X_ALV_LAYOUT-WINDOW_TITLEBAR = 'PLANT DATA'.
X_ALV_LAYOUT-KEY_HOTSPOT = 'X'.
ENDFORM. " SUB_DETERMINE_ALV_LAYOUT
*& Form SUB_PREPARE_FIELDCATALOG1
text
--> p1 text
<-- p2 text
FORM SUB_PREPARE_FIELDCATALOG1 .
X_FIELDCAT-SELTEXT_L = 'MATERIAL'.
X_FIELDCAT-DATATYPE = 'CHAR'.
X_FIELDCAT-OUTPUTLEN = 18.
X_FIELDCAT-FIELDNAME = 'MATNR'.
X_FIELDCAT-HOTSPOT = 'X'.
APPEND X_FIELDCAT TO I_FIELDCAT1.
CLEAR X_FIELDCAT.
X_FIELDCAT-SELTEXT_L = 'PLANT'.
X_FIELDCAT-DATATYPE = 'CHAR'.
X_FIELDCAT-OUTPUTLEN = 4.
X_FIELDCAT-FIELDNAME = 'WERKS'.
APPEND X_FIELDCAT TO I_FIELDCAT1.
CLEAR X_FIELDCAT.
X_FIELDCAT-SELTEXT_L = 'Storage Location'.
X_FIELDCAT-DATATYPE = 'CHAR'.
X_FIELDCAT-OUTPUTLEN = 4.
X_FIELDCAT-FIELDNAME = 'LGORT'.
X_FIELDCAT-EDIT = 'X'.
APPEND X_FIELDCAT TO I_FIELDCAT1.
CLEAR X_FIELDCAT.
ENDFORM. " SUB_PREPARE_FIELDCATALOG1
*& Form SUB_SELECT_RECORD1
text
--> p1 text
<-- p2 text
FORM SUB_SELECT_RECORD1 .
SELECT MATNR WERKS LGORT FROM MARD INTO TABLE ITAB1 WHERE MATNR = ITAB-MATNR AND WERKS = ITAB-WERKS.
REFRESH I_FIELDCAT1.
ENDFORM. " SUB_SELECT_RECORD1
thanks and regardsConsider this logic.
DATA:
g_exclude TYPE slis_t_extab.
* FORM display_alv_report *
FORM display_alv_report.
PERFORM fieldcat_init USING g_fieldcat[].
PERFORM build_sort_fields USING g_sort[].
PERFORM eventtab_build USING g_events[]
g_events_ex[].
PERFORM layout_build USING g_layout.
PERFORM exclude_icons.
PERFORM list_view.
ENDFORM. " display_alv_report.
* Form exclude_icons
FORM exclude_icons.
APPEND '&ETA' TO g_exclude. "Details
* APPEND '&OUP' TO g_exclude. "Sort Up
* APPEND '&ODN' TO g_exclude. "Sort Down
APPEND '&ILT' TO g_exclude. "Set Filter
APPEND '&UMC' TO g_exclude. "Sum
APPEND '&RNT_PREV' TO g_exclude. "Print preview
* APPEND '&VEXCEL' TO g_exclude. "Excel
APPEND '&AQW' TO g_exclude. "Word processing
APPEND '%PC' TO g_exclude. "Local File
APPEND '%SL' TO g_exclude. "Mail recepient
APPEND '&ABC' TO g_exclude. "ABC Analysis
APPEND '&GRAPH' TO g_exclude. "Graphic
* APPEND '&OL0' TO g_exclude. "Change layout
* APPEND '&OAD' TO g_exclude. "Select layout
APPEND '&AVE' TO g_exclude. "Save Layout
APPEND '&INFO' TO g_exclude. "Information
ENDFORM. " exclude_icons
FORM list_view.
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
is_layout = g_layout
it_sort = g_sort[]
it_events = g_events[]
it_fieldcat = g_fieldcat[]
i_save = g_save
it_excluding = g_exclude "<== Exclude
TABLES
t_outtab = it_work
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e208(00) WITH 'Error: ALV Grid'.
ENDIF.
ENDFORM. " layout_build -
Generate Selection Screen as Popup dynamically
Hello to all,
is there a way to generate a selection screen popup at runtime dynamically?
Is there any guide, that explains how "generate dynpro" has to be used?
Thanks
ChristianHello Oliver,
sorry that i didn't update this thread. I tried the way you described above and it works. Sometimes I get short dumps in the shared memory block. I didn't solve this yet.
I post you my code below:
DATA la_dssfield TYPE /XXX/zssys_dssfield.
CLEAR: wa_code, it_code.
CLEAR: Ranges.
wa_code = '*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'.
APPEND wa_code TO it_code.
wa_code = '*!!!!!! Generated program. Do not change anything!!!!'.
APPEND wa_code TO it_code.
wa_code = '*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'.
APPEND wa_code TO it_code.
wa_code = 'REPORT /XXX/ZSYS_GENSELSCREEN.'.
APPEND wa_code TO it_code.
**** Generate Tables Section
DATA lt_tmp_dssfield TYPE /XXX/ztsys_dssfield.
lt_tmp_dssfield[] = it_dssfield[].
**** Delete Parameters
DELETE lt_tmp_dssfield WHERE basictype EQ 'P'.
**** Delete Duplicates
SORT lt_tmp_dssfield BY reftable.
DELETE ADJACENT DUPLICATES FROM lt_tmp_dssfield COMPARING reftable.
**** Generate Tables Code
LOOP AT lt_tmp_dssfield INTO la_dssfield.
CONCATENATE 'TABLES' la_dssfield-reftable '.' INTO wa_code SEPARATED BY space.
APPEND wa_code TO it_code.
ENDLOOP.
**** Build Selection Screen
DATA: l_tabix(10) TYPE c,
l_type(128) TYPE c,
l_desc(10) TYPE c.
LOOP AT it_dssfield INTO la_dssfield.
l_tabix = sy-tabix.
CONDENSE l_tabix.
wa_code = 'SELECTION-SCREEN BEGIN OF LINE.'.
APPEND wa_code TO it_code.
CONCATENATE 'SELECTION-SCREEN COMMENT 1(32) cmt' l_tabix '.' INTO wa_code.
APPEND wa_code TO it_code.
CONCATENATE la_dssfield-reftable la_dssfield-reffield INTO l_type SEPARATED BY '-'.
CASE la_dssfield-basictype.
WHEN 'P'.
CONCATENATE 'PARAMETERS' la_dssfield-fieldname 'LIKE' l_type '.' INTO wa_code SEPARATED BY space.
WHEN 'S'.
CONCATENATE 'SELECT-OPTIONS' la_dssfield-fieldname 'FOR' l_type '.' INTO wa_code SEPARATED BY space.
WHEN 'V'.
CONCATENATE 'SELECT-OPTIONS' la_dssfield-fieldname 'FOR' l_type ' NO INTERVALS.' INTO wa_code SEPARATED BY space.
ENDCASE.
APPEND wa_code TO it_code.
wa_code = 'SELECTION-SCREEN END OF LINE.'.
APPEND wa_code TO it_code.
ENDLOOP.
**** Initialize Comment Fields
wa_code = 'INITIALIZATION.'.
APPEND wa_code TO it_code.
**** Set GUI-Status
MOVE 'SET PF-STATUS ''STATUS_1000'' OF PROGRAM ''/XXX/ZSYS_GENSELSCREEN''.' to wa_code.
APPEND wa_code to it_code.
**** Set title
DATA: l_stitle type string,
l_sprog type string,
l_stitletxt type string.
MOVE '''TITLE_1000''' To l_stitle.
MOVE '''/XXX/ZSYS_GENSELSCREEN''' to l_sprog.
CONCATENATE 'SET TITLEBAR' l_stitle 'OF PROGRAM' l_sprog 'WITH'
INTO wa_code SEPARATED BY space.
APPEND wa_code TO it_code.
CONCATENATE '''' i_title '''' into wa_code.
append wa_code to it_code.
MOVE '.' to wa_code.
APPEND wa_code TO it_code.
LOOP AT it_dssfield INTO la_dssfield.
l_tabix = sy-tabix.
CONDENSE l_tabix.
CONCATENATE 'cmt' l_tabix INTO l_tabix.
CONCATENATE l_tabix ' = ''' la_dssfield-descr '''.' INTO wa_code.
APPEND wa_code TO it_code.
ENDLOOP.
*** Start of Selection
* wa_code = 'START-OF-SELECTION.'.
* APPEND wa_code TO it_code.
**** AT SELECTION-SCREEN
wa_code = 'AT SELECTION-SCREEN.'.
APPEND wa_code TO it_code.
wa_code = 'DATA: okcode type SYUCOMM.'.
APPEND wa_code TO it_code.
wa_code = 'MOVE sy-ucomm to okcode.'.
APPEND wa_code TO it_code.
* Data types for shared objects
wa_code = 'DATA t_ranges TYPE ACE_FIELD_RANGES_T.'.
APPEND wa_code TO it_code.
wa_code = 'DATA wa_ranges LIKE LINE OF t_ranges.'.
APPEND wa_code TO it_code.
wa_code = 'DATA t_fldrange TYPE ACE_GENERIC_RANGE_T.'.
APPEND wa_code TO it_code.
wa_code = 'DATA wa_fldrange TYPE ACE_GENERIC_RANGE.'.
APPEND wa_code TO it_code.
* Read the input from the selection screen and
* store it in Shared Objects
LOOP AT it_dssfield INTO la_dssfield.
* Assign the fieldname in the variable
CONCATENATE 'wa_ranges-fieldname = '''
la_dssfield-fieldname '''.'
INTO wa_code SEPARATED BY space.
APPEND wa_code TO it_code.
wa_code = 'REFRESH t_fldrange.'.
APPEND wa_code TO it_code.
* Processing for SELECT-OPTIONS
* Loop and move data to the shared memory
IF la_dssfield-basictype EQ 'S'
OR la_dssfield-basictype EQ 'V'.
CONCATENATE 'LOOP AT ' la_dssfield-fieldname '.'
INTO wa_code SEPARATED BY space.
APPEND wa_code TO it_code.
wa_code = 'CLEAR wa_fldrange.'.
APPEND wa_code TO it_code.
CONCATENATE 'MOVE-CORRESPONDING ' la_dssfield-fieldname 'TO' 'wa_fldrange.'
INTO wa_code SEPARATED BY space.
APPEND wa_code TO it_code.
wa_code = 'APPEND wa_fldrange TO t_fldrange.'.
APPEND wa_code TO it_code.
wa_code = 'ENDLOOP.'.
APPEND wa_code TO it_code.
wa_code = 'wa_ranges-fieldrange[] = t_fldrange[].'.
APPEND wa_code TO it_code.
wa_code = 'APPEND wa_ranges TO t_ranges.'.
APPEND wa_code TO it_code.
ELSEIF la_dssfield-basictype EQ 'P'.
* Processing for PARAMETERS
wa_code = 'CLEAR wa_fldrange.'.
APPEND wa_code TO it_code.
* Process if the parameter is not initial
CONCATENATE 'IF ' la_dssfield-fieldname 'IS NOT INITIAL.'
INTO wa_code SEPARATED BY space.
APPEND wa_code TO it_code.
wa_code = 'wa_fldrange-sign = ''I''.'.
APPEND wa_code TO it_code.
wa_code = 'wa_fldrange-option = ''EQ''.'.
APPEND wa_code TO it_code.
CONCATENATE 'wa_fldrange-low = ' la_dssfield-fieldname '.'
INTO wa_code SEPARATED BY space.
APPEND wa_code TO it_code.
wa_code = 'APPEND wa_fldrange TO t_fldrange.'.
APPEND wa_code TO it_code.
wa_code = 'ENDIF.'.
APPEND wa_code TO it_code.
wa_code = 'wa_ranges-fieldrange[] = t_fldrange[].'.
APPEND wa_code TO it_code.
wa_code = 'APPEND wa_ranges TO t_ranges.'.
APPEND wa_code TO it_code.
ENDIF.
ENDLOOP.
wa_code = 'DATA: area type ref to /XXX/zsmasys_genselscreen.'.
APPEND wa_code TO it_code.
wa_code = 'DATA root type REF to /XXX/zclsys_genselscreen.'.
APPEND wa_code TO it_code.
* Get ref to the shared memory
wa_code = 'area = /XXX/zsmasys_genselscreen=>attach_for_write( ).'.
APPEND wa_code TO it_code.
wa_code = 'create object root area handle area.'.
APPEND wa_code TO it_code.
* Store the value in memory
wa_code = 'root->set_fields( t_ranges ).'.
APPEND wa_code TO it_code.
* Store ok_code in memory
wa_code = ' root->set_okcode( okcode ).'.
APPEND wa_code TO it_code.
wa_code = 'area->set_root( root ).'.
APPEND wa_code TO it_code.
* Commit and detatch
wa_code = 'area->detach_commit( ).'.
APPEND wa_code TO it_code.
* Quit the program: Return to the main code
wa_code = 'LEAVE PROGRAM.'.
APPEND wa_code TO it_code.
* Generate the report program
INSERT REPORT '/XXX/ZSYS_GENSELSCREEN' FROM it_code.
COMMIT WORK.
* Execute the report
SUBMIT /XXX/zsys_genselscreen VIA SELECTION-SCREEN AND RETURN.
Importing parameters are:
it_dssfield type /XXX/zTsys_dssfield
i_title type title_txt
/XXX/ztsys_dssfield has the following line structure:
FIELDNAME CHAR08
REFTABLE TABNAME
REFFIELD FIELDNAME
BASICTYPE CHAR01
DESCR CHAR30_BRO
I hope It helps you!
I'm looking for a way to do the same in a selection-screen Pop-Up.
For further questens contact me!
Regards Christian -
Hy!
I have a table control with a button SORT and I want the result of pushing this button to be put in an Excel file ( the sorted records).
Any suggestions ?
Many thanks.check the sy-ucomm. or okcode.
if sy-ucomm = 'SORT'.
sort the internal table.
call gui_download. -
Set cursor to ALV objects from portal
Hi,
I am trying to pull a report from SEM cockpit by integrating it with portal.
For retrieving that report i need to select and click on a particular ALV OBJECT in that frame.I tried passing sy-ucomm as okcode from portal but it didnot workout as it is not selecting the report.
Any suggestions on how to do it?
Thanks in advance
MadhuriHi,
Thanks for the reply,
I am trying to run the job from "build registry search index" but it remains in "queue" state and its status is not changing.
I have confirmed process scheduler status by running another job from there and that job was executed/posted successfully but this job is still in queue state.
Can any one help me in this regard? -
In SMOD tcode for Enhancement SDW00003 i saw code is +DW3
Similarly for SDW00002 its displaying the code as +DW2
Whats tht code.
Where can we find it & why its used.
Thanks in advance.hi,
<b>1</b>. This particular enhancement comes under <b>'MENU ENHANCEMENTS'</b> which means u can enhance certain standard SAP menu's to add your own items. and u can also provide functionality of your interest to it.
<b>2</b>. for this funcitonality to happen when u click on the added item, there must be a function code which the system will capture.
in the present case <b>+DW2</b> is a similar thing.
u write the functionality as below.
<b>OKCODE = SY-UCOMM
CASE OKCODE
WHEN '+DW2'.
write "HELLO''.
ENDCASE.</b>
<b>3</b>. since u will have to write code lines to give required fucnctionality, <b>menu exits mostly require a function module exit also.</b>
hope that helps...
pls. reward if useful... -
hi,
how to write the user command on alv report and the output should ne upload into va02,
My requirement is i have developed a alv report,in that the requiremnt is one pushbutton they want,when they clicked it the output should be upload into va02 transaction.
Thanks and Regards,Hi Ali,
For user command in alv,
First set the PF Status of that ALV,
and in the FM Reuse_alv_grid_display pass the subroutine name fr user command,
in its parameter --> i_callback_user_command = 'COMM'
Then to catch the function module you have to write like for eg,
FORM comm USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
DATA: okcode TYPE sy-ucomm.
okcode = ucomm.
CASE okcode.
WHEN 'REF'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'MANSI'
txt1 = 'CREATED BY'
txt2 = SY-UNAME
TXT3 = ' '
TXT4 = ' '
That is on that buttons click you can use set parameter id statement to move your
control from this screen to the required screen.
Hope it helps you
Regrds
Mansi -
Hi,
Can anyone plz help me with the sy-ucomm value for enter key.
Thanks..Hi Renu,
The OKCODE or SY_UCOMM value is not same for 'ENTER' in all the cases. So its better to go for debugging .
Whenever you want to know the ok code or sy-ucomm value of a key , type '/h' in the command box and press enter. It shows a message on the status bar 'Debugging Switched On'. Now if you press any key , it switches to debugging mode and type sy-ucomm in the fields list then you will get the SY-UCOMM or OK CODE.
Incase of ALVs also you can get the SY-UCOMM. But in some cases the SY-UCOMM value may be NULL.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Mar 25, 2008 4:50 PM -
HI ALL,
HOW TO FIND OKCODE FOR A PARTICULAR BUTTONS IN THE MENUBAR,APP TOOL BAR AND STANDARD TOOL BAR?
WITH WARM REGARDS,
KHADAR.Hi,
you can find in a Simple ways,
1) Just enter /H(Debugging) in the Command bar and press the button, then it will goes to debugging mode, see the Sy-UCOMM there, you will fidn the Ok Code
2) Goto SE51 and enter the program name and the Screen No and see the Attributes of that button, there you will fidn the OK_Code
3) In Scrren press that button and hold it and press F1.
Regards
Sudheer -
Wat is fcode and okcodes?
wat is fcode and okcodes?
Hi Chaitra,
FCODE : Function Code
This is mainly used in dialog program.
You go to SE51-Screen Painter.
Say you create a button and give a Fcode (eg. 'HOME '-you can give anything) for that button....
In your PAI (Process after input) when that button is clicked some operation is to be performed....
So this Fcode captures the event(mouse click) and the required operation can be performed.............
Take a look at the syntax in PAI (0501 is the screen number)......
module user_command_0501 input.
case ok_code.
when 'HOME'.
DO THE REQUIRED OPERATION.........
endcase.
endmodule.
ok_code is the sy-ucomm value
(to capture the user command)
syntax:
data: ok_code like sy-ucomm
Hope I have answered your question!!!!
Please reward points if answered.
thanks and regards,
Vinod Samuel. -
how many okcode u can create in modulepool and how to clear okcode?
Hi
In case of dialog programs , each screen has an okcode field associated with it.
okcode captures the user command on PAI .
plz take a look at the code below for further clarification :
Data : ok_code type sy-ucomm.
" in the PAI module MODULE_USER_COMMAND for screen XXX
module module_user_command .
ok_code = sy-ucomm.
CASE ok_code.
WHEN ' ' .
" write the code for the operation to b performed
WHEN ' ' .
" write code 2 for another command
ENDCASE.
endmodule.
use CLEAR ok_code to clear the value of ok_code.
One screen in a module pool program can have a maximum of 1 okcode.
In the same lines , a module pool program can have as many okcode as the number of screens in it.
i hope it helps u..in case of further queries plz revert.
Regards
Pankaj -
IHi gurus,
I have this requirement in which in 1st screen there are 2 tapstips. when we press the 1st tab one a subscreen containing table control gets opened. On pressing the 2nd tab another table control gets opened. The problem is that I am not able to pass the okcode to the next screen for both the cases as ok remains blank in subscreen. What is the way out. Can anyone suggest me how to go about it. Any kind of help will be handsomely rewarded.
Regards.
D.MallickOK_CODE will be Blank in Subscreen.
Deefine your own copy of OK_CODE (MAY be XCODE) and pass value to that and use that in your subscreen.
OR USe SY-UCOMM.....
Vinodh Balakrishnan -
Daer All:
I have problem with okcode.
I click the GUI button and it can work.
But i click the CUI button in the next screen, it can"t work.
I think the reason is i don't clear the former okcode.
To use GUI buttons in the next screen, can someone tell me where I can clear okcode.
Thanks.
The code :
<garbled code removed by moderator>
Moderator message: please post only relevant code parts, your posts must contain less than 5000 characters to preserve readable formatting.
Edited by: Thomas Zloch on Nov 8, 2011 11:40 AMDear max bianchi:
I repost the code:
REPORT ZCH9TABCTRL.
*SCREENu8B8Au6578
*SCREENu5143u7D20 u5C0Du61C9
TABLES: ZQACHK.
*u5BA3u544ASCREENu8B8Au6578u5167u8868
DATA : t_ZQACHK TYPE STANDARD TABLE OF ZQACHK WITH HEADER
LINE.
*u5BA3u544A table control u8B8Au6578
CONTROLS : tabctrl TYPE TABLEVIEW USING SCREEN '9200'.
*GUIu8B8Au6578
DATA OK_CODE LIKE SY-UCOMM.
*for SCREEN 9002 GUI
DATA : ACTION TYPE C. "1 -->CREATE 2--->Change 3. Display
CALL SCREEN 9200.
*& Module SHOW_TABDATA OUTPUT
* text
MODULE SHOW_TABDATA OUTPUT.
MOVE-CORRESPONDING t_ZQACHK TO ZQACHK.
ENDMODULE. " SHOW_TABDATA OUTPUT
*& Module MARK_LINE INPUT
* text
MODULE MARK_LINE INPUT.
* u53D6u5F97screenu8207itabu4E4Bu884Cu6578u5C0Du61C9u4F86u4FEEu6539u5167u5BB9
MODIFY t_ZQACHK FROM ZQACHK INDEX tabctrl-CURRENT_LINE.
ENDMODULE. " MARK_LINE INPUT
*& Module STATUS_9200 OUTPUT
* text
MODULE STATUS_9200 OUTPUT.
SET PF-STATUS 'ZCH9TABCTRL'.
* SET TITLEBAR 'xxx'.
*u6E05u9664u4E0Au6B21u8B8Au6578
CLEAR OK_CODE.
ENDMODULE. " STATUS_9200 OUTPUT
*& Module USER_COMMAND_9200 INPUT
* text
MODULE USER_COMMAND_9200 INPUT.
CASE ok_code.
WHEN 'MODIFY'.
action = 2.
* u8B80u6709u6A19u8A18u5230u4E4Bu5167u8868
READ TABLE t_ZQACHK WITH KEY mark = 'X'.
*u82E5u6709u8B80u6210
IF sy-subrc = 0.
* u5C07u5167u8868u8F38u5230SCREEN
MOVE-CORRESPONDING t_ZQACHK TO ZQACHK.
* u547Cu53EB SCREEN
CALL SCREEN 9000.
ENDIF.
WHEN 'DISPLAY'.
action = 3.
READ TABLE t_ZQACHK WITH KEY mark = 'X'.
IF sy-subrc = 0.
MOVE-CORRESPONDING t_ZQACHK TO ZQACHK.
CALL SCREEN 9000.
ENDIF.
WHEN 'DELETE'.
READ TABLE t_ZQACHK WITH KEY mark = 'X'.
IF sy-subrc = 0.
ENDIF.
ENDCASE.
ENDMODULE. " USER_COMMAND_9200 INPUT
*& Module EXIT_9200 INPUT
* text
MODULE EXIT_9200 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
SET SCREEN 0.
LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " EXIT_9200 INPUT
*& Module STATUS_9000 OUTPUT
* text
MODULE STATUS_9000 OUTPUT.
WRITE: OK_CODE.
CLEAR OK_CODE.
WRITE: OK_CODE.
SET PF-STATUS 'STATUS_9000'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_9000 OUTPUT
*& Module USER_COMMAND_9000 INPUT
* text
MODULE USER_COMMAND_9000 INPUT.
CASE OK_CODE.
WHEN 'SAVE'.
CASE ACTION.
* u65B0u589E
WHEN 1.
ZQACHK-mandt = sy-mandt.
INSERT ZQACHK.
IF sy-subrc = 0.
MESSAGE 'u65B0u589Eu8CC7u6599u6210u529F'(002) TYPE 'S'.
ENDIF.
* u4FEEu6539
WHEN 2.
UPDATE ZQACHK.
IF sy-subrc = 0.
MESSAGE 'u4FEEu6539u8CC7u6599u6210u529F'(003) TYPE 'S'.
ENDIF.
CLEAR ZQACHK.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.
WHEN 'EXIT'.
LEAVE PROGRAM .
WHEN 'CANCEL'.
LEAVE PROGRAM .
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
Maybe you are looking for
-
How do I make and distribute and image to multiple macbooks?
Hello, I am the IT support person for a number of schools. We use a mixture of Macs and PCs. I am looking for a nice tidy option to create an image of a "master" client and distribute to a group of student Macbooks. All the Macbooks are the same mo
-
Iconed labels and iconified JFrame
Hello everybody, I have a problem with a strange behaviour of a JFrame. In order: 1. I initialize a JFrame with a JSplitPane 2. The left component is a JPanel containing 64 JLabels, each with an Icon in it. When the frame is coming up, everything is
-
A month ago I had some serious virus issues that effected iTunes. I had a computer repair tech come in and clean the computer. He was able to reinstall iTunes and restore most of the music files. Two problems were encountered during this process. 1)
-
hi. I have a problem. sender system send an IDOC to XI. when I check the IDOC in WE02 found that one of fields of the idoc have a "#" (Torre B1 - B#Unimev). When XI recive the IDOC with XML format the "#" character is transformer to " "(Torre B1 - B
-
While execute a Procedure i got error
ORA-00600: internal error code,arguments: [kksscl-inf-inl-loop], [1500], [0], [1], [3], [3], [], []