How to use ALV...
Hello Colleagues,
I have a scenario where when I execute a report by F8, the first screen should list
table entries in ALV format which must have check boxes(for each table entry) on which when I select and press F8 again, it should go to the next screen and fetch data from DB according to the checkbox selection.
Can anyone help me out with this?
Thanks and Regards, Pradeep
1. Dynpro: Use a custom control in dynpro
2: Coding:
Data: grid TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container,
grid_layout type LVC_S_LAYO,
PBO:
ALV Grid Objekt erzeugen
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING
CONTAINER_NAME = 'ALV'.
CREATE OBJECT GRID
EXPORTING
I_PARENT = g_custom_container.
ENDIF.
Grid an Dynpro übergeben
CALL METHOD grid->set_table_for_first_display
EXPORTING I_STRUCTURE_NAME = 'YADEMO_PERS'
CHANGING IT_OUTTAB = it_selektion.
*Holen des Layouts (ALV)
CALL METHOD grid->get_frontend_layout
IMPORTING
ES_LAYOUT = grid_layout .
Layout modifizieren
Selektionstasten
grid_layout-sel_mode = 'A'.
*Setzen des angepassten Layouts
CALL METHOD grid->set_frontend_layout
EXPORTING
IS_LAYOUT = grid_layout .
PAI
CALL METHOD grid->get_selected_rows
IMPORTING
ET_INDEX_ROWS = it_selected_rows .
Hope this helps!
Johannes
Similar Messages
-
hi all
thanks in advance
how to use alv in programm please can any one send me simple example of alv
thanksHi,
Refer this code. If u find it useful, reward points.
TYPE-POOLS: slis.
Data Declaration
DATA: wa_layout TYPE slis_layout_alv, "Layout structure
it_fieldcatalog TYPE slis_t_fieldcat_alv, " Fieldcatlog IT
wa_fieldcatalog TYPE slis_fieldcat_alv, " Fieldcatlog WA
lt_event TYPE slis_t_event, "for capturing page events
ls_event TYPE slis_alv_event. " WA for Page Events
Data: l_syrep type sy-repid,
l_tcode type sy-tcode.
*& I N I T I A L I Z A T I O N *
INITIALIZATION .
l_syrep = sy-repid.
l_tcode = sy-tcode.
*& AT SELECTION-SCREEN *
AT SELECTION-SCREEN.
*& START-OF-SELECTION *
START-OF-SELECTION.
*& END-OF-SELECTION *
END-OF-SELECTION.
PERFORM build_layout.
PERFORM build_catlog.
PERFORM build_events.
*& AT LINE-SELECTION *
AT LINE-SELECTION.
*& Form build_layout
Building the Layout
FORM build_layout .
wa_layout-ZEBRA = 'X'.
wa_layout-NO_VLINE = 'X'.
wa_layout-NO_HLINE = 'X'.
wa_layout-CELL_MERGE = 'X'.
wa_layout-EDIT = 'X'.
wa_layout-WINDOW_TITLEBAR = ''.
wa_layout-NO_ULINE_HS = 'X'.
wa_layout-LIGHTS_FIELDNAME = ''.
wa_layout-LIGHTS_TABNAME = ''.
wa_layout-LIGHTS_ROLLNAME = ''.
wa_layout-LIGHTS_CONDENSE = 'X'.
wa_layout-NO_TOTALLINE = 'X'.
wa_layout-NO_SUBTOTALS = 'X'.
wa_layout-TOTALS_BEFORE_ITEMS = 'X'.
wa_layout-TOTALS_ONLY = 'X'.
wa_layout-TOTALS_TEXT = ''.
wa_layout-SUBTOTALS_TEXT = ''.
wa_layout-BOX_FIELDNAME = ''.
wa_layout-BOX_TABNAME = ''.
wa_layout-BOX_ROLLNAME = ''.
wa_layout-CONFIRMATION_PROMPT = 'X'.
wa_layout-HEADER_TEXT = ''.
ENDFORM. " build_layout
*& Form build_catlog
Building the Field Catlog
FORM build_catlog .
wa_fieldcatalog-ROW_POS = 0.
wa_fieldcatalog-COL_POS = 0.
wa_fieldcatalog-FIELDNAME = ''.
wa_fieldcatalog-TABNAME = ''.
wa_fieldcatalog-CHECKBOX = 'X'.
wa_fieldcatalog-DO_SUM = 'X'.
wa_fieldcatalog-OUTPUTLEN = ''.
wa_fieldcatalog-wa_fieldcatalog-OFFSET = ''.
wa_fieldcatalog-SELTEXT_L = ''.
wa_fieldcatalog-SELTEXT_M =''.
wa_fieldcatalog-SELTEXT_S =''.
wa_fieldcatalog-REF_FIELDNAME =''.
wa_fieldcatalog-REF_TABNAME = ''.
wa_fieldcatalog-NO_SUM ='X'.
wa_fieldcatalog-EDIT ='X'.
wa_fieldcatalog-HOTSPOT = 'X'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
ENDFORM. " build_catlog
*& Form build_events
Building the Events
FORM build_events .
Get all possible events
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = lt_event
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
Specify events used in selection screen
READ TABLE lt_event WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
ls_event-form = 'TOP_OF_PAGE'.
MODIFY lt_event FROM ls_event INDEX sy-tabix.
CLEAR ls_event.
ENDIF.
READ TABLE lt_event WITH KEY name = slis_ev_end_of_list
INTO ls_event.
IF sy-subrc = 0.
ls_event-form = 'END_OF_LIST'.
MODIFY lt_event FROM ls_event INDEX sy-tabix.
CLEAR ls_event.
ENDIF.
ENDFORM. " build_events
*& Form TOP_OF_PAGE
To display top of the page
FORM top_of_page .
data: lt_top_of_page type slis_t_listheader,
ls_line type slis_listheader.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = ''.
append ls_line to lt_top_of_page.
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = ''.
ls_line-info = ''.
append ls_line to lt_top_of_page.
clear ls_line.
ls_line-typ = 'A'.
ls_line-info = ''.
append ls_line to lt_top_of_page.
clear ls_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = lt_top_of_page
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM. " TOP_OF_PAGE
*& Form end-of-list
To display the totals at the end of the list
FORM end_of_list .
ENDFORM. " end-of-list
*& Form set_pf_status
Set the Pf Status
FORM pf_status USING pa_extab TYPE slis_t_extab.
SET PF-STATUS 'ZXXXX'.
ENDFORM. "SET_PF_STATUS
*& Form user_command
To Catch the User Events
-->PA_UCOMM text
-->PA_SELFIELD text
FORM user_command USING pa_ucomm TYPE syucomm
pa_selfield TYPE slis_selfield.
CASE pa_ucomm.
WHEN '&IC1'.
CLEAR gs_output .
READ TABLE gt_output INTO gs_output INDEX pa_selfield-tabindex .
CASE pa_selfield-fieldname .
ENDCASE.
WHEN 'XXX'.
WHEN 'XXX'.
ENDCASE.
ENDFORM. "USER_COMMAND -
How to use ALV in web dynpro for ABAP?
Hi,
I am new to web dynpro. Now I want to create a table using ALV to display. I have no idea how to use it.
I only know I need to add the SALV_WD_TABLE for component usage. Can anyone give me some hints
or step-by-step procedure?
Thanks.
Awards will be provided.
Best Regards,
Chris GuHi,
Please go thru this set of [tutuorials|https://www.sdn.sap.com/irj/sdn/webdynpro?rid=/webcontent/uuid/60ea94e5-0901-0010-c3bb-aad5ea9620d8].
Its really good for ALV.
I also used this as I am also new to WD ABAP.
Revert back with issues.
Regards,
Sumit -
Hi,
I am totally new to ALV Grids. Could you give a full example of creating a ALV Grid with 2 columns, thinking there is a internal table itab with itab-col1 & itab-col2. Please start from initialising variables and onwards.
Thanks,
KishanHi,
Simple example of how to implement an ALV grid
Note that this example uses table ZSFLIGHT. The table is equivalent to the table SFLIGHT.
Steps:
1. Create an executable program (Report)
2. Create a screen (100) and place a custom container named ALV_CONTAINER on the screen
3. Create a Pushbutton. Give it the text Exit and the functioncode EXIT
REPORT sapmz_hf_alv_grid .
TABLES: zsflight.
G L O B A L I N T E R N A L T A B L E S
DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
g_wa_sflight LIKE sflight.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container.
S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
SET SCREEN '100'.
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
Create objects
IF go_custom_container IS INITIAL.
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
PERFORM load_data_into_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form load_data_into_grid
FORM load_data_into_grid.
Read data from table SFLIGHT
SELECT *
FROM zsflight
INTO TABLE gi_sflight.
Load data into the grid and display them
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
CHANGING it_outtab = gi_sflight.
ENDFORM. " load_data_into_grid
Allow the user to save and reuse the layout
A button can be shown on the grid toolbar, allowing the user to save and reuse a layout. The button looks like this:
See also example in SAP standard program BCALV_GRID_09.
To do this use the parameters IS_VARIANT and I_SAVE of the set_table_for_first_display method. Note that the IS_VARIANT
parameter must have the structure DISVARIANT.
The I_SAVE "Options for saving layouts" parameter can have the following values:
· U Only user specific layouts can be saved
· X Only global layouts can be saved
· A Both user specific and global layouts can be saved
· Space Layouts can not be saved
Add the following code to the example:
FORM load_data_into_grid.
DATA:
For parameter IS_VARIANT
l_layout TYPE disvariant.
Code..........
Load data into the grid and display them
l_layout-report = sy-repid.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_variant = l_layout
i_save = 'A'
CHANGING it_outtab = gi_
Integrate user defined functions in the grid toolbar
Possibilities:
· Replace existing functions in the toolbar or context men with user defined functions
· Add new functions to the toolbar or context menu
Note that the whole toolbar can be removed using the IT_TOOLBAR_EXCLUDING parameter of the set_table_for_first_display
method.
See also example in SAP standard program BCALV_GRID_05
1) To get access to the icons insert the following statement in the top of the program:
TYPE-POOLS: icon.
2) To allow the declaration of o_event_receiver before the lcl_event_receiver class is defined, declare it as deferred in the start of
the program
To allow the declaration of o_event_receiver before the lcl_event_receiver class is defined, declare it as deferred in the
start of the program
CLASS lcl_event_receiver DEFINITION DEFERRED.
3) Declare reference to the event handler class
DATA:
o_event_receiver TYPE REF TO lcl_event_receiver.
4) Class for event receiver. This class adds the new button to the toolbar and handles the event when the button is pushed
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
Event handler method for event toolbar.
CONSTANTS:
Constants for button type
c_button_normal TYPE i VALUE 0,
c_menu_and_default_button TYPE i VALUE 1,
c_menu TYPE i VALUE 2,
c_separator TYPE i VALUE 3,
c_radio_button TYPE i VALUE 4,
c_checkbox TYPE i VALUE 5,
c_menu_entry TYPE i VALUE 6.
DATA:
ls_toolbar TYPE stb_button.
Append seperator to the normal toolbar
CLEAR ls_toolbar.
MOVE c_separator TO ls_toolbar-butn_type..
APPEND ls_toolbar TO e_object->mt_toolbar.
Append a new button that to the toolbar. Use E_OBJECT of
event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
This class has one attribute MT_TOOLBAR which is of table type
TTB_BUTTON. The structure is STB_BUTTON
CLEAR ls_toolbar.
MOVE 'CHANGE' TO ls_toolbar-function.
MOVE icon_change TO ls_toolbar-icon.
MOVE 'Change flight' TO ls_toolbar-quickinfo.
MOVE 'Change' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD handle_user_command.
Handle own functions defined in the toolbar
CASE e_ucomm.
WHEN 'CHANGE'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMETHOD.
ENDCLASS.
5) In the PBO module, crate object for event handler and set handler
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
6) In the PBO module after the CALL METHOD go_grid->set_table_for_first_display, raise event
toolbar to show the modified toolbar
CALL METHOD go_grid->set_toolbar_interactive.
Set focus to the grid
After CALL METHOD go_grid->set_table_for_first_display insert the following statement:
CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid.
Set the title of the grid
Fill the grid_title field of structure lvc_s_layo.
Note that the structure lvc_s_layo can be used for to customize the grid appearance in many ways.
DATA:
ALV control: Layout structure
gs_layout TYPE lvc_s_layo.
Set grid title
gs_layout-grid_title = 'Flights'.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
Customize the appearence of the grid
The structure lvc_s_layo contains fields for setting graphical properties, displaying exceptions, calculating totals and enabling specific
interaction options.
Fill the apporpiate fields of structure lvc_s_layo and insert it as a parameter in the CALL METHOD
go_grid->set_table_for_first_display. See the example under Set the title of the grid.
If you want to change apperance after list output, use the methods get_frontend_layout and set_frontend_layout.
Examples of fields in structure lvc_s_layo:
GRID_TITLE Setting the title of the grid
SEL_MODE. Selection mode, determines how rows can be selected. Can have the following values:
· A Multiple columns, multiple rows with selection buttons.
· B Simple selection, listbox, Single row/column
· C Multiple rows without buttons
· D Multiple rows with buttons and select all ICON
Setting and getting selected rows (Columns) and read line contents
You can read which rows of the grid that has been selected, and dynamic select rows of the grid using methods get_selected_rows
and set_selected_rows. There are similar methods for columns.
Note that the grid table always has the rows in the same sequence as displayed in the grid, thus you can use the index of the selected
row(s) to read the information in the rows from the table. In the examples below the grid table is named gi_sflight.
Data declaration:
DATA:
Internal table for indexes of selected rows
gi_index_rows TYPE lvc_t_row,
Information about 1 row
g_selected_row LIKE lvc_s_row.
Example 1: Reading index of selected row(s) and using it to read the grid table
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = 'You must choose a valid line'.
EXIT.
ENDIF.
LOOP AT gi_index_rows INTO g_selected_row.
READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
ENDIF.
ENDLOOP.
Example 2: Set selected row(s).
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines > 0.
CALL METHOD go_grid->set_selected_rows
exporting
it_index_rows = gi_index_rows.
ENDIF.
Make an Exception field ( = Traffic lights)
There can be defined a column in the grid for display of traffic lights. This field is of type Char 1, and can contain the following values:
· 1 Red
· 2 Yellow
· 3 Green
The name of the traffic light field is supplied inh the gs_layout-excp_fname used by method set_table_for_first_display.
Example
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
TYPES: traffic_light TYPE c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
Set the exception field of the table
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-traffic_light = '1'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
ELSE.
g_wa_sflight-traffic_light = '3'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
Name of the exception field (Traffic light field)
gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
Color a line
The steps for coloring a line i the grid is much the same as making a traffic light.
To color a line the structure of the table must include a Char 4 field for color properties
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
Field for line color
types: line_color(4) type c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
Loop trough the table to set the color properties of each line. The color properties field is
Char 4 and the characters is set as follows:
Char 1 = C = This is a color property
Char 2 = 6 = Color code (1 - 7)
Char 3 = Intensified on/of = 1 = on
Char 4 = Inverse display = 0 = of
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-line_color = 'C610'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
Name of the color field
gs_layout-info_fname = 'LINE_COLOR'.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
Refresh grid display
Use the grid method REFRESH_TABLE_DISPLAY
Example:
CALL METHOD go_grid->refresh_table_display.
Complete code for the ALV grid example
This example shows and ALV grid with flights. After selecting a line a change button can be pushed to display a change screen. After
the changes have been saved, the ALV grid screen is displayed again, and the grid is updated with the changes.
The example shows:
· How to setup the ALV grid
· How to ste focus to the grid
· How to set the title of the grid
· How to allow a user to save and reuse a grid layout (Variant)
· How to customize the ALV grid toolbar
· Refresh the grid
· Set and get row selection and read line contents
· Make and exception field (Traffic light)
· Coloring a line
Steps:
· Create screen 100 with the ALV grid. Remember to include an exit button
· Add a change button to the ALV grid toolbar
· Create screen 200 the Change screen
The screens:
The code:
REPORT sapmz_hf_alv_grid .
Type pool for icons - used in the toolbar
TYPE-POOLS: icon.
TABLES: zsflight.
To allow the declaration of o_event_receiver before the
lcl_event_receiver class is defined, decale it as deferred in the
start of the program
CLASS lcl_event_receiver DEFINITION DEFERRED.
G L O B A L I N T E R N A L T A B L E S
*DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
To include a traffic light and/or color a line the structure of the
table must include fields for the traffic light and/or the color
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
Field for traffic light
TYPES: traffic_light TYPE c.
Field for line color
types: line_color(4) type c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
Work area for internal table
g_wa_sflight TYPE st_sflight,
ALV control: Layout structure
gs_layout TYPE lvc_s_layo.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container,
o_event_receiver TYPE REF TO lcl_event_receiver.
DATA:
Work area for screen 200
g_screen200 LIKE zsflight.
Data for storing information about selected rows in the grid
DATA:
Internal table
gi_index_rows TYPE lvc_t_row,
Information about 1 row
g_selected_row LIKE lvc_s_row.
C L A S S E S
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
Event handler method for event toolbar.
CONSTANTS:
Constants for button type
c_button_normal TYPE i VALUE 0,
c_menu_and_default_button TYPE i VALUE 1,
c_menu TYPE i VALUE 2,
c_separator TYPE i VALUE 3,
c_radio_button TYPE i VALUE 4,
c_checkbox TYPE i VALUE 5,
c_menu_entry TYPE i VALUE 6.
DATA:
ls_toolbar TYPE stb_button.
Append seperator to the normal toolbar
CLEAR ls_toolbar.
MOVE c_separator TO ls_toolbar-butn_type..
APPEND ls_toolbar TO e_object->mt_toolbar.
Append a new button that to the toolbar. Use E_OBJECT of
event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
This class has one attribute MT_TOOLBAR which is of table type
TTB_BUTTON. The structure is STB_BUTTON
CLEAR ls_toolbar.
MOVE 'CHANGE' TO ls_toolbar-function.
MOVE icon_change TO ls_toolbar-icon.
MOVE 'Change flight' TO ls_toolbar-quickinfo.
MOVE 'Change' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD handle_user_command.
Handle own functions defined in the toolbar
CASE e_ucomm.
WHEN 'CHANGE'.
PERFORM change_flight.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMETHOD.
ENDCLASS.
S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
SET SCREEN '100'.
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
DATA:
For parameter IS_VARIANT that is sued to set up options for storing
the grid layout as a variant in method set_table_for_first_display
l_layout TYPE disvariant,
Utillity field
l_lines TYPE i.
After returning from screen 200 the line that was selected before
going to screen 200, should be selected again. The table gi_index_rows
was the output table from the GET_SELECTED_ROWS method in form
CHANGE_FLIGHT
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines > 0.
CALL METHOD go_grid->set_selected_rows
EXPORTING
it_index_rows = gi_index_rows.
CALL METHOD cl_gui_cfw=>flush.
REFRESH gi_index_rows.
ENDIF.
Read data and create objects
IF go_custom_container IS INITIAL.
Read data from datbase table
PERFORM get_data.
Create objects for container and ALV grid
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
Create object for event_receiver class
and set handlers
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
Layout (Variant) for ALV grid
l_layout-report = sy-repid. "Layout fo report
Setup the grid layout using a variable of structure lvc_s_layo
Set grid title
gs_layout-grid_title = 'Flights'.
Selection mode - Single row without buttons
(This is the default mode
gs_layout-sel_mode = 'B'.
Name of the exception field (Traffic light field) and the color
field + set the exception and color field of the table
gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
gs_layout-info_fname = 'LINE_COLOR'.
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
Value of traffic light field
g_wa_sflight-traffic_light = '1'.
Value of color field:
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
ELSE.
g_wa_sflight-traffic_light = '3'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_variant = l_layout
i_save = 'A'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
*-- End of grid setup -
Raise event toolbar to show the modified toolbar
CALL METHOD go_grid->set_toolbar_interactive.
Set focus to the grid. This is not necessary in this
example as there is only one control on the screen
CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0200 INPUT
MODULE user_command_0200 INPUT.
CASE ok_code.
WHEN 'EXIT200'.
LEAVE TO SCREEN 100.
WHEN'SAVE'.
PERFORM save_changes.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Form get_data
FORM get_data.
Read data from table SFLIGHT
SELECT *
FROM zsflight
INTO TABLE gi_sflight.
ENDFORM. " load_data_into_grid
*& Form change_flight
Reads the contents of the selected row in the grid, ans transfers
the data to screen 200, where it can be changed and saved.
FORM change_flight.
DATA:l_lines TYPE i.
REFRESH gi_index_rows.
CLEAR g_selected_row.
Read index of selected rows
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
Check if any row are selected at all. If not
table gi_index_rows will be empty
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = 'You must choose a line'.
EXIT.
ENDIF.
Read indexes of selected rows. In this example only one
row can be selected as we are using gs_layout-sel_mode = 'B',
so it is only ncessary to read the first entry in
table gi_index_rows
LOOP AT gi_index_rows INTO g_selected_row.
IF sy-tabix = 1.
READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
ENDIF.
ENDLOOP.
Transfer data from the selected row to screenm 200 and show
screen 200
CLEAR g_screen200.
MOVE-CORRESPONDING g_wa_sflight TO g_screen200.
LEAVE TO SCREEN '200'.
ENDFORM. " change_flight
*& Form save_changes
Changes made in screen 200 are written to the datbase table
zsflight, and to the grid table gi_sflight, and the grid is
updated with method refresh_table_display to display the changes
FORM save_changes.
DATA: l_traffic_light TYPE c.
Update traffic light field
Update database table
MODIFY zsflight FROM g_screen200.
Update grid table , traffic light field and color field.
Note that it is necessary to use structure g_wa_sflight
for the update, as the screen structure does not have a
traffic light field
MOVE-CORRESPONDING g_screen200 TO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-traffic_light = '1'.
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
clear g_wa_sflight-line_color.
ELSE.
g_wa_sflight-traffic_light = '3'.
clear g_wa_sflight-line_color.
ENDIF.
MODIFY gi_sflight INDEX g_selected_row-index FROM g_wa_sflight.
Refresh grid
CALL METHOD go_grid->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
LEAVE TO SCREEN '100'.
ENDFORM. " save_changes
rgds,
latheesh -
How to use ALV for Hierarchical Lists
Hi All,
I am satish, trying to get the hierarchical list using REUSE_ALV_HIERSEQ_LIST_DISPLAY function module. But it is going to dump. I couldn't find out where is mistake. So please any one help me to do this.
This is the code.
tables: vbak,vbap.
type-pools slis.
DATA: thead like vbak OCCURS 0,
titem like vbap occurs 0,
G_REPID LIKE SY-REPID,
ls_fieldcat TYPE slis_fieldcat_alv.
select * from vbak into table thead up to 5 rows.
select * from vbap into table titem up to 5 rows.
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = 'I'
I_CALLBACK_PROGRAM = g_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT =
IT_FIELDCAT = ls_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_DEFAULT = 'X'
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
I_TABNAME_HEADER = 'VBAK'
I_TABNAME_ITEM = 'VBAP'
I_STRUCTURE_NAME_HEADER = 'vbak'
I_STRUCTURE_NAME_ITEM = 'vbap'
IS_KEYINFO =
IS_PRINT =
IS_REPREP_ID =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB_HEADER = Thead
T_OUTTAB_ITEM = titem.
Thanks & Regards,
Satish.HI Satish,
Check this code.
report zxxx_alvexer4 message-id zz .
*& TABLES DECLARATION *
tables: vbak, vbap.
*& TYPE POOLS DECLARATION *
type-pools: slis.
DATA DECLARATIONS *
data: v_flag type c. "Flag to display the header
data: v_repid type sy-repid.
*& INTERNAL TABLE DECLARATION *
data: begin of it_vbak occurs 0,
vbeln like vbak-vbeln,
audat like vbak-audat,
auart like vbak-auart,
netwr like vbak-netwr,
expand(1),
end of it_vbak.
data: begin of it_vbap occurs 0,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
pstyv like vbap-pstyv,
charg like vbap-charg,
end of it_vbap.
data: it_fldcat type slis_t_fieldcat_alv,
it_fldcat1 type slis_t_fieldcat_alv,
*events
it_events type slis_t_event with header line,
v_call type c,
x_user type slis_exit_by_user,
it_variant like disvariant occurs 0 with header line,
x_keyinfo type slis_keyinfo_alv,
*layout
x_layout type slis_layout_alv,
*sort
it_sort type slis_t_sortinfo_alv,
wa_sort like line of it_sort,
x_cat type slis_fieldcat_alv,
v_tabix like sy-tabix.
Selection screen Declaration
*--BLOCK1
selection-screen begin of block b1 with frame title text-001.
select-options: s_vbeln for vbak-vbeln,
s_auart for vbak-auart.
selection-screen end of block b1.
AT SELECTION-SCREEN *
*- Validations
at selection-screen.
perform validate_screen.
START OF SELECTION *
start-of-selection.
*- To get data from VBAK
perform get_data.
*to get data from VBAP
perform get_data_vbap.
perform prepare_alv.
END OF SELECTION *
end-of-selection.
perform display_report.
*& Form VALIDATE_SCREEN
text
--> p1 text
<-- p2 text
form validate_screen .
data: lv_vbeln like vbak-vbeln,
lv_auart like vbak-auart.
if not s_vbeln[] is initial.
select vbeln
into lv_vbeln
from vbak
where vbeln in s_vbeln.
endselect.
if sy-subrc <> 0.
message e000 with 'INVALID SALES DOC'(002).
endif.
endif.
if not s_auart[] is initial.
select auart
into lv_auart
from vbak
where auart in s_auart.
endselect.
if sy-subrc <> 0.
message e000 with 'INVALID SALES DOC TYPE'(003).
endif.
endif.
endform. " VALIDATE_SCREEN
*& Form GET_DATA
text
--> p1 text
<-- p2 text
form get_data .
select vbeln
audat
auart
netwr
from vbak
into table it_vbak
where vbeln in s_vbeln
and auart in s_auart.
if sy-subrc = 0.
sort it_vbak by vbeln.
endif.
endform. " GET_DATA
*& Form GET_DATA_VBAP
text
--> p1 text
<-- p2 text
form get_data_vbap .
select vbeln
posnr
matnr
pstyv
charg
into table it_vbap
from vbap
for all entries in it_vbak
where vbeln = it_vbak-vbeln.
if sy-subrc = 0.
sort it_vbap by vbeln posnr.
endif.
endform. " GET_DATA_VBAP
*& Form prepare_alv
text
--> p1 text
<-- p2 text
form prepare_alv .
Prepare field catalog .
perform prepare_catalog.
Modify catalog
perform change_attr_of_catalog.
Modify Layout
perform modify_layout.
Sort Catalog
perform sort_catalog.
endform. " prepare_alv
*& Form prepare_catalog
text
--> p1 text
<-- p2 text
form prepare_catalog .
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-repid
i_internal_tabname = 'IT_VBAK'
i_inclname = sy-repid
changing
ct_fieldcat = it_fldcat1[]
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.
append lines of it_fldcat1 to it_fldcat.
clear: it_fldcat1[].
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-repid
i_internal_tabname = 'IT_VBAP'
i_inclname = sy-repid
changing
ct_fieldcat = it_fldcat1[]
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.
append lines of it_fldcat1 to it_fldcat.
endform. " prepare_catalog
*& Form change_attr_of_catalog
text
--> p1 text
<-- p2 text
form change_attr_of_catalog .
loop at it_fldcat into x_cat.
v_tabix = sy-tabix.
case x_cat-fieldname.
when 'EXPAND'.
if x_cat-tabname = 'IT_VBAK'.
x_cat-no_out = 'X'.
endif.
when 'VBELN'.
if x_cat-tabname = 'IT_VBAK'.
x_cat-no_out = 'X'.
endif.
when 'VBELN'.
if x_cat-tabname = 'IT_VBAK'.
x_cat-col_pos = '1'.
x_cat-seltext_m = 'SALES DOC'.
x_cat-seltext_l = 'SALES DOC'.
x_cat-seltext_s = 'SALES DOC'.
x_cat-outputlen = '10'.
endif.
when 'AUDAT'.
if x_cat-tabname = 'IT_VBAK'.
x_cat-col_pos = '2'.
x_cat-seltext_m = 'DOC DATE'.
x_cat-seltext_l = 'DOC DATE'.
x_cat-seltext_s = 'DOC DATE'.
x_cat-outputlen = '8'.
endif.
when 'AUART'.
if x_cat-tabname = 'IT_VBAK'.
x_cat-col_pos = '3'.
x_cat-seltext_m = 'ORDER REASON'.
x_cat-seltext_l = 'ORDER REASON'.
x_cat-seltext_s = 'ORDER REASON'.
x_cat-outputlen = '5'.
endif.
when 'NETWR'.
if x_cat-tabname = 'IT_VBAK'.
x_cat-col_pos = '4'.
x_cat-seltext_m = 'NET PRICE'.
x_cat-seltext_l = 'NET PRICE'.
x_cat-seltext_s = 'NET PRICE'.
x_cat-outputlen = '15'.
endif.
endcase.
modify it_fldcat from x_cat.
clear x_cat.
endloop.
endform. " change_attr_of_catalog
*& Form modify_layout
text
--> p1 text
<-- p2 text
form modify_layout .
x_layout-default_item = 'X'.
x_layout-zebra = 'X'.
x_layout-expand_fieldname = 'EXPAND'.
endform. " modify_layout
*& Form sort_catalog
text
--> p1 text
<-- p2 text
form sort_catalog .
clear wa_sort.
wa_sort-spos = '01'.
wa_sort-fieldname = 'VBELN' .
wa_sort-tabname = 'IT_VBAP'.
wa_sort-up = 'X'.
append wa_sort to it_sort.
clear wa_sort.
wa_sort-spos = '02'.
wa_sort-fieldname = 'POSNR' .
wa_sort-tabname = 'IT_VBAP'.
wa_sort-up = 'X'.
append wa_sort to it_sort.
endform. " sort_catalog
*& Form DISPLAY_REPORT
text
--> p1 text
<-- p2 text
form display_report .
it_variant-report = sy-repid.
sort it_vbak by vbeln.
sort it_vbap by vbeln posnr.
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
exporting
i_callback_program = sy-repid
is_layout = x_layout
it_fieldcat = it_fldcat[]
it_sort = it_sort
is_variant = it_variant
it_events = it_events[]
i_tabname_header = 'IT_VBAK'
i_tabname_item = 'IT_VBAP'
is_keyinfo = x_keyinfo
importing
e_exit_caused_by_caller = v_call
es_exit_caused_by_user = x_user
tables
t_outtab_header = it_vbak
t_outtab_item = it_vbap
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.
Regards,
Plz reward points and close the thread,
Laxmi. -
Need to use ALV instead of write:/ statement in this perform
How can I use ALV within this perform instead of using Write:/ in it.
Scroll the program. At the bottom there is use of write:/ statement.
How to use ALV in this perform?
FORM display_logfile .
TYPES: BEGIN OF lt_openbal,
bukrs TYPE bukrs,
hkont TYPE hkont,
augdt TYPE augdt,
augbl TYPE augbl,
zuonr TYPE dzuonr,
gjahr TYPE gjahr,
belnr TYPE belnr_d,
buzei TYPE buzei,
shkzg TYPE shkzg,
dmbtr TYPE dmbtr,
END OF lt_openbal,
BEGIN OF lt_log2,
hkont TYPE hkont,
opbal TYPE dmbtr,
exp TYPE dmbtr,
cap TYPE dmbtr,
err TYPE dmbtr,
END OF lt_log2,
BEGIN OF lt_zsct_record,
kongr TYPE ckml_kongr,
hkont TYPE hkont,
zcptp TYPE zdecptp,
zerrc TYPE zdeerrc,
END OF lt_zsct_record.
DATA: lw_zscs_record TYPE t_zscs_record,
lw_zsct_record TYPE lt_zsct_record,
li_zsct_record TYPE STANDARD TABLE OF lt_zsct_record,
li_zsct_record1 TYPE STANDARD TABLE OF lt_zsct_record,
lw_log1 TYPE t_zscs_record,
li_log1 TYPE STANDARD TABLE OF t_zscs_record,
li_temp TYPE STANDARD TABLE OF t_zsct_autoinv,
li_openbal TYPE STANDARD TABLE OF lt_openbal,
li_openbal_mod TYPE STANDARD TABLE OF lt_openbal,
li_log2 TYPE STANDARD TABLE OF lt_log2,
li_log2_t TYPE STANDARD TABLE OF lt_log2,
lw_log2 TYPE lt_log2,
lw_log2_t TYPE lt_log2,
lw_openbal_mod TYPE lt_openbal,
lw_openbal TYPE lt_openbal.
i_zscs_record1 = i_zscs_record.
DELETE i_zscs_record1 WHERE zerrf NE space.
SORT i_error_bapi BY recid.
SORT i_error_bdc BY recid.
SORT i_suc_bdc BY recid.
SORT i_suc_bapi BY recid.
SORT i_zscs_record1 BY recid.
LOOP AT i_zscs_record1 INTO lw_zscs_record.
lw_log1-recid = lw_zscs_record-recid.
lw_log1-kongr = lw_zscs_record-kongr.
lw_log1-hkont = lw_zscs_record-hkont.
CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT'
EXPORTING
input = lw_zscs_record-projk
IMPORTING
output = lw_log1-projk.
lw_log1-werks = lw_zscs_record-werks.
lw_log1-matnr = lw_zscs_record-matnr.
lw_log1-zcptp = lw_zscs_record-zcptp.
lw_log1-zerrf = lw_zscs_record-zerrf.
To Check if the KONGR value is is equal to 'E'
IF lw_zscs_record-kongr = c_e.
READ TABLE i_error_bapi INTO w_error_bapi WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
IF sy-subrc = 0.
lw_log1-zerrc = w_error_bapi-number.
lw_log1-zertx = w_error_bapi-message.
ENDIF.
ELSE.
READ TABLE i_error_bdc INTO w_error_bdc WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
IF sy-subrc = 0.
lw_log1-zerrc = w_error_bdc-number.
lw_log1-zertx = w_error_bdc-message.
ENDIF.
ENDIF.
*****To Check if the KONGR value is is equal to 'E'
IF lw_zscs_record-kongr = c_e.
READ TABLE i_suc_bapi INTO w_suc_bapi WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
IF sy-subrc = 0.
lw_log1-zerrf = c_x.
*******To check if lw_log1-zertx = w_error_bapi-message.
ENDIF.
ELSE.
READ TABLE i_suc_bdc INTO w_suc_bdc WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
IF sy-subrc = 0.
lw_log1-zerrf = c_x.
********To check if lw_log1-zertx = w_error_bdc-message.
ENDIF.
ENDIF.
APPEND lw_log1 TO li_log1.
*To clear work areas
CLEAR: lw_log1,
w_error_bapi,
w_suc_bdc,
w_suc_bapi,
w_error_bdc,
lw_zscs_record.
ENDLOOP.
IF NOT i_zscs_record1 IS INITIAL.
*To retrieve required data from the custom table ZSCT_AUTOINV
SELECT saknr
fipos
geber
saknr_off
fipos_off
FROM zsct_autoinv
INTO TABLE i_autoinv
FOR ALL ENTRIES IN i_zscs_record1
WHERE saknr = i_zscs_record1-hkont.
IF sy-subrc = 0.
SORT i_autoinv.
ENDIF.
ENDIF.
Assigning I_AUTOINV data into a local internal table for further processing
li_temp[] = i_autoinv[ ].
Sort LI_TEMP by SAKNR
SORT li_temp BY saknr.
Delete adjacent duplicates from LI_TEMP comparing SAKNR
DELETE ADJACENT DUPLICATES FROM li_temp COMPARING saknr.
Check if LI_TEMP is initial
IF NOT li_temp[] IS INITIAL.
Retrieve required data from table BSIS for all the G/L accounts
SELECT bukrs
hkont
augdt
augbl
zuonr
gjahr
belnr
buzei
shkzg
dmbtr
FROM bsis
INTO TABLE li_openbal_mod
FOR ALL ENTRIES IN li_temp
WHERE bukrs = c_wfp
AND hkont = li_temp-saknr.
IF sy-subrc = 0.
ENDIF.
ENDIF.
SORT li_openbal_mod BY hkont.
****Retrieve data from table ZSCT_RECORD for further processing for
****all entries where ZERRF is equal to space
IF p_prsall = c_x.
SELECT kongr
hkont
zcptp
zerrc
FROM zsct_record "#EC CI_NOFIRST
INTO TABLE li_zsct_record
WHERE zerrf = space.
IF sy-subrc = 0.
*****Delete records from LI_ZSCT_RECORD where HKONT value is equal to space
DELETE li_zsct_record WHERE hkont EQ space.
ENDIF.
ELSEIF p_cstcpt = c_x.
SELECT kongr
hkont
zcptp
zerrc
FROM zsct_record "#EC CI_NOFIRST
INTO TABLE li_zsct_record
WHERE zerrf = space
AND kongr NE c_e.
IF sy-subrc = 0.
******Delete records from LI_ZSCT_RECORD where HKONT value is equal to space
DELETE li_zsct_record WHERE hkont EQ space.
ENDIF.
ELSEIF p_cstexp = c_x.
SELECT kongr
hkont
zcptp
zerrc
FROM zsct_record "#EC CI_NOFIRST
INTO TABLE li_zsct_record
WHERE zerrf = space
AND kongr EQ c_e.
IF sy-subrc = 0.
******Delete records from LI_ZSCT_RECORD where HKONT value is equal to space
DELETE li_zsct_record WHERE hkont EQ space.
ENDIF.
ENDIF.
LOOP AT li_openbal_mod INTO lw_openbal.
IF lw_openbal-shkzg = c_shkzg1.
v_todmbtr = v_todmbtr + lw_openbal-dmbtr.
ELSEIF lw_openbal-shkzg = c_shkzg2.
v_todmbtr = v_todmbtr - lw_openbal-dmbtr.
ENDIF.
AT END OF hkont.
lw_log2-hkont = lw_openbal-hkont. "GL account
lw_log2-opbal = ABS( v_todmbtr ). "Open item balance
APPEND lw_log2 TO li_log2.
*log record appended with GL Account and account open item balance
CLEAR: v_todmbtr,
lw_openbal.
ENDAT .
ENDLOOP.
SORT li_log2 BY hkont.
LOOP AT li_log2 INTO lw_log2.
CLEAR v_totexppe.
CLEAR v_totcapit.
CLEAR v_toterror.
*Cost portion to be capitalised calculated
LOOP AT li_zsct_record INTO lw_zsct_record
WHERE hkont = lw_log2-hkont AND
kongr NE c_e AND zerrc IS INITIAL.
v_totcapit = v_totcapit + lw_zsct_record-zcptp. "CC calculated
ENDLOOP.
*Expensed cost portion calculated
LOOP AT li_zsct_record INTO lw_zsct_record WHERE
hkont = lw_log2-hkont AND
kongr = c_e AND zerrc IS INITIAL .
v_totexppe = v_totexppe + lw_zsct_record-zcptp. "ECP calculated
ENDLOOP.
*Errors calculated
LOOP AT li_zsct_record INTO lw_zsct_record WHERE
hkont = lw_log2-hkont AND
zerrc IS NOT INITIAL .
v_toterror = v_toterror + lw_zsct_record-zcptp. "Errors calculated
ENDLOOP.
lw_log2-exp = v_totexppe. "Expensed cost portion
lw_log2-cap = v_totcapit. "Cost capitalised
lw_log2-err = v_toterror. "Errors
*Cost portion capitalised expensed and errors in calculation are
*trans ported for related GL accont
MODIFY li_log2 FROM lw_log2
TRANSPORTING exp cap err.
ENDLOOP.
LOOP AT li_log2_t INTO lw_log2_t.
MODIFY li_log2 FROM lw_log2_t TRANSPORTING opbal WHERE hkont = lw_log2_t-hkont.
CLEAR : lw_log2_t.
ENDLOOP.
WRITE:/1(15) text-018,sy-datum. "SESSION DATE:
SKIP 2.
For printing the hear level of the output log
WRITE:/1(16) text-003, "Record ID number
20(11) text-004, "Reason Code
34(10) text-005, "GL Account
47(12) text-006, "Project Code
62(5) text-007, "Plant
70(9) text-008, "Commodity
82(25) text-009, "Cost portion To be posted
110(12) text-010, "Success Flag
125(10) text-011, "Error Code
138(50) text-012. "Error TXT
SKIP.
LOOP AT li_log1 INTO lw_log1.
WRITE:/1(16) lw_log1-recid,
20(11) lw_log1-kongr,
34(10) lw_log1-hkont,
47(12) lw_log1-projk,
62(5) lw_log1-werks,
70(9) lw_log1-matnr,
82(25) lw_log1-zcptp, "#EC UOM_IN_MES
110(12) lw_log1-zerrf,
125(10) lw_log1-zerrc,
138(80) lw_log1-zertx.
CLEAR:lw_log1.
ENDLOOP.
SKIP 2.
IF NOT li_log2 IS INITIAL.
ULINE.
WRITE:/1(16) text-013, "GL ACCOUNT CODE
20(17) text-014, "OPEN ITEM BALANCE
40(21) text-015, "EXPENSED COST PORTION
64(24) text-016, "CAPITALIZED COST PORTION
92(20) text-017. "ERRORS.
LOOP AT li_log2 INTO lw_log2.
WRITE:/1(16) lw_log2-hkont,
20(17) lw_log2-opbal,
40(21) lw_log2-exp,
64(24) lw_log2-cap,
92(20) lw_log2-err.
CLEAR:lw_log2.
ENDLOOP.
ENDIF.
ENDFORM. " DISPLAY_LOGFILEhi,
You need to use FM 'REUSE_ALV_LIST_DISPLAY' for this purpose. For using this FM, you need to create a field catlog which will contain all information about the coloumns you want to display for example their position, their text etc.
Below there is a small demo for achiving this.
TYPE-POOLS:slis.
DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
TYPES: BEGIN OF ty_itab1,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
werks LIKE vbap-werks,
lgort LIKE vbap-lgort,
END OF ty_itab1.
DATA: itab1 TYPE TABLE OF ty_itab1.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM select_data.
END-OF-SELECTION.
PERFORM display.
FORM select_data .
SELECT vbeln
posnr
werks
lgort
INTO CORRESPONDING FIELDS OF TABLE itab1
FROM vbap
WHERE vbeln IN s_vbeln.
IF sy-subrc <> 0.
MESSAGE 'Enter The Valid Sales Document Number'(t04) TYPE 'I'.
EXIT.
ENDIF.
ENDFORM.
IF alv_list = 'X'.
PERFORM build_fieldcat TABLES i_fieldcat[]
USING :
*-Output-field Table Len Ref fld Ref tab Heading Col_pos
'VBELN' 'ITAB1' 10 'VBAP' 'VBELN' '' 1,
'POSNR' 'ITAB1' 6 'VBAP' 'POSNR' '' 2,
'WERKS' 'ITAB1' 4 'VBAP' 'WERKS' '' 3,
'LGORT' 'ITAB1' 4 'VBAP' 'LGORT' '' 4.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = c_pf_status
i_callback_user_command = 'USER_COMMAND '
it_events = t_alv_events[]
it_fieldcat = i_fieldcat[]
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.
ENDIF.
FORM build_fieldcat TABLES fpt_fieldcat TYPE slis_t_fieldcat_alv
USING fp_field TYPE slis_fieldname
fp_table TYPE slis_tabname
fp_length TYPE dd03p-outputlen
fp_ref_tab TYPE dd03p-tabname
fp_ref_fld TYPE dd03p-fieldname
fp_seltext TYPE dd03p-scrtext_l
fp_col_pos TYPE sy-cucol.
*-- Local data declaration
DATA: wl_fieldcat TYPE slis_fieldcat_alv.
*-- Clear WorkArea
wl_fieldcat-fieldname = fp_field.
wl_fieldcat-tabname = fp_table.
wl_fieldcat-outputlen = fp_length.
wl_fieldcat-ref_tabname = fp_ref_tab.
wl_fieldcat-ref_fieldname = fp_ref_fld.
wl_fieldcat-seltext_l = fp_seltext.
wl_fieldcat-col_pos = fp_col_pos.
*-- Update Field Catalog Table
APPEND wl_fieldcat TO fpt_fieldcat.
ENDFORM. -
Using ALV function with tables
Hello Everyone,
Can anyone pls explain with an example how to use ALV in unicode to write out a table. Since following statements is porducing error:
write:/T510N, 'T510N was changed'.
it gives uncompatible error. In non unicode system it works fine.
Thanks in advanced.Hi
check this doc regarding Unicode
The Link will be helpful to you.
Re: Upgrade 4.6 to ECC - What are the responsibilites
regarding Unicode influence in Standard programs
Very good document:
http://www.doag.org/pub/docs/sig/sap/2004-03/Buhlinger_Maxi_Version.pdf
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d37d1ad9-0b01-0010-ed9f-bc3222312dd8
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/589d18d9-0b01-0010-ac8a-8a22852061a2
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f8e316d9-0b01-0010-8e95-829a58c1511a
You need to use the transaction UCCHECK.
The report documentation is here
ABAP Unicode Scan Tool UCCHECK
You can use transaction UCCHECK to examine a Unicode program set for syntax errors without having to set the program attribute "Unicode checks active" for every individual program. From the list of Unicode syntax errors, you can go directly to the affected programs and remove the errors. It is also possible to automatically create transport requests and set the Unicode program attribute for a program set.
Some application-specific checks, which draw your attention to program points that are not Unicode-compatible, are also integrated.
Selection of Objects:
The program objects can be selected according to object name, object type, author (TADIR), package, and original system. For the Unicode syntax check, only object types for which an independent syntax check can be carried out are appropriate. The following object types are possibilities:
PROG Report
CLAS Class
FUGR Function groups
FUGX Function group (with customer include, customer area)
FUGS Function group (with customer include, SAP area)
LDBA Logical Database
CNTX Context
TYPE Type pool
INTF Interface
Only Examine Programs with Non-Activated Unicode Flag
By default, the system only displays program objects that have not yet set the Unicode attribute. If you want to use UCCHECK to process program objects that have already set the attribute, you can deactivate this option.
Only Objects with TADIR Entry
By default, the system only displays program objects with a TADIR entry. If you want to examine programs that don't have a TADIR entry, for example locally generated programs without a package, you can deactivate this option.
Exclude Packages $*
By default, the system does not display program objects that are in a local, non-transportable package. If you want to examine programs that are in such a package, you can deactivate this option.
Display Modified SAP Programs Also
By default, SAP programs are not checked in customer systems. If you also want to check SAP programs that were modified in a customer system (see transaction SE95), you can activate this option.
Maximum Number of Programs:
To avoid timeouts or unexpectedly long waiting times, the maximum number of program objects is preset to 50. If you want to examine more objects, you must increase the maximum number or run a SAMT scan (general program set processing). The latter also has the advantage that the data is stored persistently. Proceed as follows:
- Call transaction SAMT
- Create task with program RSUNISCAN_FINAL, subroutine SAMT_SEARCH
For further information refer to documentation for transaction SAMT.
Displaying Points that Cannot Be Analyzed Statically
If you choose this option, you get an overview of the program points, where a static check for Unicode syntax errors is not possible. This can be the case if, for example, parameters or field symbols are not typed or you are accessing a field or structure with variable length/offset. At these points the system only tests at runtime whether the code is sufficient for the stricter Unicode tests. If possible, you should assign types to the variables used, otherwise you must check runtime behavior after the Unicode attribute has been set.
To be able to differentiate between your own and foreign code (for example when using standard includes or generated includes), there is a selection option for the includes to be displayed. By default, the system excludes the standard includes of the view maintenance LSVIM* from the display, because they cause a large number of messages that are not relevant for the Unicode conversion. It is recommended that you also exclude the generated function group-specific includes of the view maintenance (usually L<function group name>F00 and L<function group name>I00) from the display.
Similarly to the process in the extended syntax check, you can hide the warning using the pseudo comment ("#EC *).
Applikation-Specific Checks
These checks indicate program points that represent a public interface but are not Unicode-compatible. Under Unicode, the corresponding interfaces change according to the referenced documentation and must be adapted appropriately.
View Maintenance
Parts of the view maintenance generated in older releases are not Unicode-compatible. The relevant parts can be regenerated with a service report.
UPLOAD/DOWNLOAD
The function modules UPLOAD, DOWNLOAD or WS_UPLOAD and WS_DOWNLOAD are obsolete and cannot run under Unicode. Refer to the documentation for these modules to find out which routines serve as replacements.
Regards
Anji -
How to trigger New page while using ALV with classes/oops?
Hi All
I am trying to print a report which has to show the data in two pages.
I am using ALV with classes/oops.
Though I am able to print the report but a new page is not coming. Whole of the data is coming in one single page.
Please tell me as to how to trigger a NEW PAGE while using ALV with classes/oops.
Please send some code samples also if available.
Thanks in advance.
Jerryusing sort option you can do it. in case of grid/oo alv class ALV you can view that only in print mode/preview mode.
in case of list you can view that directly.
sort-fieldname = 'FIELDNAME'.
sort-group = '*' "triggers new page
sort-up = 'X'.
append sort to it_sort. -
How to use the alv function module
hi all,
can any one help me out how to use reuse_alv_block_list_append function module, what parameters shall i pass to it, so that i get top of page and end of page events and report data in two blocks, can any one tell how can i didvide the data into block, at a particular linehi,
this is my simple alv blockedlist programme.go through it.it will definrtley help u.
REPORT z50870alv_blocked.
TYPE-POOLS : slis.
*& structure declaration
TYPES : BEGIN OF st_ekko,
ebeln TYPE ekko-ebeln, "Purchasing Document Number
bstyp TYPE ekko-bstyp, "Purchasing Document Category
bsart TYPE ekko-bsart, "Purchasing Document Type
aedat TYPE ekko-aedat, "record created on
ernam TYPE ekko-ernam, "Person who Created the Object
END OF st_ekko.
TYPES : BEGIN OF st_ekpo,
ebeln TYPE ekko-ebeln,
ebelp TYPE ekpo-ebelp, "Item Number of Purchasing Document
ematn TYPE ekpo-ematn, "Material number
matkl TYPE ekpo-matkl, "Material group
netpr TYPE ekpo-netpr, "Net price in purchasing document
END OF st_ekpo.
*& internal table and work area declaration
DATA : it_ekpo TYPE STANDARD TABLE OF st_ekpo,
it_ekko TYPE STANDARD TABLE OF st_ekko,
it_fieldcat1 TYPE slis_t_fieldcat_alv,
wa_fieldcat1 TYPE slis_fieldcat_alv,
it_fieldcat2 TYPE slis_t_fieldcat_alv,
wa_fieldcat2 TYPE slis_fieldcat_alv,
it_events Type slis_t_event,
wa_layout TYPE slis_layout_alv.
*& data declaration
DATA : v_ebeln TYPE ekko-ebeln.
*& selection-screen
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-000.
SELECT-OPTIONS : so_ebeln FOR v_ebeln.
SELECTION-SCREEN END OF BLOCK a.
*& At-selection-screen
at selection-screen on so_ebeln.
perform validate_ebeln.
*& start-of-selection
START-OF-SELECTION.
PERFORM data_retrieval.
*& end-of-selection
END-OF-SELECTION.
PERFORM initialize_alv_block.
PERFORM build_fieldcatalog1.
PERFORM build_fieldcatalog2.
PERFORM build_layout.
PERFORM get_events .
PERFORM append_ekkodata_to_alv_block.
PERFORM append_ekpodata_to_alv_block.
PERFORM display_blocked_alv.
*& FORM initialize_alv_block
FORM initialize_alv_block.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = sy-repid.
endform.
*& FORM validate_ebeln
form validate_ebeln.
select ebeln
from ekko
into table it_ekko
where ebeln in so_ebeln.
if sy-subrc ne 0.
message text-003 type 'W'.
endif.
endform.
*& FORM data_retrieval
FORM data_retrieval.
SELECT ebeln bstyp bsart aedat ernam
FROM ekko
INTO TABLE it_ekko
WHERE ebeln IN so_ebeln.
if sy-subrc ne 0.
message text-001 type 'I'.
endif.
SELECT ebeln ebelp ematn matkl netpr
FROM ekpo
INTO TABLE it_ekpo
WHERE ebeln IN so_ebeln.
if sy-subrc ne 0.
message text-002 type 'I'.
endif.
endform.
*& Form build_fieldcatalog1
FORM build_fieldcatalog1.
wa_fieldcat1-fieldname = 'EBELN'.
wa_fieldcat1-seltext_l = 'PURCHASE ORDER'.
wa_fieldcat1-col_pos = 0.
APPEND wa_fieldcat1 TO it_fieldcat1.
wa_fieldcat1-fieldname = 'BSTYP'.
wa_fieldcat1-seltext_l = 'DOCUMENT CATEGORY'.
wa_fieldcat1-col_pos = 1.
APPEND wa_fieldcat1 TO it_fieldcat1.
wa_fieldcat1-fieldname = 'BSART'.
wa_fieldcat1-seltext_l = 'DOCUMENT TYPE'.
wa_fieldcat1-col_pos = 2.
APPEND wa_fieldcat1 TO it_fieldcat1.
wa_fieldcat1-fieldname = 'AEDAT'.
wa_fieldcat1-seltext_l = 'DATE'.
wa_fieldcat1-col_pos = 3.
APPEND wa_fieldcat1 TO it_fieldcat1.
wa_fieldcat1-fieldname = 'ERNAM'.
wa_fieldcat1-seltext_l = 'NAME'.
wa_fieldcat1-col_pos = 4.
APPEND wa_fieldcat1 TO it_fieldcat1.
ENDFORM. "build_fieldcatalog
*& Form build_fieldcatalog2
FORM build_fieldcatalog2.
wa_fieldcat2-fieldname = 'EBELN'.
wa_fieldcat2-seltext_l = 'PURCHASE ORDER'.
wa_fieldcat2-col_pos = 0.
APPEND wa_fieldcat2 TO it_fieldcat2.
wa_fieldcat2-fieldname = 'EBELP'.
wa_fieldcat2-seltext_l = 'ITEM NUMBER'.
wa_fieldcat2-col_pos = 1.
APPEND wa_fieldcat2 TO it_fieldcat2.
wa_fieldcat2-fieldname = 'EMATN'.
wa_fieldcat2-seltext_l = 'MATERIAL TYPE'.
wa_fieldcat2-col_pos = 2.
APPEND wa_fieldcat2 TO it_fieldcat2.
wa_fieldcat2-fieldname = 'MATKL'.
wa_fieldcat2-seltext_l = 'MATERIAL GROUP'.
wa_fieldcat2-col_pos = 3.
APPEND wa_fieldcat2 TO it_fieldcat2.
wa_fieldcat2-fieldname = 'NETPR'.
wa_fieldcat2-seltext_l = 'NET PRICE'.
wa_fieldcat2-col_pos = 4.
wa_fieldcat2-do_sum = 'X'.
APPEND wa_fieldcat2 TO it_fieldcat2.
ENDFORM. "build_fieldcatalog
*& form build_layout.
FORM build_layout.
wa_layout-zebra ='X'.
wa_layout-no_vline = 'X'.
wa_layout-no_hline = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-window_titlebar = 'PURCHASE ORDER HEADER AND ITEM DETAILS'.
ENDFORM. "build_layout
*& form append_ekkodata_to_alv_block
FORM append_ekkodata_to_alv_block.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout
it_fieldcat = it_fieldcat1
i_tabname ='it_ekko'
it_events = it_events[]
IT_SORT = IT_SORT
I_TEXT = ' '
TABLES
t_outtab = it_ekko
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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.
endform.
*& form append_ekpodata_to_alv_block
FORM append_ekpodata_to_alv_block.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout
it_fieldcat = it_fieldcat2
i_tabname ='it_ekpo'
it_events = it_events[]
IT_SORT = IT_SORT
I_TEXT = ' '
TABLES
t_outtab = it_ekpo
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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.
endform.
*& FORM display_blocked_alv.
FORM display_blocked_alv.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
endform.
*& Form GET_EVENTS
FORM get_events .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 2
IMPORTING
et_events = it_events[]
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " GET_EVENTS\
regards,
pavan t. -
How to use pf-status u2018menuu2019 in ALV report ?
Hi Friends,
How to use pf-status u2018menuu2019 in ALV report ?
I want to use back button ( F3). whenever press it should show
another report.
I used subroutine
form SUB_ERROR_OUTPUT USING RT_EXTAB TYPE SLIS_T_EXTAB .
SET PF-STATUS 'ZMENU' EXCLUDING RT_EXTAB. u201C( the button name is u201C back u201C)
CASE SY-UCOMM.
*WHEN '&F03'.
WHEN 'BACK'
( my coding is there ).
endcase.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PF_STATUS_SET = 'SUB_ERROR_OUTPUT'
but it is executing, working the back button but not showing another report .
any other procedure to use back button in alv report ?
plz any idea .
For correct answer reword most.
Thanking you.Purchase day Book .
Data to be down loaded / printed for EDP dept. CGL.
CGL - Requirement .
WRITTEN BY : ADI.****
*CONSULTANT : SANJAY JAJOO..
AS PER DP REQUIREMENT.
-CHANGED BY : KRISHNA MOHAN (15/01/2002)--
-CHANGE REQ BY : JAJU S--
-DESCRIPTION : SUMMRY BY TAX CODE WISE & GL CODE WISE--
---MODIFIED LINES: -
---CHANGED BY : -
---CHANGE REQ BY : -
---DESCRIPTION : -
---MODIFIED LINES: -
*---changed by : sanjay jajoo on 23/08
*---changed req by: Ranka
*---Description : Inserting Range of period as sel field
changed by : krishna mohan
func. consultant: sanjay jajoo
REPORT ZMMPURDB MESSAGE-ID 00
LINE-SIZE 255
LINE-COUNT 60
NO STANDARD PAGE HEADING .
TABLES : MKPF , MSEG ,SKAT,
EKKO , EKPO , EKBE ,
BSEG , BKPF , BSET ,
T009B , T001 , T007S ,
T001W , T001K ,LFA1.
******Table deactivated on 30/8/2000------jaju
*tables : zcgltaxatn .
DATA : ZFILE1(65) VALUE '/DOWNLOAD/'.
DATA : ZFILE2(65) .
DATA : ZFILE(30) TYPE C VALUE '/DOWNLOAD/'.
DATA : ZMON(2).
DATA : ZTOTAL(11) TYPE N.
DATA: ZTOT1 TYPE P DECIMALS 2.
DATA: ZTXT LIKE SKAT-TXT50.
TYPES: BEGIN OF COMPANY ,
HKONT LIKE BSEG-HKONT,
TOTAL LIKE BSEG-DMBTR,
END OF COMPANY.
DATA: COMP TYPE COMPANY,
COMPTAB TYPE HASHED TABLE OF COMPANY WITH UNIQUE KEY HKONT
WITH HEADER LINE.
DATA : NEXT LIKE BSEG-BUZEI. "A.A. (28/03/2000)
DATA : DOC LIKE BSEG-BELNR. "A.A. (28/03/2000)
DATA S_GSBER.
DATA: CTR TYPE I.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-B01.
PARAMETERS : T_BUKRS LIKE T001-BUKRS OBLIGATORY MEMORY ID BUK .
***********CH--ID- ADI- 29 / 09 / 1999
SELECT-OPTIONS : ZGL FOR BSEG-HKONT OBLIGATORY.
***********CH--ID- ADI- 29 / 09 / 1999
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(9) TEXT-C01 .
PARAMETERS : POPER RADIOBUTTON GROUP RAD1 .
SELECTION-SCREEN COMMENT 13(7) TEXT-C02 .
PARAMETERS : MONTH RADIOBUTTON GROUP RAD1 .
SELECTION-SCREEN COMMENT 23(8) TEXT-C03 .
SELECTION-SCREEN POSITION 33 .
commented on 22/08 sanjay jajoo
*PARAMETERS : T_MONAT LIKE BKPF-MONAT .
SELECTION-SCREEN END OF LINE.
PARAMETERS : T_GJAHR LIKE BKPF-GJAHR OBLIGATORY .
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS : S_DOCTYP FOR BKPF-BLART,
S_VENDOR FOR LFA1-LIFNR MATCHCODE OBJECT KRED,
S_MATNR FOR BSEG-MATNR NO-DISPLAY,
T_BUDAT FOR MKPF-BUDAT NO-EXTENSION MODIF ID DAT,
p_gsber FOR bseg-gsber OBLIGATORY,
P_GSBER FOR BSEG-GSBER,
mod starts for inserting range of period - sanjay jajoo
T_MONAT FOR BKPF-MONAT OBLIGATORY.
mod ends
*SELECT-OPTIONS: br_blart FOR mkpf-blart.
*Select-options: br_blart for bkpf-blart.
SELECTION-SCREEN END OF BLOCK B1 .
Start of Delete by B.Elan on 23/12/2005
*PARAMETERS : errors AS CHECKBOX .
*PARAMETERS : summary AS CHECKBOX .
*PARAMETERS : nodetail AS CHECKBOX .
**selection-screen skip 2.
*SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-b03. "<<<
*Add
*PARAMETER : stax_reg RADIOBUTTON GROUP rad2 . "<<<
*Add
*PARAMETER : pur_db RADIOBUTTON GROUP rad2 . "<<<
*Add
*SELECTION-SCREEN END OF BLOCK b3 . "<<< Add
*SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-b02.
*PARAMETERS : display RADIOBUTTON GROUP grp1 ,
dload RADIOBUTTON GROUP grp1.
*PARAMETERS : fname1 LIKE rlgrap-filename .
*DATA : zdoc LIKE bseg-belnr.
*DATA : fname LIKE rlgrap-filename.
*SELECTION-SCREEN END OF BLOCK b2 .
End of Delete by B.Elan on 23/12/2005
Start of Insert by B.Elan on 23/12/2005
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(5) TEXT-C01.
PARAMETER : PUR_DB RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN COMMENT 10(25) TEXT-C06.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(5) TEXT-C01.
PARAMETERS : MAT_SM RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN COMMENT 10(25) TEXT-C04.
SELECTION-SCREEN COMMENT 35(5) TEXT-C01.
PARAMETERS : VEN_SM RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN COMMENT 44(20) TEXT-C05.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(5) TEXT-C01.
PARAMETERS : MAT_DT RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN COMMENT 10(25) TEXT-C07.
SELECTION-SCREEN COMMENT 35(5) TEXT-C01.
PARAMETERS : VEN_DT RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN COMMENT 44(20) TEXT-C08.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
End of Insert by B.Elan on 23/12/2005
Hard coded values used in the program
added by krishna mohan on 09/02/02
DATA : BEGIN OF IT_MSEG OCCURS 0,
BELNR LIKE BSEG-BELNR,
MBLNR LIKE MSEG-MBLNR,
EBELN LIKE BSEG-EBELN,
EBELP LIKE BSEG-EBELP,
END OF IT_MSEG.
mod ends
Start of Insert by B.Elan on 23/12/2005
*--vikky
DATA : BEGIN OF IT_FINAL OCCURS 0,
MATNR LIKE MARA-MATNR,
BLART LIKE BKPF-BLART, " doctype
BELNR LIKE BSEG-BELNR, "sr - nO 10
XBLNR LIKE BKPF-XBLNR , " Bill-no 16
NAME1_VENDOR(25),
"lfa1-name1, " Vendor Name 35
HKONT LIKE BSEG-HKONT , " Alloc-cd 10
MWSKZ LIKE EKPO-MWSKZ , " St-cd 2
BUDAT LIKE BKPF-BUDAT , " Bill-dt 10
DUE_DATE LIKE BSEG-ZFBDT , " Due date 10
PON LIKE EKKO-EBELN , " PON 10
MAKTX LIKE MAKT-MAKTX, "Material text 40
MBLNR LIKE MSEG-MBLNR,
QTY(8) TYPE P DECIMALS 2 , "Qty 11
RATE(9) TYPE P DECIMALS 2 , "Rate11
DISCOUNT(7) TYPE P DECIMALS 2, "DISCOUNT 11
PROD-AMT(9) TYPE P DECIMALS 2,
"AMOUNT 13
EXCISE(8) TYPE P DECIMALS 2 , "eXCISE TAX 11
SALES(5) TYPE P DECIMALS 2 , "SALES TAX 11
FREIGHT(9) TYPE P DECIMALS 2, "FREIGHT 11
OTHERS(11) TYPE P DECIMALS 2, " OTHERS 11
TOTAL(9) TYPE P DECIMALS 2, "TOTAL 17
END OF IT_FINAL.
*DATA : BEGIN OF IT_FINAL OCCURS 0,
MATNR LIKE MARA-MATNR,
BLART LIKE BKPF-BLART, " doctype
BELNR LIKE BSEG-BELNR, "sr - nO 10
XBLNR LIKE BKPF-XBLNR , " Bill-no 16
NAME1_VENDOR(25),
"lfa1-name1, " Vendor Name 35
HKONT LIKE BSEG-HKONT , " Alloc-cd 10
MWSKZ LIKE EKPO-MWSKZ , " St-cd 2
BUDAT LIKE BKPF-BUDAT , " Bill-dt 10
DUE_DATE LIKE BSEG-ZFBDT , " Due date 10
PON LIKE EKKO-EBELN , " PON 10
MAKTX LIKE MAKT-MAKTX, "Material text 40
MBLNR LIKE MSEG-MBLNR,
QTY(13) TYPE P DECIMALS 2 , "Qty 11
RATE(13) TYPE P DECIMALS 2 , "Rate 11
DISCOUNT(13) TYPE P DECIMALS 2, "DISCOUNT 11
PROD-AMT(13) TYPE P DECIMALS 2,
"AMOUNT 13
EXCISE(13) TYPE P DECIMALS 2 , "eXCISE TAX 11
SALES(13) TYPE P DECIMALS 2 , "SALES TAX 11
FREIGHT(13) TYPE P DECIMALS 2, "FREIGHT 11
OTHERS(13) TYPE P DECIMALS 2, " OTHERS 11
TOTAL(13) TYPE P DECIMALS 2, "TOTAL 17
END OF IT_FINAL.
*--vikky
DATA : BEGIN OF IT_FINAL_VN OCCURS 0,
NAME1_VENDOR(25),
"lfa1-name1, " Vendor Name 35
MATNR LIKE MARA-MATNR,
BLART LIKE BKPF-BLART, " doctype
BELNR LIKE BSEG-BELNR, "sr - nO 10
XBLNR LIKE BKPF-XBLNR , " Bill-no 16
HKONT LIKE BSEG-HKONT , " Alloc-cd 10
MWSKZ LIKE EKPO-MWSKZ , " St-cd 2
BUDAT LIKE BKPF-BUDAT , " Bill-dt 10
DUE_DATE LIKE BSEG-ZFBDT , " Due date 10
PON LIKE EKKO-EBELN , " PON 10
MAKTX LIKE MAKT-MAKTX, "Material text 40
MBLNR LIKE MSEG-MBLNR,
QTY(8) TYPE P DECIMALS 2 , "Qty 11
RATE(9) TYPE P DECIMALS 2 , "Rate 11
DISCOUNT(7) TYPE P DECIMALS 2, "DISCOUNT 11
PROD-AMT(9) TYPE P DECIMALS 2,
"AMOUNT 13
EXCISE(5) TYPE P DECIMALS 2 , "eXCISE TAX 11
SALES(5) TYPE P DECIMALS 2 , "SALES TAX 11
FREIGHT(5) TYPE P DECIMALS 2, "FREIGHT 11
OTHERS(9) TYPE P DECIMALS 2, " OTHERS 11
TOTAL(9) TYPE P DECIMALS 2, "TOTAL 17
END OF IT_FINAL_VN.
End of Insert by B.Elan on 23/12/2005
DATA: BEGIN OF ITAB_DISPLAY OCCURS 0,
BLART LIKE BKPF-BLART, " doctype
BELNR LIKE BSEG-BELNR, "sr - nO 10
XBLNR LIKE BKPF-XBLNR , " Bill-no 16
NAME1_VENDOR(25), "lfa1-name1, " Vendor Name 35
HKONT LIKE BSEG-HKONT , " Alloc-cd 10
MWSKZ LIKE EKPO-MWSKZ , " St-cd 2
BUDAT LIKE BKPF-BUDAT , " Bill-dt 10
DUE_DATE LIKE BSEG-ZFBDT , " Due date 10
PON LIKE EKKO-EBELN , " PON 10
MAKTX LIKE MAKT-MAKTX, "Material text 40
QTY(8) TYPE P DECIMALS 2 , "Qty 11
"qty 5
RATE(5) TYPE P DECIMALS 2 , "Rate 11
mod starts on 21/08 for inc size to 7
RATE(9) TYPE P DECIMALS 2 , "Rate 11
"Rate 7
mod ends - sanjay jajoo 21/08
DISCOUNT(7) TYPE P DECIMALS 2, "DISCOUNT 11
PROD-AMT(9) TYPE P DECIMALS 2, "AMOUNT 13
EXCISE(5) TYPE P DECIMALS 2 , "eXCISE TAX 11
SALES(5) TYPE P DECIMALS 2 , "SALES TAX 11
FREIGHT(5) TYPE P DECIMALS 2, "FREIGHT 11
OTHERS(9) TYPE P DECIMALS 2, " OTHERS 11 " added by vik on
*21.08.2008
TOTAL(9) TYPE P DECIMALS 2, "TOTAL 17
TOTAL1(9) TYPE P DECIMALS 2,
MATNR LIKE MARA-MATNR,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
END OF ITAB_DISPLAY.
DATA: BEGIN OF ITAB_TOTAL1 OCCURS 0,
HKONT LIKE BSEG-HKONT,
TOTAL TYPE P DECIMALS 2,
TXT50 LIKE SKAT-TXT50,
END OF ITAB_TOTAL1.
DATA: BEGIN OF ITAB_KONV OCCURS 0,
KNUMV LIKE KONV-KNUMV,
KPOSN LIKE KONV-KPOSN,
STUNR LIKE KONV-STUNR,
ZAEHK LIKE KONV-ZAEHK,
KSCHL LIKE KONV-KSCHL,
KWERT LIKE KONV-KWERT,
END OF ITAB_KONV.
DATA:BEGIN OF ITAB_RATE_MODVAT OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MENGE LIKE EKPO-MENGE,
BRTWR LIKE EKPO-BRTWR,
KZWI5 LIKE EKPO-KZWI5,
KNUMV LIKE EKKO-KNUMV,
MATNR LIKE EKPO-MATNR,
TXZ01 LIKE EKPO-TXZ01,
END OF ITAB_RATE_MODVAT.
DATA: BEGIN OF ITAB_PO OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
END OF ITAB_PO.
DATA: BEGIN OF ITAB_PO_ITEM OCCURS 0,
BELNR LIKE BSEG-BELNR,
EBELN LIKE BSEG-EBELN,
BUZID LIKE BSEG-BUZID,
XBLNR LIKE BKPF-XBLNR,
MATNR LIKE BSEG-MATNR,
EBELP LIKE BSEG-EBELP,
MENGE LIKE BSEG-MENGE,
WRBTR LIKE BSEG-WRBTR,
EXCISE LIKE BSEG-DMBTR, " ADDED ON 21/01/02 FOR 27500 EXCISE
SGTXT LIKE BSEG-SGTXT, " ADDED ON 24/01/02
FLAG,
END OF ITAB_PO_ITEM.
DATA:BEGIN OF I_LFA1 OCCURS 0,
LIFNR LIKE BSEG-LIFNR,
END OF I_LFA1.
DATA: BEGIN OF I_VENDOR OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF I_VENDOR.
DATA: BEGIN OF ITAB_PO_OTHERS OCCURS 0,
BELNR LIKE BSEG-BELNR,
MATNR LIKE BSEG-MATNR,
EBELN LIKE BSEG-EBELN,
EBELP LIKE BSEG-EBELP,
MENGE LIKE BSEG-MENGE,
WRBTR LIKE BSEG-WRBTR,
END OF ITAB_PO_OTHERS.
DATA: BEGIN OF ITAB_FINAL OCCURS 0,
BUKRS LIKE BSEG-BUKRS,
BELNR LIKE BSEG-BELNR,
GJAHR LIKE BSEG-GJAHR,
BUZEI LIKE BSEG-BUZEI,
BUZID LIKE BSEG-BUZID,
SHKZG LIKE BSEG-SHKZG,
EBELN LIKE BSEG-EBELN,
EBELP LIKE BSEG-EBELP,
MENGE LIKE BSEG-MENGE,
WRBTR LIKE BSEG-WRBTR,
MATNR LIKE BSEG-MATNR,
HKONT LIKE BSEG-HKONT, " ADDED ON 21/01/02 FOR 27500 EXCISE
SGTXT LIKE BSEG-SGTXT, " ADDED ON 24/01/02 FOR SALES TAX
END OF ITAB_FINAL.
DATA : BEGIN OF ITAB OCCURS 100 ,
MWSKZ LIKE EKPO-MWSKZ , " St-cd
HKONT LIKE BSEG-HKONT , " Alloc-cd
MBLNR LIKE MKPF-MBLNR , " Sr-No
LIFNR LIKE LFA1-LIFNR , " Supp-cd
XBLNR LIKE BKPF-XBLNR , " Bill-no
BUDAT LIKE BKPF-BUDAT , " Bill-dt
DUE_DATE LIKE BSEG-ZFBDT , " Due date
PON LIKE EKKO-EBELN , " PON
BELNR LIKE BKPF-BELNR , " CCI no
DMBTR LIKE BSEG-DMBTR , " Prod-amount
EXCISE LIKE BSEG-DMBTR , " Excise / ModVAT
ST_INV LIKE BSEG-DMBTR , " Sales Tax Loaded on Inv.
ST_SET LIKE BSEG-DMBTR , " Sales Tax setoff .
OCT_TOT LIKE BSEG-DMBTR , " A,A, (29/03/2000) Octroi chargs
PT_PABLE LIKE BSEG-DMBTR , " Purchase tax payable
ST_TOT LIKE BSEG-DMBTR , " Sales Tax total
OTHR_CHRG LIKE BSEG-DMBTR , " Other chagres
NEBTR LIKE BSEG-NEBTR, " Total-amount
NAME1_VENDOR LIKE LFA1-NAME1, " Vendor Name
END OF ITAB.
DATA: BEGIN OF ITAB_DOC OCCURS 0,
BELNR LIKE BKPF-BELNR,
BLART LIKE BKPF-BLART,
END OF ITAB_DOC.
DATA : BEGIN OF DOCTAB OCCURS 100 ,
MWSKZ LIKE BSEG-MWSKZ ,
HKONT LIKE BSEG-HKONT ,
BELNR LIKE BKPF-BELNR ,
Changed By Pankaj 19.03.99
Included field fiscal year
GJAHR LIKE BKPF-GJAHR ,
BUDAT LIKE BKPF-BUDAT ,
XBLNR LIKE BKPF-XBLNR ,
LIFNR LIKE LFA1-LIFNR ,
ZTERM LIKE BSEG-ZTERM ,
AMOUNT LIKE BSEG-DMBTR ,
DMBTR LIKE BSEG-DMBTR ,
OTHR_CHRG LIKE BSEG-DMBTR ,
MBLNR LIKE MKPF-MBLNR ,
MJAHR LIKE MSEG-MJAHR ,
DUE_DATE LIKE BSEG-ZFBDT ,
PON LIKE EKKO-EBELN ,
JMO1 LIKE BSEG-DMBTR ,
JMO2 LIKE BSEG-DMBTR ,
JIP1 LIKE BSEG-DMBTR ,
JIP2 LIKE BSEG-DMBTR ,
************CH-ID-ADI-START-28 / 09 / 1999
JIP4 LIKE BSEG-DMBTR ,
ZTUT LIKE BSEG-DMBTR ,
*****************ABEY
ZOCT LIKE BSEG-DMBTR ,
*****************END
************CH-ID-ADI-START-28 / 09 / 1999
ZSET LIKE BSEG-DMBTR ,
ZPTX LIKE BSEG-DMBTR ,
BLART LIKE BKPF-BLART ,
END OF DOCTAB .
Download for EDP "EDP
DATA : BEGIN OF DOWNLOAD OCCURS 100 ,
SIGN1(1) ,
TOT_VAL(11) TYPE N,
SIGN2(1) ,
TAXABLE(11) TYPE N ,
SIGN3(1) ,
TOT_TAX(11) TYPE N ,
SIGN4(1) ,
SURCHARG(9) TYPE N ,
SIGN5(1) ,
ST_AMT(9) TYPE N ,
SIGN6(1) ,
OTH_CHRG(9) TYPE N ,
******************************ch-adi-start-28 / 09 / 1999
SIGN7(1),
TOT(9) TYPE N,
******************************ch-adi-end-28 / 09 / 1999
TYPE(1) TYPE N ,
STKY1(1) TYPE N ,
STBR(2) ,
STDV(2) ,
STCC(1) ,
STKY(1) ,
STDC(2) TYPE N ,
STTYP(1) ,
STCODE(2) ,
STRATE(2) TYPE N ,
STRTT(2) TYPE N ,
SERIAL_NO(6) TYPE N ,
STACP(9) ,
BLANK1(3) ,
STYRMN(6) ,
BLANK2(7) TYPE C .
DATA : END OF DOWNLOAD .
DATA : BEGIN OF GLTAB OCCURS 5 ,
MWSKZ LIKE BSEG-MWSKZ, " << ADD A.A. (01.02.2000)
HKONT LIKE BSEG-HKONT ,
DMBTR LIKE BSEG-DMBTR , " Prod-amount
EXCISE LIKE BSEG-DMBTR , " Excise / ModVAT
ST_INV LIKE BSEG-DMBTR , " Sales Tax Loaded on Inv.
ST_SET LIKE BSEG-DMBTR , " Sales Tax setoff .
PT_PABLE LIKE BSEG-DMBTR , " Purchase tax payable
ST_TOT LIKE BSEG-DMBTR , " Sales Tax total
OTHR_CHRG LIKE BSEG-DMBTR , " Other Charges
NEBTR LIKE BSEG-NEBTR. " Total-amount
DATA : END OF GLTAB .
DATA : BEGIN OF ERRORTAB OCCURS 5 .
INCLUDE STRUCTURE ITAB .
DATA : END OF ERRORTAB .
*- Start of change by Raj on 3-Spet-05
DATA : V_TMPVAL TYPE P DECIMALS 2.
*- End of change by Raj on 3-Spet-05
DATA : STRING LIKE BKPF-AWKEY ,
V_NO TYPE I,
V_EBELN LIKE BSEG-EBELN,
V_MATNR LIKE BSEG-MATNR. " ADDED ON 21/01/02 FOR BUZID = 'S'
Start of Insert by B.Elan on 23/12/2005
WORK AREA
DATA : WA_DISPLAY LIKE ITAB_DISPLAY.
DATA : V_UCOMM TYPE SY-UCOMM.
CONSTANTS : C_X TYPE C VALUE 'X'.
End of Insert by B.Elan on 23/12/2005
AT SELECTION-SCREEN ON T_BUKRS.
SELECT SINGLE * FROM T001 WHERE BUKRS = T_BUKRS .
IF SY-SUBRC NE 0 .
MESSAGE E368 WITH T_BUKRS TEXT-M01 .
ENDIF .
AT SELECTION-SCREEN ON T_MONAT.
PERFORM check_period_year USING 'X'. " COMMENTED
AT SELECTION-SCREEN ON T_GJAHR.
PERFORM check_period_year USING ' '. "COMMENTED
Start of Delete by B.Elan on 23/12/2005
*AT SELECTION-SCREEN ON RADIOBUTTON GROUP grp1 .
CLEAR fname .
DATA : BEGIN OF xt247 OCCURS 12 .
INCLUDE STRUCTURE t247 .
DATA : END OF xt247 .
CHECK dload EQ 'X' .
REFRESH xt247 .
IF poper EQ 'X' .
MESSAGE e368 WITH text-m05 .
ENDIF .
CALL FUNCTION 'MONTH_NAMES_GET'
TABLES
month_names = xt247
EXCEPTIONS
month_names_not_found = 1
OTHERS = 2.
READ TABLE xt247 WITH KEY mnr = t_monat .
CONCATENATE 'STAXSUMM.' xt247-ktx INTO fname .
CONCATENATE '
DOWNLOAD\' fname INTO fname1.
CONCATENATE zfile1 fname INTO zfile2.
CONDENSE fname1 NO-GAPS.
CONDENSE zfile2 NO-GAPS.
CONCATENATE 'STAXSUMM.' xt247-ktx INTO fname .
End of Delete by B.Elan on 23/12/2005
AT SELECTION-SCREEN OUTPUT .
LOOP AT SCREEN .
IF SCREEN-NAME EQ 'FNAME' .
SCREEN-INPUT = 0.
MODIFY SCREEN .
ENDIF .
IF SCREEN-GROUP2 EQ 'DBS' .
SCREEN-ACTIVE = 0 .
MODIFY SCREEN .
IF SCREEN-NAME EQ 'BR_BLART-LOW' .
Form the select option for the LDB .
CLEAR BR_BLART . REFRESH BR_BLART .
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
BR_BLART-LOW = 'RE' .
APPEND BR_BLART .
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
BR_BLART-LOW = 'SR' .
APPEND BR_BLART .
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
BR_BLART-LOW = 'SP' .
APPEND BR_BLART . " ADD ON 11122003 JAJ
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
br_blart-low = 'VI' .
BR_BLART-LOW = 'ST'.
APPEND BR_BLART .
BR_BLART-LOW = 'S1'.
APPEND BR_BLART .
BR_BLART-LOW = 'P1'.
APPEND BR_BLART .
BR_BLART-LOW = 'PM'.
APPEND BR_BLART .
BR_BLART-LOW = 'R1'.
APPEND BR_BLART .
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
BR_BLART-LOW = 'KR' .
APPEND BR_BLART .
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
*************CH-ID-ADI---30 / 09 / 1999.
BR_BLART-LOW = 'RA'.
APPEND BR_BLART .
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
BR_BLART-LOW = 'EM'.
APPEND BR_BLART .
BR_BLART-SIGN = 'I' .
BR_BLART-OPTION = 'EQ' .
BR_BLART-LOW = 'EI' .
APPEND BR_BLART .
ENDIF .
ENDIF .
CHECK SCREEN-GROUP1 EQ 'DAT' .
SCREEN-INPUT = 0.
MODIFY SCREEN .
ENDLOOP .
START-OF-SELECTION .
Block 1 - Selection of accounting documents in the posting period
is done through the LDB
GET BKPF .
commented on 22/08
CHECK BKPF-MONAT = T_MONAT.
CHECK BKPF-MONAT IN T_MONAT.
CHECK BKPF-GJAHR = T_GJAHR.
CHECK BKPF-STBLG IS INITIAL . "<<<< Reversed
*CHECK bkpf-budat IN t_budat .
CHECK BKPF-BUKRS EQ T_BUKRS .
CHECK BKPF-BUKRS EQ T_BUKRS .
CHECK BKPF-BSTAT EQ SPACE . "<<< Sample docs
CHECK BKPF-BLART EQ 'RE' "MM-IV
OR BKPF-BLART EQ 'KR' "FI-IV
OR bkpf-blart EQ 'VI' "FI-IV Direct
*************CH-ID-ADI-30 / 09 / 1999
OR bkpf-blart EQ 'RA' "CASH CCI
OR bkpf-blart EQ 'EM' "MAINTAINANCE
OR bkpf-blart EQ 'EI' . "IDT
OR BKPF-BLART EQ 'P1'
OR BKPF-BLART EQ 'PM'
OR BKPF-BLART EQ 'R1'
OR BKPF-BLART EQ 'S1'
OR BKPF-BLART EQ 'ST'
OR BKPF-BLART EQ 'SR' " ADD ON 101203 JAJ
OR BKPF-BLART EQ 'SP'.
*************CH-ID-ADI-30 / 09 / 1999
CLEAR DOCTAB .
DOCTAB-BLART = BKPF-BLART .
DOCTAB-BELNR = BKPF-BELNR .
DOCTAB-BUDAT = BKPF-BUDAT .
DOCTAB-XBLNR = BKPF-XBLNR .
Added By Pankaj 19.03.99
Initializing fiscal year for document table
DOCTAB-GJAHR = BKPF-GJAHR .
APPEND DOCTAB.
Tax details
GET BSET . " Commented because LDB gives wrong BSET entries
" for some documents
CASE BSET-KSCHL .
WHEN 'JMO1' .
DOCTAB-JMO1 = DOCTAB-JMO1 + BSET-HWSTE .
WHEN 'JMO2' .
DOCTAB-JMO2 = DOCTAB-JMO2 + BSET-HWSTE .
WHEN 'JIP1' .
DOCTAB-JIP1 = DOCTAB-JIP1 + BSET-HWSTE .
WHEN 'JIP2' .
DOCTAB-JIP2 = DOCTAB-JIP2 + BSET-HWSTE .
WHEN 'ZSET' .
break deven .
DOCTAB-ZSET = DOCTAB-ZSET + BSET-HWSTE .
WHEN 'ZPTX' .
DOCTAB-ZPTX = DOCTAB-ZPTX + BSET-HWSTE .
ENDCASE .
DOCTAB-MWSKZ = BSET-MWSKZ.
MODIFY DOCTAB INDEX SY-TABIX.
Item details
*changed by srinivas yerra.
GET BSEG .
IF BSEG-KOART = 'K' . "<<< Vendor Line
IF BSEG-KOART = 'K' .
*end of chnages by srinivas yerra.
DOCTAB-LIFNR = BSEG-LIFNR .
IF NOT BSEG-ZTERM IS INITIAL .
DOCTAB-ZTERM = BSEG-ZTERM .
DOCTAB-DUE_DATE = BSEG-ZFBDT + BSEG-ZBD1T .
ENDIF .
IF BSEG-SHKZG EQ 'H' . "<< Add credits
DOCTAB-AMOUNT = DOCTAB-AMOUNT + BSEG-DMBTR .
ELSE . "<< Subtr debits
DOCTAB-AMOUNT = DOCTAB-AMOUNT - BSEG-DMBTR .
ENDIF .
ENDIF .
CASE BSEG-KTOSL .
WHEN 'WRX' .
DOCTAB-PON = BSEG-EBELN .
IF DOCTAB-MWSKZ IS INITIAL .
DOCTAB-MWSKZ = BSEG-MWSKZ .
ENDIF .
WHEN 'BSX' .
***********ABEY
IF NEXT = BSEG-BUZEI
AND
DOC = BSEG-BELNR
AND
( BSEG-BUZID = 'M'
OR
BSEG-HKONT = 50765 ).
DOCTAB-ZOCT = DOCTAB-ZOCT + BSEG-DMBTR.
IF BSEG-SHKZG EQ 'H' . "<< Subtr credits
DOCTAB-OTHR_CHRG = DOCTAB-OTHR_CHRG - BSEG-DMBTR .
ELSE . "<< Add debits
DOCTAB-OTHR_CHRG = DOCTAB-OTHR_CHRG + BSEG-DMBTR .
ENDIF .
ENDIF .
************END
IF BSEG-SHKZG EQ 'S' .
DOCTAB-DMBTR = DOCTAB-DMBTR + BSEG-DMBTR .
ELSE .
DOCTAB-DMBTR = DOCTAB-DMBTR - BSEG-DMBTR .
ENDIF .
WHEN 'OCT' OR 'FRE' OR 'FR1' OR SPACE .
*****CH-ID-ADI-30 / 09 /1999.
IF ( ( BKPF-BLART = 'EM' OR BKPF-BLART = 'RA' OR BKPF-BLART =
'EI')
AND BSEG-KTOSL = SPACE ) OR BSEG-MWSKZ = '9W' OR BSEG-MWSKZ =
'K9' OR
BSEG-MWSKZ =
'X9'.
DOCTAB-OTHR_CHRG = 0.
ELSE.
*********CH-ID-ADI--01 / 10 / 1999
Other Charges only for accounts other than vendor acc.
CHECK BSEG-BUZID NE 'T' .
CHECK BSEG-BUZID NE 'P' .
IF BSEG-KOART NE 'K' .
*********ABEY (25/02/2000), (21/02/2000)
IF BSEG-BUZID = 'F'
OR BSEG-HKONT = 75461.
NEXT = BSEG-BUZEI + 1.
DOC = BSEG-BELNR.
DOCTAB-ZOCT = DOCTAB-ZOCT + BSEG-DMBTR.
ENDIF.
IF BSEG-BUZEI = NEXT
AND
( BSEG-BUZID = 'M'
OR
BSEG-HKONT = 50765 ).
DOCTAB-ZOCT = DOCTAB-ZOCT + BSEG-DMBTR.
ENDIF.
*********END
IF BSEG-SHKZG EQ 'H' . "<< Subtr credits
DOCTAB-OTHR_CHRG = DOCTAB-OTHR_CHRG - BSEG-DMBTR .
ELSE . "<< Add debits
DOCTAB-OTHR_CHRG = DOCTAB-OTHR_CHRG + BSEG-DMBTR .
ENDIF .
ENDIF .
*****NEXT-LINE ADDED BY ADI
ENDIF .
*************END.
ENDCASE .
*CHANGED BY SRINIVAS YERRA
*MODIFY DOCTAB INDEX SY-TABIX.
APPEND DOCTAB.
*END OF CHANGES.
PO History
GET EKBE .
CHECK DOCTAB-BELNR EQ EKBE-BELNR .
DOCTAB-MBLNR = EKBE-LFBNR .
DOCTAB-MJAHR = EKBE-LFGJA .
MODIFY DOCTAB INDEX SY-TABIX .
PERFORM show_indicator USING text-m02 .
*PERFORM convert_data.
END-OF-SELECTION .
Data read from LDB is converted into printable format.
PERFORM SHOW_INDICATOR USING TEXT-M04 .
PERFORM CONVERT_DATA .
Start of Delete by B.Elan on 23/12/2005
IF stax_reg EQ 'X' . "<<< Add
SORT itab BY mwskz hkont belnr .
ELSE . "<<< Add
SORT itab BY belnr . "<<< Add
SORT itab BY pon.
ENDIF . "<<< Add
Perform further operation based on user input
IF display EQ 'X' .
PERFORM write_itab.
PERFORM write_data .
ELSE .
PERFORM download_data .
ENDIF .
End of Delete by B.Elan on 23/12/2005
Start of Insert by B.Elan on 23/12/2005
SORT ITAB BY BELNR.
PERFORM WRITE_DATA.
IF MAT_SM = C_X.
PERFORM WRITE_MATERIAL_SUMMARY.
ELSEIF MAT_DT = C_X.
PERFORM WRITE_MATERIAL_DETAILS.
ELSEIF VEN_SM = C_X.
PERFORM WRITE_VENDOR_SUMMARY.
ELSEIF VEN_DT = C_X.
PERFORM WRITE_VENDOR_DETAILS.
ENDIF.
End of Insert by B.Elan on 23/12/2005
Start of Insert by B.Elan on 23/12/2005
AT USER-COMMAND.
V_UCOMM = SY-UCOMM.
CASE V_UCOMM.
WHEN 'DETLS'.
NEW-PAGE.
PUR_DB = C_X.
PERFORM CLEAR_DETAILS.
PERFORM WRITE_DATA.
WHEN 'MSUMRY'.
PERFORM WRITE_MATERIAL_SUMMARY.
WHEN 'MDETL'.
PERFORM WRITE_MATERIAL_DETAILS.
WHEN 'VSUMRY'.
PERFORM WRITE_VENDOR_SUMMARY.
WHEN 'VDETL'.
PERFORM WRITE_VENDOR_DETAILS.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
End of Insert by B.Elan on 23/12/2005
*- - - - - - - - - End Of Execution .- - - - - - - - - - - - - - - - - -
TOP-OF-PAGE .
IF PUR_DB = C_X.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_PUR_DB.
ELSEIF MAT_SM = C_X.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_MAT_SM.
ELSEIF MAT_DT = C_X.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_MAT_DT.
ELSEIF VEN_SM = C_X.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_VEN_SM.
ELSEIF VEN_DT = C_X.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_VEN_DT.
ENDIF.
TOP-OF-PAGE DURING LINE-SELECTION.
CASE V_UCOMM.
WHEN 'DETLS'.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_PUR_DB.
WHEN 'MSUMRY'.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_MAT_SM.
WHEN 'MDETL'.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_MAT_DT.
WHEN 'VSUMRY'.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_VEN_SM.
WHEN 'VDETL'.
PERFORM TOP_OF_PAGE.
PERFORM TOP_OF_PAGE_VEN_DT.
ENDCASE.
*& Form WRITE_DATA
text *
FORM WRITE_DATA.
DATA: V_SALES LIKE ITAB_DISPLAY-SALES,
V_RATE LIKE ITAB_DISPLAY-RATE,
V_DISCOUNT LIKE ITAB_DISPLAY-DISCOUNT,
V_PROD-AMT LIKE ITAB_DISPLAY-PROD-AMT,
V_EXCISE1 LIKE ITAB_DISPLAY-EXCISE,
V_EXCISE LIKE ITAB_DISPLAY-EXCISE,
V_PON LIKE ITAB_DISPLAY-PON,
V_OTHERS LIKE ITAB_DISPLAY-OTHERS,
V_FREIGHT LIKE ITAB_DISPLAY-FREIGHT.
CLEAR ITAB .
Write the correct data i.e. tax code and G/L code both available .
LOOP AT ITAB .
*************CH-ID-ADI-30 / 09 / 1999
IF ( ITAB-MWSKZ = '9W' OR ITAB-MWSKZ = 'K9' OR ITAB-MWSKZ = 'X9' )
AND ITAB-OTHR_CHRG NE 0 .
ITAB-DMBTR = ITAB-OTHR_CHRG.
ITAB-OTHR_CHRG = 0.
MODIFY ITAB.
ENDIF.
ENDLOOP.
LOOP AT ITAB.
I_LFA1-LIFNR = ITAB-LIFNR.
APPEND I_LFA1.
CLEAR I_LFA1.
ENDLOOP.
SORT I_LFA1.
DELETE ADJACENT DUPLICATES FROM I_LFA1 COMPARING ALL FIELDS.
SELECT LIFNR
NAME1
FROM LFA1 INTO TABLE I_VENDOR
FOR ALL ENTRIES IN I_LFA1 WHERE
LIFNR = I_LFA1-LIFNR.
FREE I_LFA1.
LOOP AT ITAB.
READ TABLE I_VENDOR WITH KEY LIFNR = ITAB-LIFNR .
IF SY-SUBRC EQ 0.
ITAB-NAME1_VENDOR = I_VENDOR-NAME1.
MODIFY ITAB TRANSPORTING NAME1_VENDOR.
ENDIF.
ENDLOOP.
LOOP AT ITAB.
IF NOT ITAB-LIFNR IN S_VENDOR.
DELETE ITAB.
ENDIF.
ENDLOOP.
SELECT BUKRS BELNR GJAHR BUZEI BUZID SHKZG EBELN EBELP ERFMG WRBTR
MATNR HKONT SGTXT " ERFMG for MENGE,HKONT,SGTXT Added by KrishnaMohan
INTO TABLE ITAB_FINAL
FROM BSEG FOR ALL ENTRIES IN ITAB
WHERE BUKRS = T_BUKRS AND "'1000' AND
BELNR = ITAB-BELNR AND
*added by srinivas
hkont in zgl and
*end
GJAHR = T_GJAHR AND
*- Start of change by Raj on 030905
buzid IN ('W', 'M', 'K', 'S', 'F' , 'P' ) AND
BUZID IN ('W', 'M', 'K', 'S', 'F' , 'P' , 'T', ' ') AND
" ADD T 090206 JAJ
KOART <> 'K' AND " mod by vik on 21.08.2008" sjaj si
*- End of change by Raj on 030905
BUZID = P Added on 21/01/02 by Krishna Mohan
GSBER IN P_GSBER AND
gsber IN p_gsber OR gsber = ' ' AND
MATNR IN S_MATNR.
SELECT BELNR BLART INTO TABLE ITAB_DOC FROM BKPF
FOR ALL ENTRIES IN ITAB_FINAL WHERE
BUKRS = T_BUKRS AND "'1000' AND
BELNR = ITAB_FINAL-BELNR AND
GJAHR = T_GJAHR AND
BLART NOT IN ('WA' , 'WE').
SORT ITAB_DOC BY BELNR BLART.
LOOP AT ITAB_DOC.
IF NOT ITAB_DOC-BLART IN S_DOCTYP .
DELETE ITAB_DOC.
ENDIF.
ENDLOOP.
LOOP AT ITAB_FINAL.
READ TABLE ITAB_DOC WITH KEY BELNR = ITAB_FINAL-BELNR BINARY SEARCH.
IF SY-SUBRC NE 0.
DELETE ITAB_FINAL.
ENDIF.
ENDLOOP.
DELETE ITAB_FINAL WHERE BUZID = 'K' AND BUZEI = '1'.
LOOP AT ITAB_FINAL WHERE SHKZG = 'H'.
ITAB_FINAL-WRBTR = ITAB_FINAL-WRBTR * ( -1 ).
MODIFY ITAB_FINAL TRANSPORTING WRBTR.
ENDLOOP.
LOOP AT ITAB_FINAL WHERE BUZID = 'M'.
IF ITAB_FINAL-SGTXT NE ' '.
TRANSLATE ITAB_FINAL-SGTXT TO UPPER CASE.
MODIFY ITAB_FINAL.
ENDIF.
ENDLOOP.
LOOP AT ITAB_FINAL .
IF ITAB_FINAL-BUZID = 'W'.
CLEAR V_MATNR.
V_EBELN = ITAB_FINAL-EBELN.
V_MATNR = ITAB_FINAL-MATNR.
ITAB_PO_ITEM-BELNR = ITAB_FINAL-BELNR.
ITAB_PO_ITEM-BUZID = ITAB_FINAL-BUZID.
ITAB_PO_ITEM-MATNR = ITAB_FINAL-MATNR.
ITAB_PO_ITEM-EBELN = ITAB_FINAL-EBELN.
ITAB_PO_ITEM-EBELP = ITAB_FINAL-EBELP.
ITAB_PO_ITEM-MENGE = ITAB_FINAL-MENGE.
ITAB_PO_ITEM-WRBTR = ITAB_FINAL-WRBTR.
COLLECT ITAB_PO_ITEM.
CLEAR ITAB_PO_ITEM.
ELSEIF ITAB_FINAL-BUZID = 'M' OR ITAB_FINAL-BUZID = 'K' OR
ITAB_FINAL-BUZID = 'S' OR
ITAB_FINAL-BUZID = 'P' OR " ADDED ON 21/01/02
*- Start of change by Raj on 030905
ITAB_FINAL-BUZID = ' ' OR
ITAB_FINAL-BUZID = 'T' OR " ADD BY JAJ ON 090206
*- End of change by Raj on 030905
ITAB_FINAL-BUZID = 'F'.
IF ITAB_FINAL-MATNR IS INITIAL.
ITAB_FINAL-MATNR = V_MATNR.
ENDIF.
CLEAR V_MATNR.
ITAB_PO_OTHERS-BELNR = ITAB_FINAL-BELNR.
ITAB_PO_OTHERS-MATNR = ITAB_FINAL-MATNR.
ITAB_PO_OTHERS-EBELN = ITAB_FINAL-EBELN.
ITAB_PO_OTHERS-EBELP = ITAB_FINAL-EBELP.
ITAB_PO_OTHERS-MENGE = ITAB_FINAL-MENGE.
ITAB_PO_OTHERS-WRBTR = ITAB_FINAL-WRBTR.
IF CONDITION,ADDED ON 21/01/02 FOR GETTING EXCISE WHEN CONDITION MEETS
ie TOTAL AMOUNT = EXCISE WHEN BUZID = S AND HKONT = 27500
*IF itab_final-buzid = 'S' AND ( itab_final-hkont = '0000027500' OR "
*COMM BY JAJ ON 090206
IF ITAB_FINAL-BUZID = 'S' OR ITAB_FINAL-BUZID = 'T' AND (
ITAB_FINAL-HKONT = '0000027500' OR
ITAB_FINAL-HKONT = '0000027515'
OR ITAB_FINAL-HKONT = '0000027550' " jaj on 090206
OR ITAB_FINAL-HKONT = '0000027507' OR
ITAB_FINAL-HKONT = '0000027508'). "Added on 050905 - Raj
ITAB_FINAL-EBELN = V_EBELN.
to get ebeln value into header so that when there are 2 po's
and 2 W's excise can go into only one po which is v_ebeln
Start of insert by B.Elan on 10/02/2006
READ TABLE ITAB_PO_ITEM WITH KEY BELNR = ITAB_FINAL-BELNR
EBELN = ITAB_FINAL-EBELN
MATNR = ITAB_FINAL-MATNR.
ITAB_PO_ITEM-EXCISE = ITAB_PO_ITEM-EXCISE + ITAB_FINAL-WRBTR.
End of insert by B.Elan on 10/02/2006
Start of delete by B.Elan on 10/02/2006
itab_po_item-excise = itab_final-wrbtr.
End of delete by B.Elan on 10/02/2006
MODIFY ITAB_PO_ITEM TRANSPORTING EXCISE
WHERE BELNR EQ ITAB_FINAL-BELNR AND
EBELN EQ ITAB_FINAL-EBELN.
CLEAR ITAB_PO_ITEM.
ELSE.
COLLECT ITAB_PO_OTHERS.
ENDIF.
CLEAR ITAB_PO_OTHERS.
ENDIF.
ENDLOOP.
sateesh
SORT ITAB_PO_ITEM BY BELNR EBELN.
LOOP AT ITAB_PO_ITEM.
AT NEW BELNR.
AT NEW EBELN.
READ TABLE ITAB_PO_ITEM INDEX SY-TABIX.
ITAB_PO_ITEM-FLAG = 'X'.
MODIFY ITAB_PO_ITEM INDEX SY-TABIX.
ENDAT.
ENDAT.
ENDLOOP.
LOOP AT ITAB_PO_ITEM.
ITAB_PO_ITEM-EXCISE = 0.
MODIFY ITAB_PO_ITEM TRANSPORTING EXCISE
WHERE EXCISE > 0
AND FLAG = SPACE.
ENDLOOP.
end
LOOP AT ITAB_PO_ITEM.
ITAB_PO-EBELN = ITAB_PO_ITEM-EBELN.
ITAB_PO-EBELP = ITAB_PO_ITEM-EBELP.
APPEND ITAB_PO.
CLEAR ITAB_PO.
ENDLOOP.
LOOP AT ITAB_PO_OTHERS.
ITAB_PO-EBELN = ITAB_PO_OTHERS-EBELN.
ITAB_PO-EBELP = ITAB_PO_OTHERS-EBELP.
APPEND ITAB_PO.
CLEAR ITAB_PO.
ENDLOOP.
SORT ITAB_PO.
DELETE ADJACENT DUPLICATES FROM ITAB_PO COMPARING ALL FIELDS.
SELECT EKPO~EBELN
EBELP
MENGE
BRTWR
KZWI5
EKKO~KNUMV
EKPO~MATNR
EKPO~TXZ01
INTO TABLE ITAB_RATE_MODVAT
FROM EKPO INNER JOIN EKKO
ON EKPO~EBELN = EKKO~EBELN
FOR ALL ENTRIES IN ITAB_PO WHERE
EKPO~EBELN = ITAB_PO-EBELN AND
EBELP = ITAB_PO-EBELP.
SELECT KNUMV KPOSN STUNR ZAEHK KSCHL KWERT
INTO TABLE ITAB_KONV
FROM KONV
FOR ALL ENTRIES IN ITAB_RATE_MODVAT
WHERE KNUMV = ITAB_RATE_MODVAT-KNUMV AND
KSCHL IN ('YT02', 'YF07', 'YOTH', 'YPF1', 'YD01', 'YD02', 'YD03' ) .
SORT ITAB_KONV BY KNUMV KSCHL.
SORT ITAB BY BELNR.
SORT ITAB_RATE_MODVAT BY EBELN EBELP.
SORT ITAB_PO_OTHERS BY BELNR MATNR.
LOOP AT ITAB_PO_ITEM.
ITAB_DISPLAY-BELNR = ITAB_PO_ITEM-BELNR.
READ TABLE ITAB_DOC WITH KEY BELNR = ITAB_PO_ITEM-BELNR BINARY
SEARCH.
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-BLART = ITAB_DOC-BLART.
ENDIF.
READ TABLE ITAB WITH KEY BELNR = ITAB_PO_ITEM-BELNR BINARY SEARCH.
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-XBLNR = ITAB-XBLNR.
ITAB_PO_ITEM-XBLNR = ITAB-XBLNR.
ITAB_DISPLAY-NAME1_VENDOR = ITAB-NAME1_VENDOR.
ITAB_DISPLAY-HKONT = ITAB-HKONT.
ITAB_DISPLAY-MWSKZ = ITAB-MWSKZ.
ITAB_DISPLAY-BUDAT = ITAB-BUDAT.
ITAB_DISPLAY-DUE_DATE = ITAB-DUE_DATE.
ITAB_DISPLAY-PON = ITAB_PO_ITEM-EBELN.
ENDIF.
ITAB_DISPLAY-QTY = ITAB_PO_ITEM-MENGE.
READ TABLE ITAB_RATE_MODVAT WITH KEY EBELN = ITAB_PO_ITEM-EBELN
EBELP = ITAB_PO_ITEM-EBELP
BINARY SEARCH.
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-PON = ITAB_PO_ITEM-EBELN.
ITAB_DISPLAY-MATNR = ITAB_RATE_MODVAT-MATNR.
ITAB_DISPLAY-MAKTX = ITAB_RATE_MODVAT-TXZ01.
ITAB_DISPLAY-RATE = ITAB_RATE_MODVAT-BRTWR /
ITAB_RATE_MODVAT-MENGE.
ITAB_DISPLAY-PROD-AMT = ITAB_DISPLAY-RATE * ITAB_PO_ITEM-MENGE.
IF ITAB_PO_ITEM-EXCISE NE 0.
ITAB_DISPLAY-EXCISE = ITAB_PO_ITEM-EXCISE.
ELSE.
*ITAB_DISPLAY-EXCISE = ( ITAB_PO_ITEM-MENGE * ITAB_RATE_MODVAT-KZWI5 ) /
ITAB_RATE_MODVAT-MENGE.
*commentedon 210102 to get excise directly from BSEG - IV
ENDIF.
ENDIF.
READ TABLE ITAB_KONV WITH KEY KNUMV = ITAB_RATE_MODVAT-KNUMV
KPOSN = ITAB_RATE_MODVAT-EBELP
KSCHL = 'YT02' .
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-SALES = ( ITAB_PO_ITEM-MENGE * ITAB_KONV-KWERT ) /
ITAB_RATE_MODVAT-MENGE.
READ TABLE ITAB_FINAL WITH KEY BELNR = ITAB_PO_ITEM-BELNR
BUZID = 'M'
SGTXT(9) = 'SALES TAX'.
IF SY-SUBRC EQ 0.
IF ITAB_FINAL-SGTXT(9) EQ 'SALES TAX'
OR ITAB_FINAL-SGTXT(9) EQ 'sales tax'.
ITAB_DISPLAY-SALES = ITAB_DISPLAY-SALES + ITAB_FINAL-WRBTR.
ENDIF.
ENDIF.
ENDIF.
READ TABLE ITAB_KONV WITH KEY KNUMV = ITAB_RATE_MODVAT-KNUMV
KPOSN = ITAB_RATE_MODVAT-EBELP
KSCHL = 'YF07'.
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-FREIGHT = ( ITAB_PO_ITEM-MENGE * ITAB_KONV-KWERT ) /
ITAB_RATE_MODVAT-MENGE.
ENDIF.
READ TABLE ITAB_KONV WITH KEY KNUMV = ITAB_RATE_MODVAT-KNUMV
KPOSN = ITAB_RATE_MODVAT-EBELP
KSCHL = 'YD01' .
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-DISCOUNT = ( ITAB_PO_ITEM-MENGE * ITAB_KONV-KWERT ) /
ITAB_RATE_MODVAT-MENGE.
ELSE.
READ TABLE ITAB_KONV WITH KEY KNUMV = ITAB_RATE_MODVAT-KNUMV
KPOSN = ITAB_RATE_MODVAT-EBELP
KSCHL = 'YD02' .
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-DISCOUNT = ( ITAB_PO_ITEM-MENGE * ITAB_KONV-KWERT )
ITAB_RATE_MODVAT-MENGE.
ELSE.
READ TABLE ITAB_KONV WITH KEY KNUMV = ITAB_RATE_MODVAT-KNUMV
KPOSN = ITAB_RATE_MODVAT-EBELP
KSCHL = 'YD03' .
IF SY-SUBRC EQ 0.
ITAB_DISPLAY-DISCOUNT = ( ITAB_PO_ITEM-MENGE * ITAB_KONV-KWERT
ITAB_RATE_MODVAT-MENGE.
ENDIF.
ENDIF.
ENDIF.
LOOP AT ITAB_KONV WHERE KNUMV = ITAB_RATE_MODVAT-KNUMV AND KPOSN =
ITAB_RATE_MODVAT-EBELP AND
( KSCHL = 'YPF1' OR KSCHL = 'YOTH' ) .
ITAB_KONV-KWERT = ( ITAB_PO_ITEM-MENGE * ITAB_KONV-KWERT ) /
ITAB_RATE_MODVAT-MENGE.
ITAB_DISPLAY-OTHERS = ITAB_DISPLAY-OTHERS + ITAB_KONV-KWERT.
ENDLOOP.
READ TABLE ITAB_PO_OTHERS WITH KEY BELNR = ITAB_PO_ITEM-BELNR.
EBELN = ITAB_PO_ITEM-EBELN.
BINARY SEARCH.
sateesh as on 10092003
IF SY-SUBRC NE 0. CLEAR ITAB_PO_OTHERS. ENDIF.
end
IF NOT ITAB_PO_OTHERS-EBELN IS INITIAL.
READ TABLE ITAB_PO_OTHERS WITH KEY EBELN = ITAB_PO_ITEM-EBELN
EB -
How to use IT_special_groups in ALV Grid ?
Hi Abapers,
Am new to ALv's
am passing almost all parameters to ALV_GRID FM..!
i dont no how to use of options Groups , Filters and I_sel_hide .
event i find an Demo example related to Groups ..
but while displaying the out put i didnt find any Changes ?
could any one give an Example with using GROUPS , Filters and SEL_INFO ?
Pls help me out to resolve this problem ..!
Thanks & Regrds
RajeshkHi,
you can group your ALV columns into various groups using field SP_GROUP in field catalog. You assign name to these groups in the table IT_SPECIAL_GROUPS. User can restrict column selection to one of these groups (using name from the table) on the current layout window. More info can be found in [SAP documentation|http://help.sap.com/saphelp_nw04/helpdata/en/a2/64f7a2ee4f11d2b484006094192fe3/frameset.htm]
Probably as you know you can filter selected records in ALV (icon with funnel). You can use table IT_FILTER to set up this filter.
I am not sure about I_SEL_HIDE but as far as I remember ALV can display selection criteria from report which call ALV FM. So I assume that you can use this table to control displaying of them.
BTW there is a really nice [reference for ALV|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907?overridelayout=true].
Cheers -
How can I disenable the EXCEL field format when use ALV download to excel ?
Dear friends,
I have a problem with the ALV download to EXCEL. One field Value in ALV is like u2018-abcdeu2026u2019.the character u201C-u201Cis the first position in field value.when I download the value to EXCEL,the field value u2018-abcdeu2026u2019 changed u2018=-abcdeu2026u2019 in EXCEL.how can I remove u2018=u2019 in EXCEL when I down to excel used ALV.
I add a space in u2018 -abcdeu2026u2019,So this value can be download to Excel .
Have you any solve method?
User does not use excel logo button to download.
User use Local fileu2026 button to download
Thanks
Sunadd a single quote to the beginning of the field.
like: '-abcde
in excel it will be shown as : -abcde -
How to use intractive list in Alv REPORT
how to use intractive list in Alv REPORT with example.
thangs
venki.......Hi
using the USER_COMMAND we can move to the Secondary(interactive) list in the ALV
see the sample code
report yh645_secndry_alv.
type-pools: slis.
data: fieldcat type slis_t_fieldcat_alv,
fieldcat_ln like line of fieldcat,
fs_layout type slis_layout_alv,
t_layoout like standard table
of fs_layout.
data: begin of fs_spfli,
carrid type spfli-carrid,
connid type spfli-connid,
countryfr type spfli-countryfr,
cityfrom type spfli-cityfrom,
airpfrom type spfli-airpfrom,
countryto type spfli-countryto,
cityto type spfli-cityto,
airpto type spfli-airpto,
fltime type spfli-fltime,
deptime type spfli-deptime,
arrtime type spfli-arrtime,
distance type spfli-distance,
distid type spfli-distid,
fltype type spfli-fltype,
period type spfli-period,
checkbox,
color(3),
end of fs_spfli.
data:
begin of fs_table,
carrid type spfli-carrid,
connid type spfli-connid,
end of fs_table.
data: begin of fs_sflight,
check,
color(3).
include type sflight.
data:end of fs_sflight.
data:
begin of fs_table1,
carrid type sflight-carrid,
connid type sflight-connid,
fldate type sflight-fldate,
end of fs_table1.
data:
t_spfli like standard table
of fs_spfli.
data:
t_table like standard table
of fs_table.
data:
t_table1 like standard table
of fs_table1.
data:
t_sflight like standard table
of fs_sflight.
data:
t_sbook like standard table
of sbook.
data t_layout type slis_layout_alv.
select *
into corresponding fields of table t_spfli
from spfli.
perform start_list_viewer.
perform get_spfli_details.
*& Form SUB1
text
-->RT_EXTAB text
form sub1 using rt_extab type slis_t_extab.
data: flight type slis_extab.
flight-fcode = 'SFLIGHT'.
append flight to rt_extab.
set pf-status 'SFLIGHT'. " EXCLUDING RT_EXTAB.
endform. "SUB1
*& Form START_LIST_VIEWER
text
--> p1 text
<-- p2 text
form start_list_viewer .
data: pgm like sy-repid.
pgm = sy-repid.
fs_layout-box_fieldname = 'CHECKBOX'.
fs_layout-info_fieldname = 'COLOR'.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = pgm
i_callback_pf_status_set = 'SUB1'
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'SPFLI'
is_layout = fs_layout
tables
t_outtab = t_spfli
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.
endform. " START_LIST_VIEWER
*******Process Call Back Events (Begin)**************************
form user_command using ucomm like sy-ucomm
selfield type slis_selfield.
case ucomm.
when 'SFLIGHT'.
selfield-refresh = 'X'.
perform get_spfli_details.
select *
from sflight
into corresponding fields of table t_sflight
for all entries in t_table
where carrid eq t_table-carrid
and connid eq t_table-connid.
perform display_sflight.
when 'SBOOK'.
selfield-refresh = 'X'.
perform get_sflight_details.
select *
from sbook
into corresponding fields of table t_sbook
for all entries in t_table1
where carrid eq t_table1-carrid
and connid eq t_table1-connid
and fldate eq t_table1-fldate.
perform display_sbook.
endcase.
endform. "USER_COMMAND
*& Form SUB2
text
-->RT_EXTAB text
form sub2 using rt_extab type slis_t_extab.
data: flight type slis_extab.
flight-fcode = 'SBOOK'.
append flight to rt_extab.
set pf-status 'SBOOK'. " EXCLUDING RT_EXTAB.
endform. "SUB2
*& Form DISPLAY_SFLIGHT
text
--> p1 text
<-- p2 text
form display_sflight .
data: pgm like sy-repid.
pgm = sy-repid.
clear t_layout.
fs_layout-box_fieldname = 'CHECK'.
fs_layout-info_fieldname = 'COLOR'.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = pgm
i_callback_pf_status_set = 'SUB2'
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'SFLIGHT'
is_layout = fs_layout
tables
t_outtab = t_sflight
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.
endform. " DISPLAY_SFLIGHT
*& Form GET_SPFLI_DETAILS
text
--> p1 text
<-- p2 text
form get_spfli_details .
loop at t_spfli into fs_spfli.
if fs_spfli-checkbox = 'X'.
fs_spfli-color = 'C51'.
fs_spfli-checkbox = '1'.
fs_table-carrid = fs_spfli-carrid.
fs_table-connid = fs_spfli-connid.
append fs_table to t_table.
modify t_spfli from fs_spfli.
endif.
endloop.
endform. " GET_SFLIGHT_DETAILS
*& Form GET_SFLIGHT_DETAILS
text
--> p1 text
<-- p2 text
form get_sflight_details .
loop at t_sflight into fs_sflight.
if fs_sflight-check = 'X'.
fs_sflight-color = 'C71'.
fs_sflight-check = '1'.
fs_table1-carrid = fs_sflight-carrid.
fs_table1-connid = fs_sflight-connid.
fs_table1-fldate = fs_sflight-fldate.
append fs_table1 to t_table1.
modify t_sflight from fs_sflight.
endif.
endloop.
endform. " GET_SFLIGHT_DETAILS
*& Form DISPLAY_SBOOK
text
--> p1 text
<-- p2 text
form display_sbook .
data: pgm like sy-repid.
pgm = sy-repid.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = pgm
i_structure_name = 'SBOOK'
tables
t_outtab = t_sbook
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.
endform. " DISPLAY_SBOOK
Reward points for useful Answers
Regards
Anji -
How to use Standard Text in ALV
How to use Standard Text in ALV header part? Can you please help me by giving the answer?
Hi ,
You can read the Standard text using read_text function module and then print in LV header part. -
How to assign ALV for parent node and child node that uses supply method.?
HI Dear friends,
I need to display header details ( VBAK ) and Item details ( VBAP ). I have created two node like HEADER_NODE inside this i have created ITEM_NODE for this item node i use supply function 'GET_ITEMS' any way it is working only when crete two separate table and binding but when i come to work with ALV i am totally confused .. i have created two 'View Controller UI Elements' when i try to map HEADER_NODE it mapped properly but for ITEM_NODE it shows mapping already defined. return status message as 'Action Cancelled' . In result both ViewContainer shows only HEADER_NODE data only.
How to achive ALV for Parent, child node that uses supply function ? ?
Thank youDelete Mapping is not enabled, that means there is no mapping done yet.
I just tried what you are saying and the application works and i am able to map the header table and item table and also again i could map the tables any number of times.. i didn't get any such message, sorry i couldn't recreate the scenario. might be there is something wrong in the context.
i just did it like this.
Please also move this to Web DynPro Discussion, Hope that would be helpful.
Message was edited by: Syed Ghulam Ali
Maybe you are looking for
-
Alternative scrollpane to load dynamic content
I'm trying to load jpgs to my scrollpane dynamically. I noticed the compiled scrollpane component in flash 8 is very large in size (> 130kb) which i cannot afford to use. Instead I'm using the flash 6 scrollpane which is not precompiled and only seve
-
Problems when tyring to continue install: Errors with grant.sql
Going through the install procedure for PeopleTools 8.50 with PeopleSoft HRMS 9.1. Running Windows XP Pro SP3. Install on single machine for testing purposes. I ran scripts in Data Mover to populate the PeopleSoft database tables. I did this through
-
Modular JavaHelp? Can the Merge function cope with non-existent help sets?
We are writing a universal application which is intended eventually to manage perhaps 20 different pieces of our equipment. There will be a skeleton/umbrella application that is always present, and each customer will receive plug-in modules for the p
-
The colors in QuickTime are way off for me. If I create an image in PhotoShop of pure white (255, 255, 255), when I open that in Quicktime it will display as 235, 207, 207. It doesn't matter if I embed a color profile in the image or not, QuickTime w
-
Can't see control panel as it is grayed out with little squares and lines
printer is on and was working put in new cartridges and all I have is an excalamation point blinking and contorl panle light is on but can read anything as it just has little boxess and lines running up and down on the control panel.