First try at Interfaces
I am taking my first try at Interfaces and having trouble. I created the following 2 interfaces (which may be incorrect). I need to implement it using the class that follows, using these functions, but I'm stuck - can you help?
public interface Openings {
* Add an opening that reduces the Wall's surface area calculation by
* the area of the opening.
* @param fs a <code>FlatSurface</code> value
* @return a <code>boolean</code> value that is true when the flat
* surface was added, else false.
public boolean addOpening(FlatSurface s);
//Wall length
int side1Length = 17;
int side2Length = 8;
public interface FlatSurface {
// ceiling, window, and door instances
float ceilingHeight = 8.5F;
float doorWidth = 3.5F;
float doorHeight = 6.75F;
int windowWidth = 3;
int windowHeight = 4;
/** The length of the surface as measured in feet. */
double getLength();
/** Set the length of the surface as measured in feet. */
void setLength(double feet);
/** The width of the surface as measured in feet. */
double getWidth();
/** Set the width of the surface as measured in feet. */
void setWidth(double feet);
/** Calculate and return the area of the surface in square feet. */
double area();
public class Wall extends Surface implements Openings {
//make north, east, south, and west walls in the Room superclass
//The implementation of the Openings interface should manage windows and the door appropriately for each of the four walls
double northWall = (side1Length * ceilingHeight) - windowArea;
double eastWall = (side2Length * ceilingHeight) - windowArea;
double southWall = (side1Length * ceilingHeight) - (2 * windowArea);
double westWall = (side2Length * ceilingHeight) - doorArea;
double wallArea = northWall + eastWall + southWall + westWall;
double ceilingArea = side1Length * side2Length;
}
Thanks for the reply. That helps with the hierarchy, the following explains how it will work. Now I'm just stumbling with the coding of Wall & Surface. I included the new code after the explained hierarchy - can you help?
Public Surface class (Surface.java) implements the FlatSurface interface. This class makes ceiling, window, and door instances within the Room class.
Public Wall class (Wall.java) that extends Surface and implements the Openings interface. This class makes north, east, south, and west walls in the Room class. The implementation of the Openings interface should manage windows and the door appropriately for each of the four walls.
Room (base, superclass)
| * has 4 Walls, one Ceiling
+- Surface
| * makes ceiling, window, and door instances within the Room class
+- FlatSurface
| * has dimensions
+- Wall
| * makes north, east, south, and west walls in the Room class;
+- Openings
| * public boolean addOpening(FlatSurface s);
// FlatSurface interface is a two dimentional area with sides that are measured in feet.
public interface FlatSurface {
/** The length of the surface as measured in feet. */
double getLength();
/** Set the length of the surface as measured in feet. */
void setLength(double feet);
/** The width of the surface as measured in feet. */
double getWidth();
/** Set the width of the surface as measured in feet. */
void setWidth(double feet);
/** Calculate and return the area of the surface in square feet. */
double area();
//Openings interface - add an opening that reduces the Wall's surface area calculation by the area of the opening.
public interface Openings {
* @param fs a <code>FlatSurface</code> value
* @return a <code>boolean</code> value that is true when the flat
* surface was added, else false.
public boolean addOpening(FlatSurface s);
All those "xLength" and "xArea" values are fixed and now I think I should declare and use them in Wall & Surface to make the calculations? -
public class Surface implements FlatSurface {
// ceiling, window, and door instances
float ceilingHeight = 8.5F;
float doorWidth = 3.5F;
float doorHeight = 6.75F;
int windowWidth = 3;
int windowHeight = 4;
// Declare and initialize doorArea
float doorArea = doorWidth * doorHeight;
// Declare and initialize windowArea
int windowArea = windowWidth * windowHeight;
I created the original program as a single Room.java that functions perfectly - do you want to see that? I am now attempting to extend it into interfaces.
Similar Messages
-
Intra-Interface-Traffic fails at first try - second try works
Hi,
we are running two ASA5550 as fail-over.
Everything works fine. But there is still a little "bug".
same-security-traffic permit intra-interface
is enabled.
Now, let's open an PostgreSQL-Connection from 10.10.1.22 to 10.10.1.8 (same subnet, same interface "IT").
First try (using psql for a connection), I get
11:27:56|106015|10.10.1.22|51019|10.10.1.8|5432|Deny TCP (no connection) from 10.10.1.22/51019 to 10.10.1.8/5432 flags RST on interface IT
11:27:56|302014|10.10.1.22|51019|10.10.1.8|5432|Teardown TCP connection 290800318 for IT:10.10.1.22/51019 to IT:10.10.1.8/5432 duration 0:00:00 bytes 0 TCP Reset-O
11:27:56|302013|10.10.1.22|51019|10.10.1.8|5432|Built inbound TCP connection 290800318 for IT:10.10.1.22/51019 (10.10.1.22/51019) to IT:10.10.1.8/5432 (10.10.1.8/5432)
11:27:53|302014|10.10.1.22|51019|10.10.1.8|5432|Teardown TCP connection 290800140 for IT:10.10.1.22/51019 to IT:10.10.1.8/5432 duration 0:00:00 bytes 0 TCP Reset-O
11:27:53|302013|10.10.1.22|51019|10.10.1.8|5432|Built inbound TCP connection 290800140 for IT:10.10.1.22/51019 (10.10.1.22/51019) to IT:10.10.1.8/5432 (10.10.1.8/5432)
in the ASA log.
psql now runs into a time out.
Starting the second try, the ASA doesn't report any packets and the connection is established.Phillip,
Based on the syslogs the reset packet is coming from another device "Reset-O". The best way to troubleshoot this issue will be applying captures on the IT interface in order to track the source MAC of the reset and to have a better picture of the traffic flow.
Luis Silva -
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. -
TS1591 iPod 7th gen not showing up in iTunes (Macbook Pro) on first try
hi guys. i have an ipod 7th gen and just recently bought a macbook pro. what i noticed right away was that whenever i try to plug in and update my ipod, the icon shows up on the desktop but the iPod itself does not show up in iTunes. i have to unplug then re-plug in my iPod and that usually does the trick. a trick which is annoying to do because im sure most people with iPods dont have this problem. help please
Hey there Miles,
It sounds like your iPod isn't showing in iTunes when you connect it to your Mac. I would start with this bit from the following article:
iPod not appearing in iTunes
http://support.apple.com/kb/TS3716
First, try the steps in the iPod Troubleshooting Assistant which applies to your iPod.
If you still cannot get the device to appear in iTunes, use the following link to help troubleshoot it:
iOS: Device not recognized in iTunes for OS X
http://support.apple.com/kb/TS1591?viewlocale=en_US
Thank you for using Apple Support Communities.
Take care,
Sterling -
Since i update my iPhone 5 with IOS 7.0.2, I start to have serious problems to call or receive calls from other telephones: is not possible to open the call at the first try. Somebody have the same problem?
Try
Reset: Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Note: You will not lose any data -
Mail doesn't always open an email message on first try
Hello Discussion Board,
I have an issue where Mac Mail doesn't always open an email message on the first try. This is happening on two of my Macs and I seem to remember this starting with the installation of Mavericks, but I'm not entirely positive about that. It may have been happening before Mavericks.
This issue does not happen with every message I open, and it seems to happen with random messages at random times, so it's tough to pinpoint exactly what triggers th problem.
I'm not sure if it's one of these non-default settings that I use:
1) I keep the message preview window closed so that I only see the list of email messages. (I keep it closed by sliding the edge where the message list and the preview window meet, all to the right).
2) I keep "Use Classic Layout" checked in my Mail Preferences.
3) I keep "Organize by Conversation" deselected in the View menu.
I've tried restoring these defaults and I can't replicate the issue but obviously, having the preview window open eliminates the need to double-click the message to open. However, double-clicking the emails opens them right up. I'm still testing this, however, I just started testing and as I mentioned previously, I prefer to have Mail configured differently.
Has anyone else come across this issue and discovered the culprit?Did you ever solve this problem? I have the same issue on two different iMacs, one at work and one at home and on my macbook pro. It's becoming irritating and I wonder why Apple can't be bothered to fix it.
-
Nautilus shows system root (/) on gvm/hal mount, first try.
When i click an unmounted device in computer:/// it gets mounted, but nautilus gives me my system root (/) instead of the mountpoint, only (and always) on the first try. Anybody know why this is?
When i click an unmounted device in computer:/// it gets mounted, but nautilus gives me my system root (/) instead of the mountpoint, only (and always) on the first try. Anybody know why this is?
-
Unable to Preview Page in Browser on First Try
Hello, when I go to File > Preview Page in Browser (Ctrl + Shift + E) it shows the error message above. But when I try again it works. Sometimes it takes 2-3 tries but eventually it works. Why does it not work the first try? Thanks.
-KellyHi Kelly,
Could you please try some steps given in this thread,
Adobe Muse - Preview Failed
Do let me know if you have any question. -
Stop and refresh buttons (one will disappear while the other is active). I have found numerous websites that just don't want to load on the first try, now I am unable to refresh it (usually in a new tab) because the button disappears. BTW 255 limit is BS.
You can try to press the ESC key to stop loading the page if you see the Stop button instead of the Reload button. You can also reload the page via F5 or Ctrl + F5 (cache bypass).
Firefox 4.0 has a combined Reload and Stop and Go button that appears at the right end of the location bar.
To restore the Firefox 3 appearance you can use these steps:
* Open the "View > Toolbars > Customize" window to move the Stop and Reload button out of the location bar.
* Move the Reload and Stop buttons to their previous position at the left side of the location bar.
* Set the order to "Reload - Stop" to get a combined "Reload/Stop" button.
* Set the order to "Stop - Reload" or separate them otherwise to get two distinct buttons. -
My PC sporadically recognizes my iPhone. occasionally it synchs on first try. More often it recognizes the iPhone and then gives an error message that it can't recognize it. Help!
Thank you both. I suppose I should have prefaced my question with the concern that I've read a number of other posts from people who have had a similar issue and when they tried to follow the directions, they ran into a multitude of other problems. As you might imagine, I'm hoping to avoid the creation of new problems as I try to solve this one. Thanks again.
-
Just bought a refurbished Mac Pro and it never boots the first try, (always on the second try,) if it's been turned off for awhile. It clicks and spins a couple times, but no chime and no display. So I hold the power button until it shuts off, then it will boot normally the second attempt.
Another clue, although audio is set to the sound card, the chime is through the onboard speaker when it does boot first time. It seems like the config is lost until power can be applied. Is there a battery power to the mother board missing possibly?
Is this a known problem? Is there a fix? I read many similar complaints on the web. I have had so many problems getting this computer ordered, now it arrives and is broken, very bummed that Apple cannot get my order correct multiple times, then at last sends me a 'broken' computer
thanks
tdFor all of you who may come accross this thread - I have a solution, even though the thread is a bit old.
I have a refurbished Mac Pro Early 2009 and it also never booted on the first try (identical to tduncan). I brought it to the Apple genius bar to get it fixed, they replaced the start button components. When I got home, the very same problems appeared. After several calls to Apple support (I had purchased the extended warranty) and a return to the Apple store again for repairs, the problem still was not resolved. I gave up and simply accepted that it was either the video card (NVIDIA GeForce GT 120 512 MB) as had been suggested in some help forums or still a problem with the start button. I started leaving the Mac Pro on all the time, and when I did turn it off, I knew that I would have to let it try to boot up, let it stall, then restart the process by turning off and turning on the Mac Pro again. Aside from this irritation, the Mac Pro runs really well, and I have upgraded it a lot over the past 2 years.
Long story short, I ended up keeping an old PC to play one of my favourite games (Mech Warrior 3 and 4) and one day, the PC started acting up. After a lot of frustration (which is why I left the Windows world), I ended up replacing the internal battery and everything was fine.
I came accross this thread yesterday, and the suggestion from Limnos about the weak PRAM battery reminded me of the old PC and how it ran perfectly after replacing the motherboard battery for the timer. Today, I purchased a new internal backup battery at a local Canadian Tire, swapped batteries and instantly, the problem was resolved. I have tested it several times today, and the pattern of "2 tries" to start is definetely broken
Funny though that the Genius bar didnt figure this - sometimes it's the little things that are overlooked! I am posting this just in case anyone else runs into a similar situation!
Cheers
Stu -
My 2nd generation iPod touch recognized the touchmic lapel microphone the first try. I recorded a memo. The second try it would not. Any ideas?
See:
Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities
The iPod backup that iTunes makes does not include synced media like apps and music. -
PDF Embed only works on the first try
Hi everyone,
i've finally got it. The PDF Embed worked on my Reports Server.
But a strange thing is happening.
When I start the Reports Server and run the report for the first time everything works just fine, but when I try to run the report again i receive the following error:
REP-1923: PDF Font Embed error
The report doesn't works again until I stop and restart the Reports Server. And again after i run the report for the first time it doesn't works anymore until new restart.
I'm using Oracle 9iAS (9.0.2.1) with 2703110 and 2842923 patches installed.
The system is Red Hat Linux 7.3.
The uifont.ali file:
#===============================================================
[ Global ] # Put mappings for all surfaces here.
# Mapping from MS Windows
Arial = helvetica
"Courier New" = courier
"Times New Roman" = times
Modern = helvetica
"MS Sans Serif" = helvetica
"MS Serif" = times
"Small Fonts" = helvetica
[ PDF:Embed ]
# This example shows how to embed Type 1 helvetica font into the PDF file:
# helvetica = "helvetica.afm helvetica.pfa"
# You need to specify the .afm file before the .pfa file.
# The font files must exist in one of the folders specified in REPORTS_PATH.
helvetica = "I2501P.afm I2501P.pfa"
The Font I'm using is I2501P (a bar code font).
The I2501P.afm I2501P.pfa files are located in $ORACLE_HOME/reports/samples/demo. This directory is on $REPORTS_PATH.
The reports is being called by this URL:
http://caarjrep.caarj.com.br:7778/reports/rwservlet?server=repserver+module=TEST.RDF+destype=cache+desformat=pdf+delimiter=tab+userid=scott/tiger@iasdb
Anybody can help??
Thank you all.
Marcus Oliveira ([email protected])Hi Marcus
I faced the same problem. I understand from Oracle that this has been fixed and will be available in the next patch whenever it becomes available.
Regards
Sripathy -
IPhone 4S is on, but not goes to voicemail on the first try
Dear Community,
My wife's iphone 4s always goes to the voicemail the first time you try to call her.
We change provider 2 times, the second time in another country and it still happens.
After you call her right away again, it will ring normaly.
Hopefully someone can help as it now seems to everyone her phone isn't working.
Kind regards,
RobinIt is fixed, seemed to be the not disturb feature.
In case anyone has the same problem.
If you call within 3 minutes it will go through else will block the call.
The ones that are in favourite can still call. -
First try at creating a Form/Using Javascripts
Looking for constructive criticism. I am an instructor in the US Navy and I am forced to type out a boring routing sheet when submitting anything that needs approval from anyone other than myself. I finally decided to try my hand at Adobe Acroboat X Pro and this is the end result. Please feel free to criticise/help me build on this first attempt ever to write code. In my first attempt at using acrobat's Javascript editor I have discovered that it is a complete nightmare and not very userfriendly. I could write a string and save it only to find out that next time I went back to edit something it would tell me that I had a syntax in something that was a known good! Very aggrivating! Does anyone know if/where the limits of the java script are located? I was getting some problems while writing the strings at around line #40 so I would back it up to line #39, save it, then go back in and I could magicaly go past line 40. Anyone seen anything like this before?
//-----------------Do not edit the XML tags--------------------
//<Document-Level>
//<ACRO_source>SetFieldValues</ACRO_source>
//<ACRO_script>
/*********** belongs to: Document-Level:SetFieldValues ***********/
// Place all prepopulation data into a single data structure
var Sheet = {
"Graduation Certificates":{
Enclosure: "Graduation Certificates, Class Roster",
To1: "Commanding Officer",To2: "Executive Officer",To3: "Technical Director",To4: "Command Master Chief",To5: "Director of Training",To6: "Admin Officer",To7: "Department Head",To8: "Department LCPO",To9: "Division Officer",To10: "Division LCPO",To11: "Branch LCPO",To12: "LPO"},
"24hr Special Liberty":{
Enclosure: "Special Request Chit",
To1: "Branch LCPO",To2: "LPO",To3: "",To4: "",To5: "",To6: "",To7: "",To8: "",To9: "",To10: "",To11: "",To12: ""},
"48hr Special Liberty":{
Enclosure: "Special Request Chit",
To1: "Department LCPO",To2: "Division Officer",To3: "Division LCPO",To4: "Branch LCPO",To5: "LPO",To6: "",To7: "",To8: "",To9: "",To10: "",To11: "",To12: ""},
"72hr Special Liberty":{
Enclosure: "Special Request Chit",
To1: "Department Head",To2: "Deparment LCPO",To3: "Division Officer",To4: "Division LCPO",To5: "Branch LCPO",To6: "LPO",To7: "",To8: "",To9: "",To10: "",To11: "",To12: ""}};
function SetFieldValues(cSubject)
this.getField("Enclosure1").value = Sheet[cSubject].Enclosure;
this.getField("To 1").value = Sheet[cSubject].To1;
this.getField("To 2").value = Sheet[cSubject].To2;
this.getField("To 3").value = Sheet[cSubject].To3;
this.getField("To 4").value = Sheet[cSubject].To4;
this.getField("To 5").value = Sheet[cSubject].To5;
this.getField("To 6").value = Sheet[cSubject].To6;
this.getField("To 7").value = Sheet[cSubject].To7;
this.getField("To 8").value = Sheet[cSubject].To8;
this.getField("To 9").value = Sheet[cSubject].To9;
this.getField("To 10").value = Sheet[cSubject].To10;
this.getField("To 11").value = Sheet[cSubject].To11;
this.getField("To 12").value = Sheet[cSubject].To12;
//</ACRO_script>
//</Document-Level>
//<AcroForm>
//<ACRO_source>Subject:Keystroke</ACRO_source>
//<ACRO_script>
/*********** belongs to: AcroForm:Subject:Keystroke ***********/
if( event.willCommit )
if(event.value == " ")
this.resetForm(["Enclosure1","To 1","Legend 1"]);
else
SetFieldValues(event.value);
//</ACRO_script>
//</AcroForm>Unless you are really really good at editing JavaScript, I would not use the "Edit All Scripts", it is far to easy to make a mistake.
It might be more helpful to have a copy of the form with JavaScirpts.
It looks like you are trying to set a second or more drop down box using a data object.
Maybe you are looking for
-
Creating Query to show items from open sales orders with a/p invoice
Hi experts, I am trying to create a query that will show what items/quantities are still in open sales orders that can now be filled by an incoming shipment of goods, processed through the a/p invoice. This needs to be done using subqueries, which I
-
Can I share my iPod with other devices using a USB *Switch*?
Hello I'm trying to design a set up that will allow me to share my iPod with my PS3, Xbox 360, and G4 Powerbook. I only need to use one sharing device at a time. As of now I plan to have my 30Gb iPod Video, a USB Keyboard, and USB Mouse, running thro
-
Dynadock U3.0 - Spins up hard-drive after laptop put to sleep
Hi, I have a Dynadock U3.0 and love it apart from a few small bugs. 1) After I put my laptop to sleep, the Dynadock USB light switches off and I hear my hard-drives spin down. However, about 5 seconds later - only the USB 3.0 hard-drive spins back up
-
IP address used by another computer
New to iMac. Keep getting msg that says IP address is being used by another computer. Have read Mr. Bob Timmons posts. His post are very helpful. So far, still haven't been able to solve on my own. I have an AT&T combo modem/router configured to o
-
I just installed the new iphoto and every time I open it up the mds seems to shoot sky high for about 2-3 minutes using 100% of the cpu. This seems awkward because the old version of iphoto never did this. Does anybody know how to fix this or know if