ALV Grid and screen title using OO
I've been searching thru documentation and this forum without any luck. I want to display a screen title in the location where the report name displays on a standard report, i.e., between the Menu Toolbar and the Application Toolbar. I am using OO ALV Grid. I found how to do it using function modules, there they set the layout field "gs_test-layo_title" but this field does not exist in OO layout. The field "grid_title" displays the title inside the grid display (not what I want) and the field "detailtitl" does not work either.
Any help will be greatly appreciated.
Thanks
Hi Nicolas, understand that the OO ALV Grid which you are referring to is implemented into a screen container. This container does not really have anything to do with the screen title. Only when using the full-screen grid(using the FM) do you have direct control of this title via the ALV tool. If you simply want to set this title in the title bar, you can simply do this using the SET TITLE-BAR statement in the PBO of the screen. Or you may even able to simply set the system variable(haven't tested this) again in the PBO of the screen.
sy-title = 'This is my title'.
Regards,
Rich Heilman
Similar Messages
-
ALV Grid and return to selection screen
Hello
I have an ALV Grid and when I push a buttom that I program appears another ALV Grid. In this second ALV I try to program different buttoms. When I program the BACK buttom I want to go to selection screen.
I try with CALL SELECTION SCREEN but when I stay in selection screen and push the execute buttom the ALV that I see is the second, not the first. It seems that we don't catch the news selections.
I put rs_selfied-refresh = 'X' after the CALL SELECTION SCREEN but is wrong again.
What can I do????Hello Silvia
There is a simple trick to return from the second ALV list directly back to the selection screen:
*& Report ZUS_SDN_REUSE_ALV_GRID_DISPLAY
REPORT zus_sdn_reuse_alv_grid_display.
TYPE-POOLS: slis.
DATA:
gt_t001 TYPE STANDARD TABLE OF t001,
gt_knb1 TYPE STANDARD TABLE OF knb1.
DATA:
gs_fcat TYPE slis_fieldcat_alv,
gt_fcat_t001 TYPE slis_t_fieldcat_alv,
gt_fcat_knb1 TYPE slis_t_fieldcat_alv.
PARAMETERS:
p_bukrs TYPE bukrs DEFAULT '1000'.
START-OF-SELECTION.
SELECT * FROM t001 INTO TABLE gt_t001.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
* I_PROGRAM_NAME =
* I_INTERNAL_TABNAME =
i_structure_name = 'T001'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_INCLNAME =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = gt_fcat_t001
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
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 FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = syst-cprog
i_callback_pf_status_set = 'ALV_SET_PF_STATUS'
i_callback_user_command = 'ALV_USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME = ' '
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
it_fieldcat = gt_fcat_t001
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_t001
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
END-OF-SELECTION.
*& Form set_pf_status
* text
* -->RT_EXTAB text
FORM alv_set_pf_status USING rt_extab TYPE slis_t_extab.
* NOTE: identical to STANDARD_FULLSCREEN with additional button
* for detail list ('DETAILLIST')
SET PF-STATUS 'STANDARD_FULLSCREEN'.
ENDFORM. "set_pf_status
*& Form alv_user_command
* text
* -->R_UCOMM text
* -->RS_SELFIELDtext
FORM alv_user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
* Display detail list: all customers for selected company code
WHEN 'DETAILLIST'.
IF ( rs_selfield-fieldname = 'BUKRS' ).
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = rs_selfield-value.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = syst-cprog
i_callback_pf_status_set = 'ALV_SET_PF_STATUS'
i_callback_user_command = 'ALV_USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
i_structure_name = 'KNB1'
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_knb1
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
<b>* NOTE: when the program logic returns from the 2nd ALV list
* and exit = 'X' then the program leaves the
* 1st ALV list, too, and returns to the selection screen.</b>
rs_selfield-exit = 'X'.
ENDIF.
WHEN OTHERS.
ENDCASE.
ENDFORM. "alv_user_command
Regards
Uwe -
Report with two ALV grids and a header
Hi experts,
I have a report with two ALV grids in the same screen, each one in a separated container. The information displays it correctly. The report has been implemented by using OO Programming.
My real trouble is in the header. It must have a logo, a title with a specific font and other information.
I'll attach a capture of my need:
[Report with two ALV grids and a header|http://picasaweb.google.com/lh/photo/AcQD49QPmm-0L_jL2iMedA?feat=directlink]
Then, I want to set up the header you can see, with logo, a font with specific features. Obviously, the header you see has taken from another report. But is the same idea.
I've tried with a third container, using the CL_GUI_CONTAINER and CL_GUI_CONTAINER classes, but it doesn't work.
Any idea? Would welcome any help you can provide.
Thanks in advance,
Jorge RojasHi, Jorge.
Should the header be a"attached" to any of the ALV? Or it should be carried alone?
If first applies, you've given the solution yourself: put the info & logo in first ALV's header and invoke it from the proper method.
You could use CL_GUI_DOCKING_CONTAINER CLASS to divide screen in several containers and then, in the upper one, I would create another one docking container to divide the screen into two: the written info could be performed with an HTML viewer class and the logo with a CL_GUI_PICTURE element.
Cheers. -
ALV GRID and Integrated ITS 7 (SAP GUI for HTML) - dissapears on reload
Hi All,
We have a custom report that uses an ALV grid to display information to the user. Within this grid, there are fields that are display only and fields that are editable. Also, the grid is wider than the screen's width. It works fine in ECC. It also worked fine when we were using ITS 6.4.
We have recently upgraded to ITS 7. Now when we run the report using a Transaction iView (in EP 7) or the Webgui service (SAP GUI for HTML), if a field that is editable has focus when an event is triggered that reloads the grid, the screen becomes blank. So, you can click the Save button and the screen goes blank, also, there are date fields in the grid and if you choose a new date, the grid reloads and the screen becomes blank.
We have found that when the screen is blank, you can use the "Page Up" button on your keyboard and the last few columns of the grid will appear. As if the entire grid has moved off-screen to the left.
If you click onto a non-editable field and refresh or save, the grid returns to its normal state.
We are on Basis Patch level 15.
Does anyone have any ideas on how to fix this?
Also, does anyone know of a standard SAP transaction we can call from the Webgui that would have a similar setup...with an ALV grid containing editable and non-editable fields? We would like to rule out any errors in the report itself. Since it worked before we upgraded and it works fine in ECC. This would be a really big help too.
Thank you so much!
-KevinHi,
Thanks Raymond, I have seen Note 314568. I could not get the second link to work but I have looked at just about every Note in reference to Integrated ITS 7 and Tables or ALV Grids and there are very many, so it would appear that SAP has had a hard time with implementing this control, but I have not seen any instance that matches the problem we are having.
Unfortunately, SAP will not investigate this unless we can provide a standard Transaction that exhibits the same behavior.
If anyone knows of a standard SAP Transaction that displays an ALV Grid that is wider than the screen (requiring a horizontal scroll bar) and with editable and non-editable fields, that would be fantastic. If we can test against that, then we would know for sure if this is a problem with ITS / SAP GUI for HTML, or if there is an issue with this specific report.
Thanks!
-Kevin -
HI all,
Diff between ALV GRID and ALV LIST?
sachin.Hi,
ckeck these differences.
first one is for list display and second one is for grid display.
For all practical purposes, they are the same.
2. Some differences:
a) from abap coding point of view,
alv list is done with Function modules,
alv gris can also be done with FM,
but can also be done using OO concepts.
b) Alv grid (using oo concept) requires
designing the screen layout .
Hence, in one screen, we can show more
then one alv grid
(we cannot show more than
one alv list on one screen)
c) ALV grid uses ActiveX controls
present on the Presentation Server.
Hence, it consumes More Memory
on the presentation server.
d) ALV LIST is Display Only.
Whereas
ALV Grid Can Be made EDITABLE for entry purpose.
e) In alv grid, these options are possible,
but not in alv list.
without horizontal lines
without vertical lines
without cell merging during sorts
display total lines above the entries
ALV LIST Can be coded using only FMs
ALV GRID Can be coded using FMs and object oriented concepts
ALV LIST Can be displayed hieraicharlly
ALV GRID cannot be displayed hierarichally.
reward points if hlpful. -
ALV grid with 2 headers - using OOPS
Hi,
I have a requirement wherein I need to display 2 headers using ALV Grid. I am using cl_gui_alv_grid->set_table_for_first display.
Header1 Header2
Col1 Col2 Col3 Col4 Col5
1 2 3 4 5
Please suggest if this is possible, if yes, how to acheive it.
Thanks,
SmitaHI RAM,
I have did same like what you said. but iam not getting. Below is the pgm what i have dev. please correct it and let me knwo.
TYPE-POOLS: SLIS.
DATA: I_CATLOG TYPE slis_t_fieldcat_alv,
W_CATLOG TYPE SLIS_FIELDCAT_ALV,
I_CATLOG2 TYPE slis_t_fieldcat_alv,
W_CATLOG2 TYPE SLIS_FIELDCAT_ALV,
V_PGM TYPE SY-REPID.
data: begin of itab1 occurs 0,
HEADER1(10) TYPE C,
HEADER2(10) TYPE C,
end of itab1.
data: begin of itab occurs 0,
vbeln like vbak-vbeln,
posnr like vbap-posnr,
MATNR LIKE VBAP-MATNR,
MATWA LIKE VBAP-MATWA,
end of itab.
select vbeln
posnr
MATNR
MATWA
from vbap
up to 20 rows
into table itab.
w_catlog-seltext_l = 'HEADER1'.
w_catlog-datatype = 'CHAR'.
w_catlog-outputlen = 10.
W_CATLOG-tabname = 'ITAB1'.
append w_catlog2 to i_catlog2.
clear w_catlog2.
w_catlog-seltext_l = 'HEADER2'.
w_catlog-datatype = 'CHAR'.
w_catlog-outputlen = 10.
W_CATLOG-tabname = 'ITAB1'.
append w_catlog2 to i_catlog2.
clear w_catlog2.
w_catlog-seltext_l = 'Sales Document'.
w_catlog-datatype = 'CHAR'.
w_catlog-outputlen = 10.
w_catlog-fieldname = 'VBELN'.
W_CATLOG-tabname = 'ITAB'.
append w_catlog to i_catlog.
clear w_catlog.
w_catlog-seltext_l = 'ITEM'.
w_catlog-datatype = 'NUMC'.
w_catlog-outputlen = 6.
w_catlog-fieldname = 'POSNR'.
W_CATLOG-tabname = 'ITAB'.
append w_catlog to i_catlog.
clear w_catlog.
w_catlog-seltext_l = 'MATERIAL'.
w_catlog-datatype = 'CHAR'.
w_catlog-outputlen = 18.
w_catlog-fieldname = 'MATNR'.
W_CATLOG-tabname = 'ITAB'.
append w_catlog to i_catlog.
clear w_catlog.
w_catlog-seltext_l = 'Material entered'.
w_catlog-datatype = 'CHAR'.
w_catlog-outputlen = 18.
w_catlog-fieldname = 'MATWA'.
W_CATLOG-tabname = 'ITAB'.
append w_catlog to i_catlog.
clear w_catlog.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_PGM
IT_FIELDCAT = I_CATLOG2
TABLES
T_OUTTAB = ITAB1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_PGM
IT_FIELDCAT = I_CATLOG
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Help me in alv grid and form printing
hi experts,
my requirement is
i have a check box in the selection screen for batch processing.
if i tick the check box, the data which is in the t_output table should be displayed in alv grid and
in turn if i select one row in alv o/p and double click on it the entire data shold be displayed in the form.
if 2 rows are selected in alv and double clicked on it then data in the two rows is dispalyed in the form.
points are rewarded .
thanks in advance.Hi,
Check the following link:
http://sapdev.co.uk/reporting/alv/alvgrid_rowsel.htm
Regards,
bhaskar -
Hi experts, how are you.
What is the difference between ALV Grid Display and ALV List Display?ALV LIST Can be coded using only FMs
ALV GRID Can be coded using FMs and object oriented concepts
ALV LIST Can be displayed hieraicharlly
ALV GRID cannot be displayed hierarichally
ALV grid uses ActiveX controls
present on the Presentation Server.
Hence, it consumes More Memory
on the presentation server.
ALV LIST is Display Only.
Whereas
ALV Grid Can Be made EDITABLE for entry purpose.
In alv grid, these options are possible,
but not in alv list.
without horizontal lines
without vertical lines
without cell merging during sorts
display total lines above the entries
Thanks
Seshu -
ALV-Grid and update dynpro fields
Hi!
I've created a dynpro with an ALV-Grid for Data-Overview and fields on the dynpro to change additional data.
My ALV has one editable column, when this value change I calculate other value for a field dynrpo, but I canu2019t see this change in my field dynpro.
How can I update my data filed dynpro when changing the selected row at the ALV.
I use the method handle_data_changed to obtain changes in ALV-Grid and it works fine, but I canu2019t update my fileds on the dynpro, when changing value in ALV.
Thanks for any hints!
Lili.This error occurs becuase when you change anything on the ALV, control is not triggering the PAI and PBO of your dynpro. Hence your values are not getting updated in the dynpro field.
You should call the CL_GUI_CFW=>DISPATCH in PAI module to trigger the PAI also after the event has been triggered in the ALV.
CALL METHOD CL_GUI_CFW=>DISPATCH
importing return_code = return_code.
* a control event occured => exit PAI
if return_code <> cl_gui_cfw=>rc_noevent.
clear g_ok_code.
exit.
endif.
Regards,
Naimesh Patel -
ALV Grid and ALV List difference?
Hello,
Can you help me differentiate ALV List and ALV grid and the low-level definition or context of each?
Also, can you give me a transaction code that outputs an ALV list as well as a tcode for ALV grid?
Thanks,
JennahHi Kirtish,
Thanks but I havent done any function module stuff as I am not an ABAPer but anyway can you guide me through thios?
"I hope this might slove your query. For more please refer to documentation on ALV and also implement the ALV LIST and GRID reports. By using class Class CL_GUI_ALV_GRID, Function module REUSE_ALV_LIST_DISPLAY , REUSE_ALV_GRID_DISPLAY and some more functions like that only."
I will give you some tcode can you please try tcode FBL1n? then execute the report. What is the output is it an ALV list?
I wish to see an ALV list also an ALV grid to see difference.
Tjhakns,
Jennah -
ALV Grid and Icon : Printing Problem
Hi, i develop some reports using ALV Grid and Icon and i'm facing printing problem, all report that using ALV grid with the option icon = 'X' cannot print properly, all the character field showing improper icon instead of the text. While all the ALV grid report with the option icon = ' ' can print normally.
Thanks.Hi,
Check the Demo Program <b>BCALV_DEMO_TOOLTIP</b>, Here i am able to see the Output Properly, and also able to Print them.
Regards
vijay -
What is the difference between Alv Grid and Table Control?Explain in detail..
Table control is a screen table to display table data in a screen. You can add table control to a screen in the Screen Painter. The typical flow-logic to process table control is:
LOOP AT <internal table> CURSOR <scroll-var>
[WITH CONTROL <table-control> ]
[FROM <line1> ] [TO <line2> ].
...<actions>...
ENDLOOP.
ALV Grid is a SAP Technology to display a set of data on the output screen. For example if you have selected some SAP tables and processed these data in a way you want to display, then you can pass the internal table to the ALV Grid and it will be displayed on the result screen as ALV Grid. See example in SE16 result. -
Display totals on the first line in ALV grid and ALV LIST
Generally we wll display totals at the end..
bu the requirement is to display it in the first line of the column.
how to display the totals in the first line?
I have used ALV GRID and ALV LIST (choice) using function modules.
Plz help me
.for example : Po qty : Should display total po qty on the first line of the Po line item.IN LAYOUT
ILAYOUT-totals_before_items = 'X'.
REGARDS
SHIBA DUTTA -
ALV REPORT: read selected checkbox in alv grid and process the pushbutton
my requirement is to check some rows from alv grid and the press the pushbutton. Thereby following things should process:
select all checked rows into an itab and call the transaction code CJ01 for all
entries......
I am finding the problem that when I select the checkbox....the internal table doesnt recognize the boxes as checked ones......
thanks in advance...
Kartikey Singh,Data: ref1 type ref to cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = ref1.
call method ref1->check_changed_data.
loop at t_output where Flag = 'X'.
if t_output-VKUEGRU is initial.
message e000 with text-110.
endif.
endloop. -
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.
Maybe you are looking for
-
I tried to update my iPod 4th generation while it was charging and when I came back to check on it the screen was red and it wouldnt go off, and my ipod wasnt charging like it was supposed to. I found out how to get the color of the screen off but my
-
Hi All, I am facing a problem with selection screen parameter. I have one file parameter p_fname TYPE rlgrap-filename OBLIGATORY.When I enter some file path and excute I will get the result and once again when I start to execute the program I expect
-
Exit for VA01 w/o contract
Hi Experts, I am trying to find an EXIT when a user tries to create/change SO using a Expired Contract. Standard SAP shows a warning when user tried to create SO using expired contract.I need to make it an error. Thanks, Chirantan
-
Why does text come out looking like junk?
I have a scanned copy of my college diploma and an award from Phi Theta Kappa Honor Society. All the text on these documents come out looking like symbols and individual letters?
-
hi all, I want to integrate BW workbook into portal. I was able to do it by using transactional iview with application parameter as WBID. But this requires SAPGUI to be installed on the machine. Is there any other way in which i can do this? Tha