First Try with JE BDB - Indexes and Inheritance troubles... (FIXED)
Hi Mark,
Mark wrote:
Hi, I'm a newbie here trying some stuff on JE BDB. And now I'm having
I am happy to help you with this, but I'll have to ask you to re-post this question to the BDB JE forum, which is...
Sorry for the mistake. I know now that here is the place to post my doubts.
I'm really interested in JE BDB product. I think it is fantastic!
Regarding my first post about "Indexes and Inheritance" on JE BDB, I found out the fix for that and actually, it wasn't about "Indexes and Inheritance" but "*Inheritance and Sequence*" because I have my "@Persistent public abstract class AbstractEntity" with a "@PrimaryKey(sequence = "ID_SEQ") private Long id" property.
This class is extended by all my business classes (@Entity Employee and @Entity Department) so that my business classes have their PrimaryKey autoincremented by the sequence.
But, all my business classes have the same Sequence Name: "ID_SEQ" then, when I start running my JE BDB at first time, I start saving 3 new Department objects and the sequence for these department objects star with "#1" and finishes with #3.
Then I continue saving Employee objects (here was the problem) I thought that my next Sequence number could be #4 but actually it was #101 so when I tried to save my very first Employee, I set the property "managerId=null" since this employee is the Manager, then, when I tried to save my second Employee who is working under the first one (the manager employee), I got the following exception message:
TryingJEBDBApp DatabaseExcaption: com.sleepycat.je.ForeignConstraintException: (JE 4.0.71) Secondary persist#EntityStoreName#com.dmp.gamblit.persistence.BDB.store.eployee.Employee#*managerId*
foreign key not allowed: it is not present in the foreign database
persist#EntityStoreName#com.dmp.gamblit.persistence.BDB.store.eployee.Employee
The solution:
I fixed it modifying the managerId value from "4" to "101" and it works now!
At this moment I'm trying to understand the Sequence mechanism and refining concerns about Cursors manipulation...
Have you any good material about these topics, perhaps a link where I can find more detailed information on these?
Thanks in advance Mark, thanks for your attention on this and I will post more doubts in the future for sure ;0)
Regards,
Diego
Hi Diego,
I fixed it modifying the managerId value from "4" to "101" and it works now!I'm glad you found the problem. It is usually best to get the assigned ID from the entity object after you call put(), and then use that value to fill in related fields in other entities. The primary key field (assigned from the sequence) is set by the put() method.
At this moment I'm trying to understand the Sequence mechanism and refining concerns about Cursors manipulation...Have you any good material about these topics, perhaps a link where I can find more detailed information on these? >
To find documentation, start at the first message in the forum, the Welcome message:
http://forums.oracle.com/forums/ann.jspa?annID=250
This refers to the main JE doc page, the JE FAQ and a white paper on DPL queries. The FAQ has a section on the DPL, which refers to the javadoc. The DPL javadoc has lots of info on using cursors along with indexes (see EntityIndex, PrimaryIndex, SecondaryIndex). The white paper will be useful to you if you're accustomed to using SQL.
I don't know of any doc on sequences other than the javadoc:
http://www.oracle.com/technology/documentation/berkeley-db/je/java/com/sleepycat/persist/model/PrimaryKey.html#sequence()
This doc will point you to info on configuring the sequence, if that's what you're interested in.
--mark
Similar Messages
-
If you have a table with a unique index and ignore_dup_key = on and you INSERT rows into that table with an ORDER BY clause (because you want to control which of the duplicate
key rows gets inserted), the wrong row gets inserted in SQL2012. It works correctly in SQL 2008.
We have recently migrated a database from SQL 2008 to SQL 2012. We do have few other dbs which are in compatability mode 100. The above operation works fine
in SQL 2008 dbs but not SQL 2012.
I've even tried applying the latest patch for SQL 2012 SP2 with CU2. Still the problem exists. I'm going to call MS support, but want to know if anyone has come across this problem ?The MS documentation doesn't guarantee that the first row of the duplicates will always be inserted and the next duplicate row(s) get(s) ignored. Where did you find it in the MS documentation? I think you were just lucky that it was always inserting the
first row in SQL 2008 (and ignoring the rest of the duplicates) - I don't think this is guaranteed
Satish Kartan http://www.sqlfood.com/ -
First try with ALV Grid and Abap Objects
Hi,
this is my first try to write a simple report which just reads a textfile and display it in an ALV Grid. As a basis, I used some examples from SDN, but it did not work as expected
I would like just to use a docking container. I do not need a separate area for the ALV Grid. The report gives no syntax errors, but it just display the report title, nothing else. SAP R/3 Release is 4.7. Below is the source code of the report. Any idea what is missing?
*& Report Z_PLAN_TEXT_UPLOAD *
REPORT z_plan_text_upload.
INCLUDE <icon>.
* Data Declaration
DATA:
gf_dynnr TYPE sy-dynnr,
gf_repid TYPE sy-repid.
DATA:
go_docking_container TYPE REF TO cl_gui_docking_container,
go_alv_grid TYPE REF TO cl_gui_alv_grid.
DATA:
gt_fieldcat TYPE lvc_t_fcat,
gs_fieldcat LIKE LINE OF gt_fieldcat.
TYPES:
BEGIN OF gy_text_input,
firma(20) TYPE c,
kostenstelle(20) TYPE c,
datenart1(10) TYPE c,
planjahr(10) TYPE c,
* planperiode TYPE co_perio,
planperiode(5) TYPE c,
datenart2(10) TYPE c,
planungposition(10) TYPE c,
* kostenart TYPE koart,
kostenart(10) TYPE c,
* planbetrag TYPE bapicurr_d,
planbetrag(20) TYPE c,
END OF gy_text_input.
DATA:
gt_text_input TYPE TABLE OF gy_text_input,
gs_text_input LIKE LINE OF gt_text_input.
* Local Class Definition
* Local Class Implementation
* Selection-Screen
SELECTION-SCREEN BEGIN OF BLOCK b1
WITH FRAME TITLE text-001.
SKIP.
PARAMETERS:
gp_file TYPE localfile,
gp_head TYPE checkbox DEFAULT 'X'.
SKIP.
PARAMETERS:
gp_gjahr LIKE coep-gjahr,
gp_versn LIKE coep-versn.
SELECTION-SCREEN END OF BLOCK b1.
* Initialization
INITIALIZATION.
DATA:
lf_sapworkdir TYPE string.
CALL METHOD cl_gui_frontend_services=>get_sapgui_workdir
CHANGING
sapworkdir = lf_sapworkdir
EXCEPTIONS
get_sapworkdir_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc <> 0 OR lf_sapworkdir = ''.
CALL METHOD cl_gui_frontend_services=>directory_get_current
CHANGING
current_directory = lf_sapworkdir
EXCEPTIONS
directory_get_current_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
CALL METHOD cl_gui_cfw=>flush.
ENDIF."sy-subrc <> 0 OR sapworkdir = ''
gp_file = lf_sapworkdir.
gf_dynnr = sy-dynnr.
gf_repid = sy-repid.
* At Selection-Screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR gp_file.
DATA:
lt_filetable TYPE filetable,
ls_filetable LIKE LINE OF lt_filetable,
lt_rc TYPE i.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
* EXPORTING
* WINDOW_TITLE =
* DEFAULT_EXTENSION =
* DEFAULT_FILENAME =
* FILE_FILTER =
* INITIAL_DIRECTORY =
* MULTISELECTION =
* WITH_ENCODING =
CHANGING
file_table = lt_filetable
rc = lt_rc
* USER_ACTION =
* FILE_ENCODING =
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
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 lt_filetable INDEX 1
INTO
ls_filetable.
gp_file = ls_filetable-filename.
CALL METHOD cl_gui_cfw=>flush.
* Start-Of-Selection
START-OF-SELECTION.
DATA:
lf_filename LIKE filename-fileintern.
lf_filename = gp_file.
CALL FUNCTION 'FILE_READ_AND_CONVERT_SAP_DATA'
EXPORTING
i_filename = lf_filename
i_servertyp = 'PRS '
i_fileformat = 'TXT'
* I_FIELD_SEPERATOR =
i_line_header = gp_head
* IMPORTING
* E_BIN_FILELENGTH =
TABLES
i_tab_receiver = gt_text_input
EXCEPTIONS
file_not_found = 1
close_failed = 2
authorization_failed = 3
open_failed = 4
conversion_failed = 5
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*------ Build the Field Catalog ---------------------------------------*
PERFORM build_fieldcatalog
CHANGING gt_fieldcat.
*------ Create the docking container ----------------------------------*
IF go_docking_container IS INITIAL.
CREATE OBJECT go_docking_container
EXPORTING
* PARENT =
repid = gf_repid
dynnr = gf_dynnr
* SIDE = go_docking_container->DOCK_AT_bottom
* EXTENSION = 200
* STYLE =
* LIFETIME = lifetime_default
* CAPTION =
* METRIC = 0
* RATIO =
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF."go_docking_container IS INITIAL
*------ Create the ALV Grid -------------------------------------------*
IF go_alv_grid IS INITIAL.
CREATE OBJECT go_alv_grid
EXPORTING
* I_SHELLSTYLE = 0
* I_LIFETIME =
i_parent = go_docking_container
* I_APPL_EVENTS = space
* I_PARENTDBG =
* I_APPLOGPARENT =
* I_GRAPHICSPARENT =
* I_NAME =
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF."go_alv_grid is initial
*------ Call ALV Grid -------------------------------------------------*
CALL METHOD go_alv_grid->set_table_for_first_display
* EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
* IS_LAYOUT =
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
CHANGING
it_outtab = gt_text_input
it_fieldcatalog = gt_fieldcat
* IT_SORT =
* IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
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 build_fieldcatalog
* text
* <--P_GT_FIELDCAT text
FORM build_fieldcatalog
CHANGING
pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
ls_fcat-fieldname = 'FIRMA' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '20' .
ls_fcat-coltext = 'Firma' .
ls_fcat-seltext = 'Firma' .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'KOSTENSTELLE' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '20' .
ls_fcat-coltext = 'Kostenstelle' .
ls_fcat-seltext = 'Kostenstelle' .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'DATENART1' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'Datenart1' .
ls_fcat-seltext = 'Datenart1' .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'PLANJAHR' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'Planjahr' .
ls_fcat-seltext = 'Planjahr' .
APPEND ls_fcat TO pt_fieldcat .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'PLANPERIODE' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '5' .
ls_fcat-coltext = 'Planperiode' .
ls_fcat-seltext = 'Planperiode' .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'DATENART2' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'Datenart2' .
ls_fcat-seltext = 'Datenart2' .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'PLANUNGSPOSITION' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'Planungsposition' .
ls_fcat-seltext = 'Planungsposition' .
APPEND ls_fcat TO pt_fieldcat .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'KOSTENART' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'Kostenart' .
ls_fcat-seltext = 'Kostenart' .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'PLANBETRAG' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '20' .
ls_fcat-coltext = 'Planbetrag' .
ls_fcat-seltext = 'Planbetrag' .
APPEND ls_fcat TO pt_fieldcat .
ENDFORM. "build_fieldcatalogI have added some more functionality to my report. The good thing is, the report works as it should.
BUT, I'm not really sure, whether this is a good (correct) design. The report works the following way:
1. Read planning data form text file into internal table
2. Display the internal table
3. Convert the data and display the converted result
4. Post the converted data to the system
5. Display log with messages
The main thing is, I would like to know, do i really need two dynros, to display the two different internal tables or is it possible just to use one ALV-Grid? I was not able to find another solution. Any comment or help to the report is appreciated.
*& Report Z_PLAN_TEXT_UPLOAD_TEST *
REPORT z_plan_text_upload_test.
INCLUDE <icon>.
* Data Declaration
DATA:
gf_okcode TYPE ui_func,
gf_balloghndl TYPE balloghndl.
DATA:
go_docking_container TYPE REF TO cl_gui_docking_container,
go_alv_grid_0100 TYPE REF TO cl_gui_alv_grid,
go_alv_grid_0200 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_fieldcat TYPE lvc_t_fcat,
gs_fieldcat LIKE LINE OF gt_fieldcat.
TYPES:
BEGIN OF gy_text_input,
firma(20) TYPE c,
kostenstelle(20) TYPE c,
datenart1(10) TYPE c,
planjahr(10) TYPE c,
* planperiode TYPE co_perio,
planperiode(5) TYPE c,
datenart2(10) TYPE c,
planungsposition(10) TYPE c,
* kostenart TYPE koart,
kostenart(10) TYPE c,
* planbetrag TYPE bapicurr_d,
planbetrag(20) TYPE c,
END OF gy_text_input.
DATA:
gt_text_input TYPE TABLE OF gy_text_input,
gs_text_input LIKE LINE OF gt_text_input.
* Bapi Strukturen
DATA:
gs_headerinfo TYPE bapiplnhdr,
gt_indexstructure TYPE TABLE OF bapiacpstru,
gs_indexstructure LIKE LINE OF gt_indexstructure,
gt_coobject TYPE TABLE OF bapipcpobj,
gs_coobject LIKE LINE OF gt_coobject,
gt_pervalue TYPE TABLE OF bapipcpval,
gs_pervalue LIKE LINE OF gt_pervalue,
gt_return TYPE TABLE OF bapiret2,
gs_return LIKE LINE OF gt_return,
gt_control TYPE TABLE OF bapipcpctrl,
gt_totvalue TYPE TABLE OF bapipcptot.
TYPES:
BEGIN OF gy_bapi_input,
version TYPE versn,
* perio TYPE co_perio,
fisc_year TYPE gjahr,
coobject(10) TYPE c,
cost_elem TYPE kstar,
wkgbtr01 TYPE wkgxxx,
wkgbtr02 TYPE wkgxxx,
wkgbtr03 TYPE wkgxxx,
wkgbtr04 TYPE wkgxxx,
wkgbtr05 TYPE wkgxxx,
wkgbtr06 TYPE wkgxxx,
wkgbtr07 TYPE wkgxxx,
wkgbtr08 TYPE wkgxxx,
wkgbtr09 TYPE wkgxxx,
wkgbtr10 TYPE wkgxxx,
wkgbtr11 TYPE wkgxxx,
wkgbtr12 TYPE wkgxxx,
END OF gy_bapi_input.
DATA:
gt_bapi_input TYPE TABLE OF gy_bapi_input,
gs_bapi_input LIKE LINE OF gt_bapi_input.
* Anwendungs-Log
DATA: gs_balsmsg TYPE bal_s_msg.
* Selection-Screen
SELECTION-SCREEN BEGIN OF BLOCK b1
WITH FRAME TITLE text-001.
PARAMETERS:
gp_file TYPE localfile,
gp_head TYPE checkbox DEFAULT 'X'.
SELECTION-SCREEN SKIP.
PARAMETERS:
gp_kokrs LIKE coep-kokrs,
gp_gjahr LIKE coep-gjahr,
gp_versn LIKE coep-versn,
gp_test AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK b1.
* Local Class Definition
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar_0100 FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object
e_interactive,
handle_user_command_0100 FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING
e_ucomm,
handle_toolbar_0200 FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object
e_interactive,
handle_user_command_0200 FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING
e_ucomm.
PRIVATE SECTION.
ENDCLASS. "lcl_event_handler DEFINITION
* Local Class Implementation
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_toolbar_0100.
PERFORM handle_toolbar_0100
USING
e_object.
* e_interactive.
ENDMETHOD. "handle_toolbar_0100
METHOD handle_user_command_0100.
PERFORM handle_user_command_0100
USING
e_ucomm.
ENDMETHOD. "handle_user_command_0100
METHOD handle_toolbar_0200.
PERFORM handle_toolbar_0200
USING
e_object.
* e_interactive.
ENDMETHOD. "handle_toolbar_0100
METHOD handle_user_command_0200.
PERFORM handle_user_command_0200
USING
e_ucomm.
ENDMETHOD. "handle_user_command_0100
ENDCLASS. "lcl_event_handler IMPLEMENTATION
* Initialization
INITIALIZATION.
DATA:
lf_sapworkdir TYPE string.
CALL METHOD cl_gui_frontend_services=>get_sapgui_workdir
CHANGING
sapworkdir = lf_sapworkdir
EXCEPTIONS
get_sapworkdir_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc <> 0 OR lf_sapworkdir = ''.
CALL METHOD cl_gui_frontend_services=>directory_get_current
CHANGING
current_directory = lf_sapworkdir
EXCEPTIONS
directory_get_current_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
CALL METHOD cl_gui_cfw=>flush.
ENDIF."sy-subrc <> 0 OR sapworkdir = ''
gp_file = lf_sapworkdir.
* At Selection-Screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR gp_file.
DATA:
lt_filetable TYPE filetable,
ls_filetable LIKE LINE OF lt_filetable,
lt_rc TYPE i.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
* EXPORTING
* WINDOW_TITLE =
* DEFAULT_EXTENSION =
* DEFAULT_FILENAME =
* FILE_FILTER =
* INITIAL_DIRECTORY =
* MULTISELECTION =
* WITH_ENCODING =
CHANGING
file_table = lt_filetable
rc = lt_rc
* USER_ACTION =
* FILE_ENCODING =
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
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 lt_filetable INDEX 1
INTO
ls_filetable.
gp_file = ls_filetable-filename.
CALL METHOD cl_gui_cfw=>flush.
* Start-Of-Selection
START-OF-SELECTION.
DATA:
lf_filename LIKE filename-fileintern.
PERFORM create_log.
gs_return-type = 'I'.
IF gp_test = 'X'.
gs_return-message = text-010.
ELSE.
gs_return-message = text-020.
ENDIF.
PERFORM add_log_message_free_text
USING
gs_return-type
gs_return-message.
lf_filename = gp_file.
CALL FUNCTION 'FILE_READ_AND_CONVERT_SAP_DATA'
EXPORTING
i_filename = lf_filename
i_servertyp = 'PRS '
i_fileformat = 'TXT'
* I_FIELD_SEPERATOR =
i_line_header = gp_head
* IMPORTING
* E_BIN_FILELENGTH =
TABLES
i_tab_receiver = gt_text_input
EXCEPTIONS
file_not_found = 1
close_failed = 2
authorization_failed = 3
open_failed = 4
conversion_failed = 5
OTHERS = 6.
IF sy-subrc <> 0.
gs_balsmsg-msgty = sy-msgty.
gs_balsmsg-msgid = sy-msgid.
gs_balsmsg-msgno = sy-msgno.
gs_balsmsg-msgv1 = sy-msgv1.
gs_balsmsg-msgv2 = sy-msgv2.
gs_balsmsg-msgv3 = sy-msgv3.
gs_balsmsg-msgv4 = sy-msgv4.
PERFORM add_log_message
USING
gs_balsmsg.
ENDIF.
CALL SCREEN '0100'.
*& Module status_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
*------ Create the docking container ----------------------------------*
IF go_docking_container IS INITIAL.
CREATE OBJECT go_docking_container
EXPORTING
parent = cl_gui_container=>screen0
* repid = gf_repid
* dynnr = gf_dynnr
* SIDE = go_docking_container->DOCK_AT_bottom
* EXTENSION = 200
* STYLE =
* LIFETIME = lifetime_default
* CAPTION =
* METRIC = 0
ratio = 95
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*------ Expand docking container to full screen -------------------*
CALL METHOD go_docking_container->set_extension
EXPORTING
extension = 99999 "full-screen size !!!
EXCEPTIONS
cntl_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.
ENDIF."go_docking_container IS INITIAL
*------ Link docking container to screen ------------------------------*
CALL METHOD go_docking_container->link
EXPORTING
repid = sy-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
lifetime_dynpro_dynpro_link = 3
OTHERS = 4
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*------ Build the Field Catalog ---------------------------------------*
PERFORM build_fieldcatalog_input
CHANGING gt_fieldcat.
*------ Create the ALV Grid -------------------------------------------*
IF go_alv_grid_0100 IS INITIAL.
CREATE OBJECT go_alv_grid_0100
EXPORTING
* I_SHELLSTYLE = 0
* I_LIFETIME =
i_parent = go_docking_container
* I_APPL_EVENTS = space
* I_PARENTDBG =
* I_APPLOGPARENT =
* I_GRAPHICSPARENT =
* I_NAME =
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF."go_alv_grid_0100 is initial
*------ Create instance for event handler -----------------------------*
DATA: go_event_handler_0100 TYPE REF TO lcl_event_handler.
CREATE OBJECT go_event_handler_0100.
*------ Register event handler ----------------------------------------*
SET HANDLER go_event_handler_0100->handle_toolbar_0100
FOR go_alv_grid_0100.
SET HANDLER go_event_handler_0100->handle_user_command_0100
FOR go_alv_grid_0100.
*------ Call ALV Grid -------------------------------------------------*
CALL METHOD go_alv_grid_0100->set_table_for_first_display
* EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
* IS_LAYOUT =
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
CHANGING
it_outtab = gt_text_input
it_fieldcatalog = gt_fieldcat
* IT_SORT =
* IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*---- Call method 'set_toolbar_interactive' to raise event TOOLBAR.
CALL METHOD go_alv_grid_0100->set_toolbar_interactive.
ENDMODULE. " status_0100 OUTPUT
*& Module status_0200 OUTPUT
* text
MODULE status_0200 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
*------ Create the docking container ----------------------------------*
IF go_docking_container IS INITIAL.
CREATE OBJECT go_docking_container
EXPORTING
parent = cl_gui_container=>screen0
* repid = gf_repid
* dynnr = gf_dynnr
* SIDE = go_docking_container->DOCK_AT_bottom
* EXTENSION = 200
* STYLE =
* LIFETIME = lifetime_default
* CAPTION =
* METRIC = 0
ratio = 95
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*------ Expand docking container to full screen -------------------*
CALL METHOD go_docking_container->set_extension
EXPORTING
extension = 99999
EXCEPTIONS
cntl_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.
ENDIF."go_docking_container IS INITIAL
*------ Link docking container to screen ------------------------------*
CALL METHOD go_docking_container->link
EXPORTING
repid = sy-repid
dynnr = '0200'
* CONTAINER =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
lifetime_dynpro_dynpro_link = 3
OTHERS = 4
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*------ Build the Field Catalog---------------------------------------*
PERFORM build_fieldcatalog_bapi_input
CHANGING
gt_fieldcat.
*------ Create the ALV Grid -------------------------------------------*
IF go_alv_grid_0200 IS INITIAL.
CREATE OBJECT go_alv_grid_0200
EXPORTING
* I_SHELLSTYLE = 0
* I_LIFETIME =
i_parent = go_docking_container
* I_APPL_EVENTS = space
* I_PARENTDBG =
* I_APPLOGPARENT =
* I_GRAPHICSPARENT =
* I_NAME =
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF."go_alv_grid_0200 is initial
*------ Create instance for event handler -----------------------------*
DATA: go_event_handler_0200 TYPE REF TO lcl_event_handler.
CREATE OBJECT go_event_handler_0200.
*------ Register event handler ----------------------------------------*
SET HANDLER go_event_handler_0200->handle_toolbar_0200
FOR go_alv_grid_0200.
SET HANDLER go_event_handler_0200->handle_user_command_0200
FOR go_alv_grid_0200.
*------ Call ALV Grid -------------------------------------------------*
CALL METHOD go_alv_grid_0200->set_table_for_first_display
* EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
* IS_LAYOUT =
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO =
CHANGING
it_outtab = gt_bapi_input
it_fieldcatalog = gt_fieldcat
* IT_SORT =
* IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*---- Call method 'set_toolbar_interactive' to raise event TOOLBAR.
CALL METHOD go_alv_grid_0200->set_toolbar_interactive.
CALL METHOD go_alv_grid_0200->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
finished = 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.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = go_alv_grid_0200.
ENDMODULE. " status_0200 OUTPUT
*& Module user_command_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gf_okcode.
WHEN 'BACK' OR 'END' OR 'CANC'.
PERFORM exit_program.
WHEN OTHERS.
ENDCASE.
CLEAR gf_okcode.
ENDMODULE. " user_command_0100 INPUT
*& Module user_command_0200 INPUT
* text
MODULE user_command_0200 INPUT.
CASE gf_okcode.
WHEN 'BACK' OR 'END' OR 'CANC'.
PERFORM exit_program.
WHEN OTHERS.
ENDCASE.
CLEAR gf_okcode.
ENDMODULE. " user_command_0200 INPUT
*& Form build_fieldcatalog
* text
* <--P_GT_FIELDCAT text
FORM build_fieldcatalog_input
CHANGING
pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
CLEAR pt_fieldcat.
ls_fcat-fieldname = 'FIRMA' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '20' .
ls_fcat-coltext = 'Firma' .
ls_fcat-seltext = 'Firma' .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'KOSTENSTELLE' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '20' .
ls_fcat-coltext = 'CO-Objekt' .
ls_fcat-seltext = 'CO-Objekt' .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'DATENART1' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'Datenart1' .
ls_fcat-seltext = 'Datenart1' .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'PLANJAHR' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'Planjahr' .
ls_fcat-seltext = 'Planjahr' .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'PLANPERIODE' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '5' .
ls_fcat-coltext = 'Planperiode' .
ls_fcat-seltext = 'Planperiode' .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'DATENART2' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'Datenart2' .
ls_fcat-seltext = 'Datenart2' .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'PLANUNGSPOSITION' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'Planungsposition' .
ls_fcat-seltext = 'Planungsposition' .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'KOSTENART' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '10' .
ls_fcat-coltext = 'Kostenart' .
ls_fcat-seltext = 'Kostenart' .
APPEND ls_fcat TO pt_fieldcat .
ls_fcat-fieldname = 'PLANBETRAG' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '20' .
ls_fcat-coltext = 'Planbetrag' .
ls_fcat-seltext = 'Planbetrag' .
APPEND ls_fcat TO pt_fieldcat .
ENDFORM. "build_fieldcatalog
*& Form handle_toolbar_0100
* text
* -->P_E_OBJECT text
* -->P_E_INTERACTIVE text
FORM handle_toolbar_0100
USING
po_object TYPE REF TO cl_alv_event_toolbar_set.
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
ls_toolbar-butn_type = 0.
ls_toolbar-function = 'KONV'.
ls_toolbar-quickinfo = 'Konvertieren'.
ls_toolbar-text = 'Konvertieren'.
ls_toolbar-disabled = ' '.
APPEND ls_toolbar TO po_object->mt_toolbar.
ENDFORM. " handle_toolbar_0100
*& Form handle_user_command_0100
* text
* -->P_E_UCOMM text
FORM handle_user_command_0100
USING
pf_ucomm TYPE syucomm.
CASE pf_ucomm.
WHEN 'KONV'.
PERFORM convert_data.
ENDCASE.
ENDFORM. " handle_user_command_0100
*& Form exit_program
* text
* --> p1 text
* <-- p2 text
FORM exit_program.
CALL METHOD go_alv_grid_0100->free.
IF NOT go_alv_grid_0200 IS INITIAL.
CALL METHOD go_alv_grid_0200->free.
ENDIF.
CALL METHOD go_docking_container->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
* add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = sy-repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
LEAVE PROGRAM.
ENDFORM. " exit_program
*& Form handle_toolbar_0200
* text
* -->P_E_OBJECT text
* -->P_E_INTERACTIVE text
FORM handle_toolbar_0200
USING
po_object TYPE REF TO cl_alv_event_toolbar_set.
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
ls_toolbar-butn_type = 0.
ls_toolbar-function = 'POST'.
ls_toolbar-quickinfo = 'Buchen'.
ls_toolbar-text = 'Buchen'.
ls_toolbar-disabled = ' '.
APPEND ls_toolbar TO po_object->mt_toolbar.
ENDFORM. " handle_toolbar_0200
*& Form handle_user_command_0200
* text
* -->P_E_UCOMM text
FORM handle_user_command_0200
USING
pf_ucomm TYPE syucomm.
CASE pf_ucomm.
WHEN 'POST'.
PERFORM post.
ENDCASE.
ENDFORM. " handle_user_command_0200
*& Form convert_data
* text
* --> p1 text
* <-- p2 text
FORM convert_data.
DATA: lf_perio(3) TYPE n.
LOOP AT gt_text_input INTO gs_text_input.
TRANSLATE gs_text_input-planbetrag USING '. '.
TRANSLATE gs_text_input-planbetrag USING ',.'.
CONDENSE gs_text_input-planbetrag.
gs_bapi_input-version = gp_versn.
gs_bapi_input-fisc_year = gp_gjahr.
gs_bapi_input-coobject = gs_text_input-kostenstelle.
gs_bapi_input-cost_elem = gs_text_input-kostenart.
lf_perio = gs_text_input-planperiode.
CASE lf_perio.
WHEN '001'.
gs_bapi_input-wkgbtr01 = gs_text_input-planbetrag.
WHEN '002'.
gs_bapi_input-wkgbtr02 = gs_text_input-planbetrag.
WHEN '003'.
gs_bapi_input-wkgbtr03 = gs_text_input-planbetrag.
WHEN '004'.
gs_bapi_input-wkgbtr04 = gs_text_input-planbetrag.
WHEN '005'.
gs_bapi_input-wkgbtr05 = gs_text_input-planbetrag.
WHEN '006'.
gs_bapi_input-wkgbtr06 = gs_text_input-planbetrag.
WHEN '007'.
gs_bapi_input-wkgbtr07 = gs_text_input-planbetrag.
WHEN '008'.
gs_bapi_input-wkgbtr08 = gs_text_input-planbetrag.
WHEN '009'.
gs_bapi_input-wkgbtr09 = gs_text_input-planbetrag.
WHEN '010'.
gs_bapi_input-wkgbtr10 = gs_text_input-planbetrag.
WHEN '011'.
gs_bapi_input-wkgbtr11 = gs_text_input-planbetrag.
WHEN '012'.
gs_bapi_input-wkgbtr12 = gs_text_input-planbetrag.
ENDCASE.
COLLECT gs_bapi_input INTO gt_bapi_input.
CLEAR gs_bapi_input.
ENDLOOP. "at gt_text_input
CALL SCREEN 0200.
ENDFORM. " convert_data
*& Form build_fieldcatalog_bapi_input
* text
* <--P_GT_FIELDCAT text
FORM build_fieldcatalog_bapi_input
CHANGING
pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
CLEAR pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'VERSION' .
ls_fcat-ref_table = 'BAPIPLNHDR' .
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'FISC_YEAR' .
ls_fcat-ref_table = 'BAPIPLNHDR' .
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'COOBJECT' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '20' .
ls_fcat-coltext = 'CO-Objekt' .
ls_fcat-seltext = 'CO-Objekt' .
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'COST_ELEM' .
ls_fcat-ref_table = 'BAPIPCPVAL' .
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'WKGBTR01'.
ls_fcat-ref_table = 'COEP' .
ls_fcat-ref_field = 'WKGBTR'.
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'WKGBTR02'.
ls_fcat-ref_table = 'COEP' .
ls_fcat-ref_field = 'WKGBTR'.
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'WKGBTR03'.
ls_fcat-ref_table = 'COEP' .
ls_fcat-ref_field = 'WKGBTR'.
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'WKGBTR04'.
ls_fcat-ref_table = 'COEP' .
ls_fcat-ref_field = 'WKGBTR'.
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'WKGBTR05'.
ls_fcat-ref_table = 'COEP' .
ls_fcat-ref_field = 'WKGBTR'.
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'WKGBTR06'.
ls_fcat-ref_table = 'COEP' .
ls_fcat-ref_field = 'WKGBTR'.
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'WKGBTR07'.
ls_fcat-ref_table = 'COEP' .
ls_fcat-ref_field = 'WKGBTR'.
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'WKGBTR08'.
ls_fcat-ref_table = 'COEP' .
ls_fcat-ref_field = 'WKGBTR'.
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'WKGBTR09'.
ls_fcat-ref_table = 'COEP' .
ls_fcat-ref_field = 'WKGBTR'.
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'WKGBTR10'.
ls_fcat-ref_table = 'COEP' .
ls_fcat-ref_field = 'WKGBTR'.
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'WKGBTR11'.
ls_fcat-ref_table = 'COEP' .
ls_fcat-ref_field = 'WKGBTR'.
APPEND ls_fcat TO pt_fieldcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'WKGBTR12'.
ls_fcat-ref_table = 'COEP' .
ls_fcat-ref_field = 'WKGBTR'.
APPEND ls_fcat TO pt_fieldcat .
ENDFORM. " build_fieldcatalog_bapi_input
*& Form post
* text
* --> p1 text
* <-- p2 text
FORM post.
DATA:
lf_index(6) TYPE n,
lf_kostl LIKE csks-kostl,
lf_aufnr LIKE aufk-aufnr,
lf_kstar LIKE cska-kstar.
DATA:
lt_csks TYPE TABLE OF csks.
break c5085345.
* Header
gs_headerinfo-co_area = gp_kokrs.
gs_headerinfo-fisc_year = gp_gjahr.
gs_headerinfo-period_from = '001'.
gs_headerinfo-period_to = '012'.
gs_headerinfo-version = gp_versn.
gs_headerinfo-plan_currtype = 'C'.
LOOP AT gt_bapi_input INTO gs_bapi_input.
* Fill index structure
CLEAR gs_indexstructure.
lf_index = sy-tabix.
gs_indexstructure-object_index = lf_index.
gs_indexstructure-value_index = lf_index.
gs_indexstructure-attrib_index = '000000'.
INSERT gs_indexstructure INTO TABLE gt_indexstructure.
* Fill coobject
CLEAR gs_coobject.
gs_coobject-object_index = lf_index.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = gs_bapi_input-coobject
IMPORTING
output = lf_kostl.
SELECT * FROM csks INTO TABLE lt_csks
WHERE
kokrs = gp_kokrs AND
kostl = lf_kostl.
IF sy-subrc = 0.
gs_coobject-costcenter = lf_kostl.
ELSE.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = gs_bapi_input-coobject
IMPORTING
output = lf_aufnr.
CALL FUNCTION 'K_ORDER_READ'
EXPORTING
aufnr = lf_aufnr
EXCEPTIONS
not_found = 1.
IF NOT sy-subrc = 0.
gs_return-type = 'E'.
gs_return-message+0(10) = 'CO-Objekt '.
gs_return-message+10(10) = gs_bapi_input-coobject.
gs_return-message+20(20) = ' existiert nicht.'.
CONDENSE gs_return-message.
PERFORM add_log_message_free_text
USING
gs_return-type
gs_return-message.
EXIT.
ENDIF. "IF NOT sy-subrc = 0
gs_coobject-orderid = lf_aufnr.
ENDIF. "sy-subrc = 0
INSERT gs_coobject INTO TABLE gt_coobject.
* Period value
gs_pervalue-value_index = lf_index.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = gs_bapi_input-cost_elem
IMPORTING
output = lf_kstar.
gs_pervalue-cost_elem = lf_kstar.
gs_pervalue-fix_val_per01 = gs_bapi_input-wkgbtr01.
gs_pervalue-fix_val_per02 = gs_bapi_input-wkgbtr02.
gs_pervalue-fix_val_per03 = gs_bapi_input-wkgbtr03.
gs_pervalue-fix_val_per04 = gs_bapi_input-wkgbtr04.
gs_pervalue-fix_val_per05 = gs_bapi_input-wkgbtr05.
gs_pervalue-fix_val_per06 = gs_bapi_input-wkgbtr06.
gs_pervalue-fix_val_per07 = gs_bapi_input-wkgbtr07.
gs_pervalue-fix_val_per08 = gs_bapi_input-wkgbtr08.
gs_pervalue-fix_val_per09 = gs_bapi_input-wkgbtr09.
gs_pervalue-fix_val_per10 = gs_bapi_input-wkgbtr10.
gs_pervalue-fix_val_per11 = gs_bapi_input-wkgbtr11.
gs_pervalue-fix_val_per12 = gs_bapi_input-wkgbtr12.
INSERT gs_pervalue INTO TABLE gt_pervalue.
ENDLOOP. "at gt_bapi_input
* Buchungsbaustein
CALL FUNCTION 'BAPI_PRIM_COST_CHECK_AND_POST'
EXPORTING
header_info = gs_headerinfo
testrun = gp_test
* DELTA = ' '
TABLES
idx_structure = gt_indexstructure
object = gt_coobject
per_value = gt_pervalue
tot_value = gt_totvalue
contrl = gt_control
return = gt_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
LOOP AT gt_return INTO gs_return.
gs_balsmsg-msgty = gs_return-type.
gs_balsmsg-msgid = gs_return-id.
gs_balsmsg-msgno = gs_return-number.
gs_balsmsg-msgv1 = gs_return-message_v1.
gs_balsmsg-msgv2 = gs_return-message_v2.
gs_balsmsg-msgv3 = gs_return-message_v3.
gs_balsmsg-msgv4 = gs_return-message_v4.
PERFORM add_log_message
USING
gs_balsmsg.
ENDLOOP. "AT gt_return
PERFORM show_log.
ENDFORM. " post
*& Form create_log
* text
* --> p1 text
* <-- p2 text
FORM create_log .
DATA: ls_balslog TYPE bal_s_log.
* Einige Verwaltungsdaten
ls_balslog-extnumber = 'ZPLAN010'.
ls_balslog-aluser = sy-uname.
ls_balslog-alprog = sy-repid.
* Create
CALL FUNCTION 'BAL_LOG_CREATE'
EXPORTING
i_s_log = ls_balslog
* IMPORTING
* e_log_handle = gf_balloghndl
EXCEPTIONS
log_header_inconsistent = 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.
ENDFORM. " create_log
*& Form add_log_message
* text
* -->P_GS_BALSMSG text
FORM add_log_message
USING
ps_balsmsg TYPE bal_s_msg.
break c5085345.
CALL FUNCTION 'BAL_LOG_MSG_ADD'
EXPORTING
* I_LOG_HANDLE =
i_s_msg = ps_balsmsg
* IMPORTING
* E_S_MSG_HANDLE =
* E_MSG_WAS_LOGGED =
* E_MSG_WAS_DISPLAYED =
EXCEPTIONS
log_not_found = 1
msg_inconsistent = 2
log_is_full = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " add_log_messa
*& Form add_log_message_free_text
* text
* -->P_GS_RETURN_TYPE text
* -->P_GS_RETURN_MESSAGE text
FORM add_log_message_free_text
USING
ps_type
ps_message.
CALL FUNCTION 'BAL_LOG_MSG_ADD_FREE_TEXT'
EXPORTING
* I_LOG_HANDLE =
i_msgty = ps_type
* I_PROBCLASS = '4'
i_text = ps_message
* I_S_CONTEXT =
* I_S_PARAMS =
* IMPORTING
* E_S_MSG_HANDLE =
* E_MSG_WAS_LOGGED =
* E_MSG_WAS_DISPLAYED =
EXCEPTIONS
log_not_found = 1
msg_inconsistent = 2
log_is_full = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " add_log_message_free_text
*& Form show_log
* text
* --> p1 text
* <-- p2 text
FORM show_log .
DATA:
l_s_display_profile TYPE bal_s_prof.
* get display profile
CALL FUNCTION 'BAL_DSP_PROFILE_NO_TREE_GET'
IMPORTING
e_s_display_profile = l_s_display_profile
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* use grid for display if wanted
l_s_display_profile-use_grid = 'X'.
* set report to allow saving of variants
l_s_display_profile-disvariant-report = sy-repid.
* when you use also other ALV lists in your report,
* please specify a handle to distinguish between the display
* variants of these different lists, e.g:
l_s_display_profile-disvariant-handle = 'LOG'.
* call display function module
* We do not specify any filter (like I_S_LOG_FILTER, ...,
* I_T_MSG_HANDLE) since we want to display all logs available
CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
EXPORTING
i_s_display_profile = l_s_display_profile
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. -
2 problem with BITMAP JOIN INDEX and access plan
On my schema ("LSA") I have 3 tables:
AAB_VENDUTO (~4.200.000 record)
AAB_ARTICOLO (~8.200 record)
AAB_CLIENTE (~15.000 record)
AAB_ARTICOLO.MARCA has 1079 distinct values
AAB_CLIENTE.TITOLO_STUDIO has 22 distinct values
I create 2 different bitmap join index:
CREATE BITMAP INDEX lsa.AAB_V_ARTICOLO_MARCA_IDX ON LSA.AAB_VENDUTO(MARCA)
FROM LSA.AAB_VENDUTO vv, LSA.AAB_ARTICOLO aa WHERE vv.articolo_id=aa.articolo_id;
CREATE BITMAP INDEX lsa.AAB_V_CLIENTE_TIT_STUDIO_IDX ON LSA.AAB_VENDUTO(TITOLO_STUDIO)
FROM LSA.AAB_VENDUTO vv, LSA.AAB_CLIENTE cc WHERE vv.cliente_id=cc.cliente_id;(star_trasformation_enabled is TRUE)
I run (on SQL Developer 1.5.5) these similar queries:
SELECT DISTINCT VV.cliente_id FROM LSA.AAB_VENDUTO VV JOIN LSA.AAB_ARTICOLO AA on VV.articolo_id=AA.articolo_id
WHERE (MARCA='ALGIDA' OR MARCA='SAMMONTANTA');
SELECT DISTINCT VV.cliente_id FROM LSA.AAB_VENDUTO VV JOIN LSA.AAB_CLIENTE CC on VV.cliente_id=CC.cliente_id
WHERE (titolo_studio='LAUREA BREVE' OR titolo_studio='MAGISTRALE');The first one use correctly the bitmap join index, this is the access plan:
!http://bitlgs.altervista.org/_altervista_ht/marca.png!
but the second query...
!http://bitlgs.altervista.org/_altervista_ht/titolo_studio.png!
why the second query doesn't use the bitmap index?
problem #2:
I create another bitmap index:
CREATE BITMAP INDEX LSA.AAB_V_CLIENTE_SESSO_IDX ON LSA.AAB_VENDUTO(SESSO)
FROM LSA.AAB_VENDUTO vv, LSA.AAB_CLIENTE cc WHERE vv.cliente_id=cc.cliente_id;and I run this query:
SELECT VV.cliente_id, COUNT(*) FROM LSA.AAB_VENDUTO VV JOIN LSA.AAB_CLIENTE CC on VV.cliente_id=CC.cliente_id
WHERE sesso='Donna' and (titolo_studio='LAUREA BREVE' or titolo_studio='MAGISTRALE') GROUP BY VV.cliente_id;this is the access plan:
!http://bitlgs.altervista.org/_altervista_ht/terzo.png!
In my opinion, the part that I have marked as 'A' is superfluous...
why it make a join with AAB_CLIENTE table? Why it filter again the titolo_studio and sesso field?
Edited by: Nirpol on 4-set-2009 13.25Nirpol wrote:
I create 2 different bitmap join index:
CREATE BITMAP INDEX lsa.AAB_V_ARTICOLO_MARCA_IDX ON LSA.AAB_VENDUTO(MARCA)
FROM LSA.AAB_VENDUTO vv, LSA.AAB_ARTICOLO aa WHERE vv.articolo_id=aa.articolo_id;
CREATE BITMAP INDEX lsa.AAB_V_CLIENTE_TIT_STUDIO_IDX ON LSA.AAB_VENDUTO(TITOLO_STUDIO)
FROM LSA.AAB_VENDUTO vv, LSA.AAB_CLIENTE cc WHERE vv.cliente_id=cc.cliente_id;
What happens if you just create two plain bitmap indexes without the join?
CREATE BITMAP INDEX lsa.AAB_V_ARTICOLO_MARCA_IDX ON LSA.AAB_VENDUTO(MARCA);
CREATE BITMAP INDEX lsa.AAB_V_CLIENTE_TIT_STUDIO_IDX ON LSA.AAB_VENDUTO(TITOLO_STUDIO) ;You can also go with normal indexes on the FK rows (cliente_id) and the optimizer can do a bitmap conversion from normal index to bitmap index if needed. Are the column values evenly distributed? If not you might need to go for some column histogram. but I don't have the impression that this is really useful in your case. -
Trouble with creating Spatial Indexes and "user_sdo_geom_metadata"
G'day All,
I've encountered a weird issue while playing around with SDO_GEOMETRY objects under Oracle Apex v3.0.1 on Oracle XE running on Windows Vista.
The issue started when I attempted to create the spatial index :
create index geotag_sdx on geotag(location)
indextype is mdsys.spatial_index;
and I got the following error:
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-13203: failed to read USER_SDO_GEOM_METADATA view
ORA-13203: failed to read USER_SDO_GEOM_METADATA view
I scratched my head for a sec and thought WTF ? my metadata insert worked... well I was sure it did. However when I ran a select from "user_sdo_geom_metadata" there was no rows, so I tried again and I got an error "name is already used by an existing object", again I thought WTF ?
After getting the source for the "updatable" view "MDSYS.user_sdo_geom_metadata" I could see that the view was filter by CURRENT_SCHEMA:
SELECT SDO_TABLE_NAME TABLE_NAME, SDO_COLUMN_NAME COLUMN_NAME, SDO_DIMINFO DIMINFO, SDO_SRID SRID
FROM SDO_GEOM_METADATA_TABLE
WHERE sdo_owner = sys_context('userenv', 'CURRENT_SCHEMA')
I ran SELECT sys_context('userenv', 'CURRENT_SCHEMA') FROM DUAL and it correctly returned the SCHMEA name.
So from sqlplus and logged in a sys/sysdba I ran a select statement from MDSYS.SDO_GEOM_METADATA_TABLE and i saw the problem, the record was inserted with a SDO_OWNER value of "ANONYMOUS".
When I logged as the SCHEMA via sqlplus and ran the metadata insert statement it worked fine an d the index could be created.
Has anyone ran into this issue and how did you fix it as I'm concerned or know what I might be doing wrong ?
Any help would be most appreciated ?
Regards
MarkHi Marks,
Had a quick look at the stored procedure I'm using and there it is. We don't insert into user_sdo_geom_metadatas but in mdsys.sdo_geom_metadata_table and specify the owner ourselves. Of course, you need a direct grant on mdsys.sdo_geom_metadata_table to be able to do this from a stored procedure.
Seems we had the problem you are facing even without Apex. Our application has a special admin user that has execute privs on certain packages. But when running the spatial index creation procedure we ran into this "owner" problem.
Here they use all_sdo_geom_metadata:
Re: Metadata Error
Message was edited by:
renewestenberg -
Issues with reverse key indexes and range scan
I have a question. Why is it that reverse key indexes do not work in a range scan?
ThanksChris, well said in simple terms.
Extract from metalink:
Oracle8 provides the ability to create reverse key indexes. Reverse key indexes
reverse the bytes of each indexed column with the exception of ROWID and still
maintains the column order. Reverse key indexes are useful for Oracle Parallel
Server environments.
In an OPS environment, modifications to indexes are focused on a small
set of leaf blocks. Reversing the keys of the index allows insertions to be
distributed across all the leaf keys in the index. Reverse key indexes prevent
queries from performing an index range scan since lexically adjacent keys
are not stored next to each other. Reverse key indexes can also be used in
situations where users insert ascending values and delete lower values from the
table, thus helping to prevent skewed indexes.
===
Good discussion at
http://asktom.oracle.com/pls/ask/f?p=4950:8:2737861489787945222::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:627823669999
http://asktom.oracle.com/pls/ask/f?p=4950:8:2737861489787945222::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:6163160472530
Jaffar
Message was edited by:
The Human Fly -
I can make the groups but the problem happens when i close firefox and open again.
Make sure that you do not use "Clear Recent History" to clear the 'Browsing History' when you close Firefox or use cleanup software that clears session data (sessionstore.js)
* https://support.mozilla.com/kb/Clear+Recent+History -
Starting to wonder if the iPhone's been hacked into. The Iphone was working perfectly fine just a short time ago...only 48 hours ago. I never saw a screen on the front of the front of the phone which showed an iTunes Icon at the top of the screen and a cord going down to the bottom of the screen before. I cannot use the phone, get online to get to the internet, take photos of anything.
The phone was working perfectly the day it started working very very strangely and I was able to use the phone, see the time of day, take photos, get online, etc.
How do you fix the phone? I am not going to "restore" the phone & get ALL my info, photos & everything deleted!
Think we need to change the phone number because we also got a strange phone call from a phone number we never saw before!
Need some help. as I'm sure people CAN hack into smartphones.It's in recovery mode. It's tryijng to tell you to plug it into iTunes and restore it.
LuvsMacs2014 wrote:
I am not going to "restore" the phone & get ALL my info, photos & everything deleted!
I hate to tell you this, but ALL your "info, photos & everything" are already gone.
You don't have a choice. -
Can't use comcast email account with Firefox. Why and how to fix it?
I cannot open my comcast.net email accounts. I can see the Inbox Preview page but I can open, send a new email, etc.. It started Monday evening November 11, 2011. It happened a couple of times a few weeks ago then resolved.
Download and install the 10.6.8 Combo Update over your current installation of 10.6.8.It should repair whatever is corrupted. The Mac App Store does not belong in the Utilities folder, Mac OS X expects it to be in the Apps folder where it is installed..
Mac OS X v10.6.8 Update Combo v1.1
http://support.apple.com/kb/DL1399 -
when will you fix this issue?
We are just fellow users here, these forums are not monitored by Apple - if you want to leave feedback for Apple then you can do so here http://www.apple.com/feedback/ipad.html
But in terms of the camera connection kit, it works as it is specified- as an SD card reader and as a direct connection to a camera. It is not advertised as being a flash drive connection kit. -
I'm being double billed and having trouble fixing the error.
I've got Creative Cloud (annual membership, billed monthly.) and have paid for the 1st month. But I got a notice saying there are zero days left and to please verify my membership. When I looked at my CC account online it shows I'm being billed twice for CC. I've tried calling customer service but the wait is over 2 hours. Can you help me?
Hi joelressel
It appears that you have 2 active subscriptions for Creative Cloud - one from Jan 3, 2014 and the other from Jul 5, 2014.
I will cancel the 2nd subscription and process refunds for the Jul - Nov charges.
Kind regards
Bev -
Spatial index on table with object-column (and inheritance)
Hi!
Is it possible to create a spatial index on a table with an object-column (and inheritance) like this:
CREATE OR REPLACE TYPE feature_type AS OBJECT (
shape MDSYS.SDO_GEOMETRY
) NOT FINAL;
CREATE OR REPLACE TYPE building_type UNDER feature_type (
name VARCHAR2(50)
CREATE TABLE features ( no NUMBER PRIMARY KEY, feature feature_type);
[...] user_sdo_geom_metadata [...]
Then
CREATE INDEX features_idx ON features(feature.shape) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
throws:
ORA-01418: specified index does not exist
Curious! :)
If I define feature_type with "NOT FINAL" option but without subtypes, I get (create index):
ORA-00604: error occurred at recursive SQL level 1
ORA-01460: unimplemented or unreasonable conversion requested
So I think besides object tables also inheritance isn't supported whith oracle spatial!?
Thanks,
Michael
ps:
We use Oracle9i Enterprise Edition Release 9.0.1.4.0 / Linux.
Solves Oracle9i 9.2 this problems?Hi
You'll need to be on 9.2 to do this....
Dom -
Function-based Index and an OR-condition in the WHERE-clause
We have some problems with functin-based indexes and
the or-condition in a where-clause.
(We use oracle 8i (8.1.7))
create table TPERSON(ID number(10),NAME varchar2(20),...);
create index I_NORMAL_TPERSON_NAME on TPERSON(NAME);
create index I_FUNCTION_TPERSON_NAME on TPERSON(UPPER(NAME));
The following two statements run very fast on a large table
and the execution-plan asure the usage of the indexes
(-while the session is appropriate configured and the table is analyzed):
1) select count(ID) FROM TPERSON where upper(NAME) like 'MIL%';
2) select count(ID) from TPERSON where NAME like 'Mil%' or (3=5);
In particular we see that a normal index is used while the where-clause contains
an OR-CONDITION.
But if we try the similarly select-statement
3) select count(ID) FROM TPERSON where upper(NAME) like 'MIL%' or (3=5);
the CBO will not use the function-index.
(This behavior we only expect with views but not with indexes.)
We ask for an advice like an hint, which enable the CBO-usage
of function-based indexes in connection with OR.
This problem seems to be artificial because it contains this dummy logic:
or (3=5).
This steams from an prepared statement, where this kind of boolean
flag reduce the amount of different select-statements needed for
covering the hole business-logic, while using bind-variables for the
concrete query-parameters.
A more realistic (still boild down) version of our prepared select-statement run in
SQL Plus:
define x_name = 'MIL%';
define x_firstname = '';
select * FROM TPERSON
where (upper(NAME) like '&x_name' or ( '&x_name' = ''))
and (upper(FIRSTNAME) like '&x_firstname' or ('&x_firstname' = ''))
and ...;
In particular we dont refernce the tablecolumn , but the QUERY-Parameter
yield the second boolean value in the or-condition.
The problem is that this condition ('&x_name' = '') dont use any index.
thanks a lot for spending your time with this problemTry
SELECT /*+ RULE */
as your hint. I don't have the book with me, but this last weekend I read a section about your very problem. The book was a Oracle Press gold cover about Oracle 8i Performance tuning. If you e-mail me I can quote you the chapter when I get home Friday. -
Problem with Netbeans 7.1 and ME SDK 3.0.5 plugin
Hi!
I have problem plugin ME SDK 3.0.5 to Netbeans 7.1. When I try to install plugin into Netbeans I get this kind informations:
Warning - could not install some modules: Profiler (Java ME Projects Support) - The module named org.netbeans.modules.profiler/1 was needed and not found. Java ME SDK CPU Profiler Snapshot Viewer - The module named org.netbeans.modules.profiler/1 was needed and not found. 5 further modules could not be installed due to the above problems.
Does anyone know what is wrong?
I am truly grateful for the answer!Hi Anvi,
I think you posted in the right place as the J2ME SDK Team read this forum (though they sometimes don't respond promptly as we would have liked). I also got the same issue as you, but check out the responses by the J2ME SDK Team to: https://blogs.oracle.com/javamesdk/entry/update_java_me_sdk_through
It seems there are issues with Netbeans 7.1, and they are fixing things for the next release for Netbeans 7.1.1 so I am sure they are aware of problems that we are encountering. Its fine for Netbeans 6.9/7 if you cannot wait though. -
Substring search with Oracle context indexes
Hi,
i would like to know if it is possibile to do a substring search with one of the obtion offer with the context indexes.
(ctxcat,ctxrule,context)
example:
i would like to search the word 'berub' in a column A in table_example.
the value in the column a are :
The betther
berube
A.berube
berub
Berub
BERUB
R berube
S tartif
Y Thibeault
the rows return should be :
berube
A.berube
berub
Berub
BERUB
R berube
A simple sql could be
select * from table_example where upper(a) like upper('%berub%' );
How i can do this same action with the context indexes and a select (catsearch, contains, matches), if it is possible?
A example will be welcome
ThanksI know how to do explain plan.
my point is not the query i post, it's just a example.
I have many query on my production we optimize many times (they past from 3min to 15 sec with optimisation, but we want to have better result). At this point we are looking to implant the context indexes to make them more efficient.
Do make this sql more efficient we have to deal with like '%xxxxxx%' and the context indexes like to be a option, but we have to be able to do some substring search with context option.
Is it possible to do it and how?
This is my question and why i post it here. The query is just a simple example to illsutrate what i want.
Thanks to anyone who can answer my question.
Maybe you are looking for
-
I am not able to export a certain project from Final Cut Pro X.
I have never had this problem before. It is only on this certain project. The Share menu will not let me select anything. I even deselected the render background option and it did nothing. Should I just start over?
-
im using adobe premiere cs5 in my mac.. i want to make some clip which is can be played smoothly on PC with output format is .avi and i cant find the options for make the video become .avi in my adobe premiere for mac? what should i do?
-
Backup to Windows Network Share
Hello, I want to backup a Oracle Database to a Windows Server via Network-Share. I set backup_root_dir = servername\share. The sidadm and sapservicesid have full access to the share. If I start the backup I get a error message: BR0282E Directory '\\s
-
I used java.net.InetAddress to get the IP Address by the following applet in TestIP.class file: import java.applet.*; import java.net.*; import java.awt.*; public class TestIP extends Applet { String ip; public void init() { try { ip=InetAddress.getL
-
Query to show a month in which status changed
I have a table with columns containing member_name, Month_report_generated, and Current_status. There is a month report for every month in the year showing the member's status in that month, and the status can change in any month. I am trying to writ