ALV Grid to be run in background & to generate output file in Excel format
I use REUSE_ALV_GRID_DISPLAY in my program for the ALV output
My Requirement is Program to be run in a background since it is getting timed out when executed in foreground and also to generate the output file in Excel format. And we are using 4.6 C version.
how do i attain this?
Hello,
One alternate solution can be :
Execute your report in background and then send the data to Spool .
From this spool , you can download the data in excel file.
SUBMIT xyz TO SAP-SPOOL
SPOOL PARAMETERS gt_print_parameters.
Regards,
Sandeep
Similar Messages
-
ALV grid on pop-up in background mode
I have a report calling FM 'MESSAGES_SHOW' , which displays the messages in a pop-up in ALV grid format.
Now, when I run the report in background, the error messages are not shown.
Is there anyway to get around it ?Try with import parameter
BATCH_LIST_TYPE = 'L'.
a® -
Wrapper program when run in background not generating SPOOL
I have created Program A which calls internally Program B or C based on the condition. When I run the program B or C independently in Background it generates the spool on completion. But When I run the program A in Background, Spool is not getting generated.
My requirement is that Spool should be generated when Program A is executed in Background.
Below is the code of program A:
PROGRAM A.
IF p_cons = 'X'.
*-->Detailed Details of Interim or Final Settlement
SUBMIT B WITH p_vtnr EQ p_vtnr
WITH p_setqty EQ p_setqty
WITH p_test EQ p_test
WITH s_abrdat IN s_abrdat
WITH r2 EQ r2
WITH r1 EQ r1
AND RETURN.
ELSE.
*-->Summary Details of Interim or Final Settlement
SUBMIT C WITH p_vtnr EQ p_vtnr
WITH p_setqty EQ p_setqty
WITH p_test EQ p_test
WITH s_abrdat IN s_abrdat
WITH r2 EQ r2
WITH r1 EQ r1
AND RETURN.
ENDIF.
Please guide me on this.
Regards,
NaveenHi Naveen,
Check this
Submit report to job
submit ztest via job l_jobname
number l_jobcount
to sap-spool without spool dynpro
spool parameters ls_params
and return. -
ALV GRID - to include user defined buttons in the output
Hi,
Currently I am working on ALV grid output.
Along with the standard buttons, I need to include my own push buttons.
When I try to include it using pf-status like this,
passing parameter in alv
I_callback_pf_status_set = G_status
FORM STANDARD_02 USING EXTAB USING SLIS_T_EXTAB
set pf-status 'PF_STATUS' EXCLUDING EXTAB.
ENDFORM
I have included Confirm and exit buttons
In the output it shows only the button which I created .
I want to get both standard buttons which gets displayed when using REUSE_ALV_GRID_DISPLAY and the newly created one .
Plz help me to resolve this .
I am just passing my own internal table values to the grid .
Thanks in advance.
Regards,
Umahi
good
create ur own GUI status in ur program using SET PF-STATUS '--'. now give that program name and pf status name while u r copying that standard status ie.,of ALV grid Go to transaction SE41 (Menu painter). In the initial screen give the program name SAPLKKBL In the status give STANDARD Then go to the menu bar.in that follow this menu User Interface>Copy--->Status. Then a pop up will appear to give ur program name and the status name.
thanks
mrutyun^ -
ALV Grid not displying properly when spool is generated by print button
Hi All,
When print button is used to genarate spool of the ALV Grid, then in the spool the end of page content is getting over lapped on the main lines. Please let me know how to display end of page content without geting overlapped on the lines.
Below is the code which I have written.
<cut>
Edit: Please see next post.
Thanks in Advance!
Regards,
Preethi G
Edited by: Julius Bussche on Feb 14, 2010 9:15 AMHi All,
Sorry. Please ignore my first post. When print button is used to generate spool then in the spool file the end of page content is getting overlapped on the main lines. Please let me know to solve this.
Thanks in Advance!
Below is the code written
ALV Grid display
alv_layout-colwidth_optimize = 'X'.
alv_layout-zebra = 'X'.
wa_print_info-no_print_listinfos = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_grid_title = ''
i_callback_pf_status_set = 'FRM_SET_STATUS'
i_callback_user_command = 'FRM_USER_COMMAND'
is_layout = alv_layout
it_events = i_events
it_fieldcat = alv_fieldcat
is_print = wa_print_info
TABLES
t_outtab = it_payroll
EXCEPTIONS
program_error = 1
OTHERS = 2.
End of Page and End of list
IF sy-pagno = 0.
s_pageno = 1.
ELSE.
s_pageno = sy-pagno.
ENDIF.
CLEAR: i_list_comments[].
SKIP.
SKIP.
CONCATENATE 'u85AAu8D44u4E13u5458' '________' 'HRSu7ECFu7406' '________' 'u4EBAu529Bu8D44u6E90u603Bu76D1'
'________' 'u7EE9u6548u8D22u52A1u603Bu76D1' '________' 'u603Bu7ECFu7406' '________'''INTO s_out
SEPARATED BY space.
NEW-LINE.
WRITE AT (sy-linsz) s_out CENTERED.
SKIP.
CONCATENATE s_pageno '-' v_pagsum 'u9875' INTO
w_list_comments-info SEPARATED BY space.
NEW-LINE.
WRITE AT (sy-linsz) w_list_comments-info CENTERED.
Edited by: Julius Bussche on Feb 14, 2010 9:16 AM
Tried to fix formatting a bit. -
Background Job spool / output file in different app server
We are working with 2 ECC app servers, A and B.
I've defined in app server A a background job to run an abap report and this report creates and submit 4 other background jobs.
Each of these 4 jobs is regarding an abap report which outputs a text file in the server.
The question is, why are the jobs generating the files in different app servers randomically?
The same file, in the 1st execution was generated in app server A, and without any change was generated in app server B, in the job 2nd execution?
Thank you!Hi,
You can specify server name whille creating a batch job , so that it gets executed to that server only.
there is one field (in SM36 during creation or SM37 while modifying batch job) called "Exec Target " , where you can specify server name.
Hence you can plan to run your some batch jobs on server A or B.
Regards,
Rupali -
Schedule report MM60 as background job and send out in Excel format
Hi there,
I would like to schedule a background job for report MM60, then send to the user in Excel format.
I know that we can enter the recipient in the job setting(SM36) but the report is send in HMTL format.
Is it possible to send in Excel format?
Thanks,
JaniceHi,
I think it's not possible from SM36 you better get help from ABAPer to get the require output.
Also visit below thread for same issue:
mail, output of spool as an excel attachment
Regards; -
ALV grid list giving run time error
hi
after lot of struggle , i over come by previous issue .
but now another is coming . i.e.
my ALV is displaying in GRID fine . But when i am selecting a column and doing SUMMATION (Icon) . it is giving runtime error.
same if i am clicking on PRINT PREVIEW of LIST
please guide me.my ALV is displaying in GRID fine . But when i am selecting a column and doing SUMMATION (Icon) . it is giving runtime error.
same if i am clicking on PRINT PREVIEW of LIST
from the above issue i can see that you populated the fieldcatalog wrong . some where you made the mistake.
fieldcat-fieldname = 'VBELN'. "this should be caps
fieldcat-tablename = 'IT_VBAK'. "provide the table also if you are not.
post your field catalog part, there we can see the mistake. -
Background Execution Problem-Docking Container with 2 ALV Grids in one scre
Hi Friends,
I have created 2 ALV Grids in one screen - one below another using DOCKING CONTAINER.
The objects are 'g_dock_cont' and 'g_dock_cont1'.
I am getting the foreground output as expected with 2 ALV Grids.
While executing in background (F9), I am getting only output of first ALV grid. Second ALV is not getting displayed in BACKGROUND(F9) mode.
How to solve this.
FORM create_objects.
* Materials with data
IF g_dock_cont IS INITIAL.
IF sy-batch NE 'X'.
*CREATE THE OBJECT FOR DOCKING CONTAINER
CREATE OBJECT g_dock_cont
EXPORTING
side = cl_gui_docking_container=>dock_at_top
extension = 300.
ENDIF.
*CREATE THE OBJECT FOR ALV GRID
CREATE OBJECT g_alvgrid
EXPORTING i_parent = g_dock_cont.
wa_layout-grid_title =
'Materials with Data'.
ENDIF.
IF NOT I_DETAIL[] IS INITIAL.
CALL METHOD g_alvgrid->set_table_for_first_display
EXPORTING
IS_VARIANT = WA_VARIANT_STX
IS_LAYOUT = wa_layout
CHANGING
it_outtab = I_DETAIL
IT_FIELDCATALOG = LIT_FIELDCATALOG[]
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
IF sy-subrc <> 0.
ENDIF.
ENDIF.
*MATERIALS WITHOUT DATA
IF g_dock_cont1 IS INITIAL.
IF sy-batch NE 'X'.
*CREATE THE OBJECT FOR DOCKING CONTAINER
CREATE OBJECT g_dock_cont1
EXPORTING
side = cl_gui_docking_container=>dock_at_bottom
extension = 300.
ENDIF.
*CREATE THE OBJECT FOR ALV GRID
CREATE OBJECT g_alvgrid1
EXPORTING i_parent = g_dock_cont1.
wa_layout1-grid_title =
'Materials without Data'.
ENDIF.
IF NOT I_MARA[] IS INITIAL.
CALL METHOD g_alvgrid1->set_table_for_first_display
EXPORTING
IS_LAYOUT = wa_layout1
CHANGING
it_outtab = I_MARA
IT_FIELDCATALOG = i_fieldcat[]
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
IF sy-subrc <> 0.
ENDIF.
ENDIF.
ENDFORM. " create_objects
Regards,
Viji.Hi,
What i was saying is that you need to code again for background mode of execution.
AT END OF SELECTION.
IF SY-BATCH EQ 'X'.
PERFORM DISPLAY1.
PERFORM DISPLAY2.
In DISPLAY1 use REUSE_ALV_LIST_DISPLAY to display data from outtab1.
In DISPLAY2 use REUSE_ALV_LIST_DISPLAY to display data from outtab2.
For example : execute this report in background mode.this will not execute in online mode.
After execution you will get two spools one for KNA1 and one for LFA1 data. Spool can be controlled via IS_PRINT structure.
report zrbackground.
data gt_lfa1 type standard table of lfa1.
data gt_kna1 type standard table of kna1.
start-of-selection.
select * from lfa1 into table gt_lfa1 up to 10 rows.
select * from kna1 into table gt_kna1 up to 20 rows.
end-of-selection.
if sy-batch eq 'X'.
perform display_lfa1.
perform display_kna1.
endif.
*& Form DISPLAY_LFA1
text
--> p1 text
<-- p2 text
form display_lfa1 .
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = sy-repid
i_structure_name = 'LFA1'
tables
t_outtab = gt_lfa1
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_LFA1
*& Form DISPLAY_KNA1
text
--> p1 text
<-- p2 text
form display_kna1 .
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = sy-repid
i_structure_name = 'KNA1'
tables
t_outtab = gt_kna1
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_KNA1
Please let me know if its not clear or you need more info.
Thanks,
Abhishek
Edited by: abhishek sinha on May 8, 2009 7:42 PM
Edited by: abhishek sinha on May 8, 2009 8:45 PM -
Hi friends, i got some problem in alv grid while i am running it in back ground.
my report contains some currency(amount) field in out put. when i am removing the amount field it is good result in back ground. but when it consist of amount field it is giving error. it indicating some string length problem. and error analysis as follows.
Error analysis
In statement
"STRLEN( obj )..."
the argument "obj" can only take a character-type data object.
In this case, the operand "obj" has the non-character type "P".
pls tell me can't we run amount field in back ground. if s how to solve my error. pls give me some ideas.
Kumar.Hi
Many a times there is a requirement to display ALV Grid (not ALV List) in the background Job. I have checked the SDN Forum for the same and it has been mentioned that ALV Grid cannot be displayed in Background, but the list output of ALV is possible. So user wont have the actual Grid interface but the List interface.
There is a workaround to display ALV Grid in Background Job. The only restriction is you cant schedule the job through SM36. You need to execute the transaction of the report program, fill in the selection screen data and hit Execute.
The job would be executed in background. User will be able to see the Job Log and Job Status after executing the program. User doesnt have to go to SM37 to view the job status/log. Once the Job Status is changed to COMPLETED, user can click on DISPLAY SPOOL to view the ALV Grid.
/people/prashant.patil12/blog/2007/02/20/displaying-alv-grid-in-background-job -
Job processing - Result ALV GRID
Hi folks!
I'm not very familiar with job processing. I'm having a report that displays an alv grid as a result of it. However it seems that the amount of registers to be read from the database now they are much, much more, so the users are getting the dump of time exceeded.
What I have in mind is to run this on background, but I know there are some limitations when running on background. My question here is that:
Is it possible to have an alv grid report to run as a Job, or I would have to replace the alv by simple report with Write statement?
Thanks for any help.
Regards,
Gilberto LiHi again.
My code is a little old so it's not Object Oriented or in ABAP/OO
So my code to call the ALV-GRID looks like:
Call ABAP/4 List Viewer
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_background_id = 'BUTTON_OFF_BACK'
is_layout = gs_layout
it_fieldcat = fieldcat
it_sort = lt_sort
it_events = gt_events[]
TABLES
t_outtab = itab_all.
Is there any way to do what Vij mentioned in non object oriented?
Thanks in advice.
Regards,
Gilberto Li -
Hi,
I am using ALV List and ALV grid in one of my custom reports.
There is no issue with ALV List when I print the report after running the program.
But when I use ALV Grid , the report runs good and when I try to print the report I get short dump "OBJECTS_NOT_CHARLIKE" in program "LKKBLF99" of the main program "SAPLKKBL".
I am using the function module "REUSE_ALV_GRID_DISPLAY" to run the report using ALV Grid and I get the above short dump when I try to print the report.
Can anyone help me please?
Thanks,
Ashok.Hai Ashok
Try with the following Code
*& Report ZALV_GRID *
REPORT ZALV_GRID .
TABLES: MARA.
TYPE-POOLS : SLIS.
Data declaration
DATA: BEGIN OF I_MARA OCCURS 0.
INCLUDE STRUCTURE MARA.
DATA: END OF I_MARA.
DATA: V_REPID LIKE SY-REPID.
selection-screen
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
PARAMETERS: P_MTART LIKE MARA-MTART DEFAULT 'ROH'.
SELECTION-SCREEN END OF BLOCK B1.
initialisation
INITIALIZATION.
S_MATNR-LOW = '1400'.
S_MATNR-HIGH = '1500'.
APPEND S_MATNR.
V_REPID = SY-REPID.
start-of-selection
START-OF-SELECTION.
SELECT * FROM MARA
INTO TABLE I_MARA
WHERE MATNR IN S_MATNR AND
MTART = P_MTART.
CHECK SY-SUBRC = 0.
end of selection
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'MARA'
IS_LAYOUT =
IT_FIELDCAT =
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = I_MARA
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.
Thanks & Regards
Sreenivasulu P -
Control Framework: Fatal error - GUI cannot be reached-ALV Grid in Bckgrnd
I have an ALV grid which dumps in the background. But works fine in the foreground.
I thought I am not using Control framework anywhere. But I get 'COntrol framework :Fatal error - GU cannot be reached' error.
I am using a docking container that I have split using a splitter.
I have no custom container in my screen. What else could be causing the Control framework error ? Any suggestions is appreciated. But please do not tell me to use 'REUSE_ALV*' or Classical reporting
Here are the PBO modules of my screen and here are my data declarations.
ALV Data declarations :
data :gt_sort type lvc_t_sort,
gr_event_handler TYPE REF TO lcl_event_handler ,
o_docking type ref to cl_gui_docking_container,"Docking Container
o_grid type ref to cl_gui_alv_grid,"Grid
o_split type ref to cl_gui_easy_splitter_container,"Splitter
o_top_container type ref to cl_gui_container, "Top Container
o_bottom_container type ref to cl_gui_container,"Bottom Container
o_document type ref to cl_dd_document. "Document
module status_0100 output.
if o_docking is initial.
set pf-status 'ZSTATUS_0100'.
set titlebar 'ZTITLE_0100'.
Creating Objects
perform create_objects.
Filling top of page
perform fill_top_of_page.
Filling the fieldcatalog table
perform build_fieldcat. "we already got'em
Displaying the output
perform display_output.
endif.
Here is the Form Create_objects called in the PBO.
form create_objects .
Creating Docking Container
CREATE OBJECT o_docking
EXPORTING
RATIO = '95'.
IF sy-subrc eq 0.
Splitting the Docking container
CREATE OBJECT o_split
EXPORTING
PARENT = o_docking
sash_position = 25 "Position of Splitter Bar (in Percent)
with_border = 0. "With Border = 1 Without Border = 0
Placing the containers in the splitter
o_top_container = o_split->top_left_container .
o_bottom_container = o_split->bottom_right_container .
Creating Grid
CREATE OBJECT o_grid
EXPORTING
i_parent = o_bottom_container.
Creating the document
CREATE OBJECT o_document
EXPORTING
style = 'ALV_GRID'.
CREATE OBJECT gr_event_handler .
ENDIF.
endform. " create_objects
form fill_top_of_page .
data : lv_char(255) type c.
Calling the methods for dynamic text
CALL METHOD o_document->add_gap
EXPORTING
width = 140.
CALL METHOD o_document->add_text
EXPORTING
text = 'Plant Attainment Report '
sap_fontsize = 'Large'
sap_color = cl_dd_area=>list_key_int
sap_emphasis = cl_dd_area=>strong. " For bold
Display the data
CALL METHOD o_document->display_document
EXPORTING
parent = o_top_container.
Calling the method of ALV to process top of page
CALL METHOD o_grid->list_processing_events
EXPORTING
i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = o_document.
endform. " fill_top_of_page
form display_output .
gx_variant-report = sy-repid.
gs_layout-zebra = 'X'.
gs_layout-sel_mode ='X'.
gs_layout-cwidth_opt = 'X'.
call method o_grid->set_table_for_first_display
exporting
is_variant = gx_variant
i_save = 'A'
is_layout = gs_layout
changing
it_fieldcatalog = it_fldcat
it_outtab = <gt_tabletotal>.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SET HANDLER gr_event_handler->handle_print_top_of_page FOR o_grid .
endform. " display_output
Edited by: Shareen Hegde on Jul 23, 2009 5:03 PM (I have no clue why
.. doesn't work anymore. My code looks messed up..Sorry folks!Nilesh,
If i put all these create objects inside the IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL. ENDIF , will I be still able to use ,
call method o_grid->set_table_for_first_display
exporting
is_variant = gx_variant
i_save = 'A'
is_layout = gs_layout
changing
it_fieldcatalog = it_fldcat
it_outtab = <gt_tabletotal>.
in background ? WIll I not get - OBJECTS_OBJREF_NOT_ASSIGNED erorr ?
How can I call the set_table_for_first_display without creating the object reference ?
Here is my creat object routine.
form create_objects .
* Creating Docking Container
IF CL_GUI_ALV_GRID=>OFFLINE( ) .
CREATE OBJECT o_docking
EXPORTING
RATIO = '95'.
IF sy-subrc eq 0.
* Splitting the Docking container
CREATE OBJECT o_split
EXPORTING
PARENT = o_docking
sash_position = 25 "Position of Splitter Bar (in Percent)
with_border = 0. "With Border = 1 Without Border = 0
* Placing the containers in the splitter
o_top_container = o_split->top_left_container .
o_bottom_container = o_split->bottom_right_container .
* Creating Grid
CREATE OBJECT o_grid
EXPORTING
i_parent = o_bottom_container.
* Creating the document
CREATE OBJECT o_document
EXPORTING
style = 'ALV_GRID'.
ENDIF.
CREATE OBJECT gr_event_handler .
endif.
endform. " create_objects -
ALV GRID Using oo abap example
Hi Friends,
I am new to oo abap, Can any one give me a basic example how i can create alv grid in oo abap.
regards,
DVNSHI,
Programming for ALV grid display using the classes involves creation of a screen and calling it for display.
Since there has to be a linking between the program and the screen we have created , this comes in the form of a container. We use two important classes during the programming for displaying ALV grid, CL_GUI_ALV_GRID and CL_GUI_CUSTOM_CONTAINER.
Steps To Use ALV Grid in a Program
1. Declare reference variables for,
Container (class CL_GUI_CUSTOM_CONTAINER) and
Grid (class CL_GUI_ALV_GRID)
Example
DATA: grid TYPE REF TO cl_gui_alv_grid,
custom_container TYPE REF TO cl_gui_custom_container
2. Create Standard Screen and a container on that screen and give a name to that container ( Use custom control button from tool bar) . This name will be used to link the container we have created on the screen with the object reference of class CL_GUI_CUSTOM_CONTAINER, which we have declared in the first step
3. Call the screen which has been created
4. Instantiate the container control and the ALV Grid Control in PBO of the screen.
Example
IF custom_container IS INITIAL.
CREATE OBJECT custom_container
EXPORTING
CONTAINER_NAME = MY_CONTAINER'.
CREATE OBJECT grid
EXPORTING
I_PARENT = custom_container.
ENDIF
5. For displaying the data, call the method set_table_for_first_display of object reference of CL_GUI_ALV_GRID.
Example
CALL METHOD grid->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT =
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB =
IT_FIELDCATALOG =
IT_SORT =
IT_FILTER =
EXCEPTION
INVALID_PARAMETER_COMBINATION =
PROGRAM_ERROR =
TOO_MANY_LINES =
others =
EXPLANATION OF SOME IMPORTANT PARAMETERS.
I_BYPASSING_BUFFER & I_BUFFER_ACTIVE :
When the program is run for the first time, the fields present in the output table and their positions are stored in a buffer. So the buffer is taken as reference for the successive executions. In order to bypass this buffer the above parameter values should be X and (space) respectively. If these values are not passed to the function module, the changes made in the structure of the internal table will not be reflected in the output.
I_STRUCTURE_NAME:
If the structure of your output table corresponds to a structure stored in the Data Dictionary (DDIC), the ALV Grid Control can use this information to generate the field catalog automatically. Pass the table structure as parameter. In this case, all fields of this DDIC structure are displayed in the list.
IS_VARIANT :
It allows the user to save and reuse the layout. It is a structure of type DISVARIANT and contain the display variant name. It facilitates pre-assignment for a layout, rather than displaying report and then choosing displaying variant.
I_SAVE:
This single character variable specifies whether the user specific display variants can be saved or not.
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
IS_LAYOUT:
This structure of type LVC_S_LAYO
is used to control the layout of the ALV. Two important fields are:
GRID TITLE. : Title of grid
ZEBRA : Alternate lines in list are displayed in different colors.
IT_FIELDCATALOG:
This internal table of type LVC_T_FCAT
is used to specify the position of various fields in the report itab.
There are three ways we can fill the field catalog table
1. Automatically through data dictionary structure (DDIC). In this case we pass the table structure to I_STRUCTURE_NAME.
2. Manually in ABAP program. Filling the internal table of type LVC_T_FCAT
1. . With each row corresponding to each column of output table. Each row of this table will hold value like
i). TABNAME & FIELDNAME specifies the reference fields for F1 help
ii). CTABNAME & CFIELDNAME specifies the reference fields for currency formatting
iii). QTABNAME & QFIELDNAME specifies the reference fields for quantity formatting
iv). SELTEXT_L holds the long description of the field
v). SELTEXT_M holds the medium description of the field
vi). SELTEXT_S holds the small description of the field
vii). KEY specifies the Key field ( cannot be hidden )
viii). OUTPUTLEN species the output length of the field
ix). DO_SUM specifies that subtotal is required on this field
x). NO_OUT specifies a hidden field
3. Semi-Automatically by combining the above 2 procedures.
Call function Module REUSE_ALV_FIELDCATALOG_MERGE and pass DDIC
structure or the output table to generate the field catalog.
Add additional Rows or modify existing properties of the fields to be displayed.
METHODS OF IMPLEMENTING SOME EXTRA FEATURES
Set focus to the grid
After CALL METHODgrid->set_table_for_first_display insert the following stament:
CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid
Refresh grid display
Use the grid method REFRESH_TABLE_DISPLAY
Example:
CALL METHOD grid->refresh_table_display.
Set the title of the grid
Fill the grid_title field of structure lvc_s_layo.
DATA:
gs_layout TYPE lvc_s_layo.
gs_layout-grid_title = 'TITLE'.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'structure name'
is_layout = gs_layout
CHANGING it_outtab = Output table.
The structure lvc_s_layo contains fields for setting graphical properties, displaying exceptions, calculating totals and enabling specific interaction options
Event Handling
We can handle the events triggered by
1. User defined Text Output
2. Mouse-controlled Actions
3. Self-defined and Standard Functions
Steps for Event Handling
1. Define a (local) class for event handling
2. Define a method for each event you need to handle
3. Implement your event handler methods.
4. Create Object of the above class
5. Link used events and event handler methods of the receiver object and the grid
object.
Example program : Handling Double Click Event
Step1.Define a class.
class lcl_my_event_receiver definition.
public section.
methods:
handle_double_click
for event double_click of cl_gui_alv_grid.
endclass.
Step 2. Implement the class
class lcl_my_event_receiver implementation.
method handle_double_click.
message i001(zz) with ' double click event - Triggerd '.
endmethod.
endclass.
Step 3. Declare and create Object for the local class defined and implemented in steps 1 and 2 respectively
o_receiver TYPE REF TO lcl_my_event_receiver (Declaration)
create object o_receiver. (Instantiation)
Step 4. Link the method for handling the event with the grid object in the PBO of screen after instantiating the grid object
set handler o_receiver->handle_double_click for grid.
EXAMPLE PROGRAM TO CHANGE A CLASSICAL REPORT OUTPUT TO A ALV GRID
This can be used as a template program to convert a classical report layout to a ALV grid.
Report<Report name>
Grid data Declarations----------------------------------------------*
INCLUDE ZVINALVD.
Internal table for ALV grid
TYPES: BEGIN OF T_ALV,
Field1 like table-field1,
Field2 like table-field2,
END OF T_ALV.
DATA: I_ALV TYPE TABLE OF T_ALV.
DATA: WA_ALV TYPE T_ALV.
-Class declarations----
INCLUDE ZVINALVE.
Add a checkbox in selection screen for ALV grid display. If it is unchecked
output will be of classical type.
SELECTION-SCREEN BEGIN OF BLOCK box01.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: COMMENT 4(30) To display repot output as a ALV grid.
PARAMETERS: p_alv AS CHECKBOX.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN END OF BLOCK box01.
START-OF-SELECTION.
Fill the ALV grid internal table
END-OF-SELECTION.
IF P_ALV = X.
PERFORM ALV_DISPLAY.
ELSE.
PERFORM CLASSICAL_DISPLAY.
ENDIF.
Alv Display
FORM ALV_DISPLAY.
CALL SCREEN 100.
ENDFORM.
Module STATUS_0100 OUTPUT
PBO for ALV Grid
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'GRID_DISPLAY'.
DATA:
For parameter IS_VARIANT that is used to set up options for storing
the grid layout as a variant in method set_table_for_first_display
l_layout TYPE disvariant.
GS_LAYOUT-SEL_MODE = 'B'.
Optimize column width
GS_LAYOUT-CWIDTH_OPT = 'X'.
Read data and create objects
IF go_custom_container IS INITIAL.
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 to report
To built fieldcatalog
PERFORM alv_build_fieldcatalog.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
is_variant = l_layout
i_save = 'A'
is_layout = gs_layout
CHANGING it_outtab = I_ALV
it_fieldcatalog = fieldcat.
Raise event toolbar to show the modified toolbar
CALL METHOD go_grid->set_toolbar_interactive.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
Form ALV_BUILD_FIELDCATALOG.
Store contents of selected line in a internal table
FORM alv_build_fieldcatalog.
CLEAR afield.
afield-fieldname = 'FIELD1'.
afield-tabname = 'I_ALV'.
afield-coltext = Field Name 1.
afield-lzero = ' '.
afield-key = 'X'.
afield-outputlen = XX.
APPEND afield TO fieldcat.
CLEAR afield.
afield-fieldname = 'FIELD2'.
afield-tabname = 'I_ALV'.
afield-coltext = Field Name 2.
APPEND afield TO fieldcat.
ENDFORM. " alv_build_fieldcatalog
Module USER_COMMAND_0100 INPUT
PAI for ALV Grid
MODULE USER_COMMAND_0100 INPUT.
CASE OK_100.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Form SELECT_LINE
Store contents of selected line in a internal table
FORM SELECT_LINE.
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.
LOOP AT gi_index_rows INTO g_selected_row.
IF sy-tabix = 1.
READ TABLE I_ALV INDEX g_selected_row-index INTO
WA_ALV.
ENDIF.
ENDLOOP.
ENDFORM. " SELECT_LINE
Includes:
1. ZVINALVD for data declarations
INCLUDE ZVINALVD .
Type pool for icons - used in the toolbar
TYPE-POOLS: icon.
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.
GLOBAL DATA FOR ALV GRID
DATA:
OK code for alv grid screen
OK_100(4) TYPE C,
ALV control: Layout structure
gs_layout TYPE lvc_s_layo,
Declare reference variables to the ALV grid and the container
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 for storing information about selected rows in the grid
Internal table
gi_index_rows TYPE lvc_t_row,
Information about 1 row
g_selected_row LIKE lvc_s_row.
fieldcatalog
DATA: fieldcat TYPE LVC_T_FCAT,
afield TYPE LVC_S_FCAT.
2. ZVINALVE for Class/object declarations
INCLUDE ZVINALVE.
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 'DISPLAY' TO ls_toolbar-function.
MOVE icon_DISPLAY TO ls_toolbar-icon.
MOVE 'Displaying customer' TO ls_toolbar-quickinfo.
MOVE 'Display' 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 'DISPLAY'.
PERFORM SELECT_LINE.
ENDCASE.
ENDMETHOD.
Reward if useful -
Problem with ALV Grid Not Displaying Data
Hi Gurus,
I have a report program, when i run it I display an output summary on ALV Grid, and when i click on each of the row in the output summary, I'm suppose to see the item detail of each record.
This item detail is showing for some record and is not showing for some other records (when i use different selections). I debugged it and observed that the table populating the ALV grid actually has records in it. The ALV grid is not just displaying the records.
I debugged the 2 examples (one showing record and the other not showing), I found out that nothing is different in the way they run till they populate the final internal record to passed to the ALV Grid.
Please any suggestions on this:
This is the function code for the ALV grid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_program_id
i_callback_pf_status_set = c_detail_status
i_callback_user_command = c_detail_user_comm
i_grid_title = lv_grid_title
is_layout = w_detail_layout
it_fieldcat = i_detail_fieldcat
it_sort = i_detail_sort
TABLES
t_outtab = i_faglflexa[] "NEM - detail
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e064
WITH sy-subrc.
Function REUSE_ALV_GRID_DISPLAY failed on detail view SY-SUBRC = &
ENDIF.This is the full code:
***INCLUDE ZFIGL_HYPERION_F01.
*& Form open_files
Open files used by the program.
FORM open_files.
OPEN DATASET p_fileot FOR OUTPUT IN TEXT MODE ENCODING DEFAULT
MESSAGE g_message.
IF sy-subrc <> 0.
MESSAGE e056
WITH g_message.
Unable to open output file &
ENDIF.
ENDFORM. " open_files
*& Form close_files
Close files used by the program.
FORM close_files.
CLOSE DATASET p_fileot.
ENDFORM. " close_files
*& Form extract_data
Extract data from database needed to generate output file and report.
FORM extract_data.
Get the required general ledger totals records.
PERFORM get_faglflext_data.
Derive any other necessary fields for I_FAGLFLEXT.
PERFORM derive_add_fields_faglflext.
Split records by fiscal period.
PERFORM split_records_by_period.
Summarize the detail records to allow for creation of the file and
reporting.
PERFORM summarize_records_by_period.
Get the required general ledger actual line items records.
PERFORM get_faglflexa_data.
Derive any other necessary fields for I_FAGLFLEXA.
PERFORM derive_add_fields_faglflexa.
Sort the detail and summary output tables into key sequence.
PERFORM sort_output_tables.
ENDFORM. " extract_data
*& Form process_data
Create the requested file and report.
FORM process_data.
Create the local file if requested by the user or the month-end file
at month-end.
IF cb_test = c_not_selected.
PERFORM create_pc_file.
ELSEIF sy-uname = c_user_batch_admin.
PERFORM create_output_file.
ENDIF.
Create the necessary tables for summary ALV report.
PERFORM build_summary_layout.
PERFORM build_summary_field_catalog.
PERFORM build_summary_sort_table.
Check to see that there is data in the summary output table. If yes,
generate report, if not, then give a message to the user.
READ TABLE i_output_summary INDEX 1 TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
MESSAGE s062.
STOP.
No data extracted for selection criteria entered
ENDIF.
Generate the summary ALV report view.
PERFORM generate_summary_alv_report.
ENDFORM. " process_data
*& Form verify_user_selections
Verify data input by the user.
FORM verify_user_selections.
IF NOT p_ryear IS INITIAL.
IF p_ryear < 2006 OR
p_ryear > 2100.
MESSAGE e057.
Fiscal year is invalid
ENDIF.
ENDIF.
If program is being run in a non-test mode and the user has left the
fiscal year selection blank, display a error message.
IF cb_test IS INITIAL AND
p_ryear IS INITIAL.
MESSAGE e058.
A fiscal year must be entered when generating the file
ENDIF.
If program is being run in a non-test mode and the user has left the
period selection blank, display a error message.
IF cb_test IS INITIAL AND
s_rpmax IS INITIAL.
MESSAGE e132.
A period must be entered when generating the file
ENDIF.
IF cb_test IS INITIAL AND
p_lfile IS INITIAL.
MESSAGE e071.
Local filename is required when generating the file
ENDIF.
****Basil Balogun's addition to include the hyperion acct in selection. (10/03/2007)***
IF s_rhype IS NOT INITIAL.
LOOP AT s_rhype.
CLEAR r_hyper.
r_hyper-sign = 'I'.
r_hyper-option = 'CP'.
CONCATENATE '' s_rhype-low '' INTO r_hyper-low.
APPEND r_hyper.
ENDLOOP.
SELECT bukrs saknr hyper
FROM zall_gl_hype INTO TABLE i_zall_gl
WHERE hyper IN r_hyper.
LOOP AT i_zall_gl INTO w_zall_gl.
w_zall_gl1-saknr = w_zall_gl-saknr.
w_zall_gl2-bukrs = w_zall_gl-bukrs.
APPEND w_zall_gl1-saknr TO i_zall_gl1.
APPEND w_zall_gl2-bukrs TO i_zall_gl2.
CLEAR: w_zall_gl, w_zall_gl1, w_zall_gl2.
ENDLOOP.
SORT i_zall_gl1 BY saknr.
SORT i_zall_gl2 BY bukrs.
DELETE ADJACENT DUPLICATES FROM i_zall_gl1 COMPARING saknr.
DELETE ADJACENT DUPLICATES FROM i_zall_gl2 COMPARING bukrs.
IF s_racct IS INITIAL.
LOOP AT i_zall_gl1 INTO w_zall_gl1.
r_saknr-sign = 'I'.
r_saknr-option = 'EQ'.
r_saknr-low = w_zall_gl1.
APPEND r_saknr.
CLEAR r_saknr.
CLEAR w_zall_gl1.
ENDLOOP.
ELSE.
r_saknr[] = s_racct[].
ENDIF.
IF s_rbukrs IS INITIAL.
LOOP AT i_zall_gl2 INTO w_zall_gl2.
r_bukrs-sign = 'I'.
r_bukrs-option = 'EQ'.
r_bukrs-low = w_zall_gl2-bukrs.
APPEND r_bukrs.
CLEAR r_bukrs.
CLEAR w_zall_gl2.
ENDLOOP.
ELSE.
r_bukrs[] = s_rbukrs[].
ENDIF.
ELSE.
r_saknr[] = s_racct[].
r_bukrs[] = s_rbukrs[].
SELECT bukrs saknr hyper
FROM zall_gl_hype INTO TABLE i_zall_gl.
ENDIF.
****Basil Balogun's addition to include the hyperion acct in selection. (10/03/2007)***
ENDFORM. " verify_user_selections
*& Form get_faglflext_data
Get FAGLFLEXT (General Ledger: Totals) data from the database.
FORM get_faglflext_data .
Use the fiscal year for the selection, if it was populated by the
user.
IF NOT p_ryear IS INITIAL.
SELECT ryear rldnr rvers racct rbukrs prctr rfarea kokrs segment
zzsarea zzsareaim rassc hsl01 hsl02 hsl03 hsl04 hsl05 hsl06
hsl07 hsl08 hsl09 hsl10 hsl11 hsl12 hsl13 hsl14 hsl15 hsl16
hslvt
INTO TABLE i_faglflext
FROM faglflext
WHERE rldnr = c_run_ledger AND
rbukrs IN r_bukrs AND
racct IN r_saknr AND
rfarea IN s_rfarea AND
prctr IN s_prctr AND
ryear = p_ryear AND
rvers = c_run_version.
ELSE.
SELECT ryear rldnr rvers racct rbukrs prctr rfarea kokrs segment
zzsarea zzsareaim rassc hsl01 hsl02 hsl03 hsl04 hsl05 hsl06
hsl07 hsl08 hsl09 hsl10 hsl11 hsl12 hsl13 hsl14 hsl15 hsl16
hslvt
INTO TABLE i_faglflext
FROM faglflext
WHERE rldnr = c_run_ledger AND
rbukrs IN r_bukrs AND
racct IN r_saknr AND
rfarea IN s_rfarea AND
prctr IN s_prctr AND
rvers = c_run_version.
ENDIF.
ENDFORM. " get_faglflext_data
*& Form derive_add_fields_faglflext
Derive additional fields needed for the I_FAGLFLEXT.
FORM derive_add_fields_faglflext.
Get needed company code and profit center data from the database.
PERFORM get_t001_data.
PERFORM get_t880_data.
READ TABLE i_faglflext INDEX 1 TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
PERFORM get_cepc_data.
ENDIF.
SORT i_zall_gl BY bukrs saknr.
LOOP AT i_faglflext INTO w_faglflext.
Get necessary company code data.
READ TABLE i_t001 INTO w_t001
WITH KEY bukrs = w_faglflext-rbukrs
BINARY SEARCH.
IF sy-subrc <> 0.
MESSAGE e059
WITH w_faglflext-rbukrs.
Company code & not found on table T001
ENDIF.
Determine the entity.
PERFORM derive_entity USING w_t001-rcomp
CHANGING w_faglflext-entity.
Determine the strategic segment.
PERFORM derive_strategic_segment USING w_faglflext-rassc
w_faglflext-prctr
CHANGING w_faglflext-strat_seg
w_faglflext-zzsareaim
w_faglflext-zzsarea.
Determine the strategic segment channel.
PERFORM derive_strat_seg_chnl USING w_faglflext-rassc
w_faglflext-prctr
CHANGING w_faglflext-strat_seg_chnl.
Determine the all item ID and all products.
PERFORM derive_all_item_id USING w_t001-waers
CHANGING w_faglflext-all_item_id
w_faglflext-all_products.
Determine the all customers and all customers channel.
PERFORM derive_all_customers_fields USING w_faglflext-strat_seg
*w_faglflext-strat_seg_chnl
CHANGING w_faglflext-all_cust
*w_faglflext-all_cust_chnl.
Determine the sub account using the company ID of the trading partner.
PERFORM derive_sub_account USING w_faglflext-rassc
CHANGING w_faglflext-sub_acct.
PERFORM derive_sub_account USING w_t001-rcomp
w_faglflext-rassc
CHANGING w_faglflext-sub_acct.
****Begin Basil changes to include hyperion acct in selection (10/03/2007).
READ TABLE i_zall_gl INTO w_zall_gl
WITH KEY bukrs = w_faglflext-rbukrs
saknr = w_faglflext-racct
BINARY SEARCH.
IF sy-subrc = 0.
****End Basil changes to include hyperion acct in selection (10/03/2007).
Determine the Hyperion account number from G/L account long text.
PERFORM derive_hyperion_account USING w_faglflext-racct
w_faglflext-rfarea
"KMK5/22/06 ITR: 20592
w_faglflext-sub_acct
w_faglflext-rassc
w_faglflext-prctr
CHANGING w_faglflext-hyperion_acct
w_faglflext-reverse_sign "NEM8/21/06 ITR: 24286
w_faglflext-balance_sheet "NEM8/21/06 ITR: 24286
w_faglflext-zzsarea
w_faglflext-zzsareaim
w_faglflext-strat_seg.
ENDIF.
Determine the all customers and all customers channel.
PERFORM derive_all_customers_fields USING w_faglflext-strat_seg
w_faglflext-strat_seg_chnl
CHANGING w_faglflext-all_cust
w_faglflext-all_cust_chnl.
Update i_FAGLFLEXT with the newly derive fields.
MODIFY i_faglflext FROM w_faglflext
TRANSPORTING entity
strat_seg
strat_seg_chnl
all_item_id
all_products
all_cust
all_cust_chnl
hyperion_acct
sub_acct
fiscal_period
zzsarea
zzsareaim
reverse_sign "NEM8/21/06 ITR: 24286
balance_sheet. "NEM8/21/06 ITR: 24286
ENDLOOP.
CHECK s_rhype IS NOT INITIAL.
SORT s_rhype BY low.
LOOP AT i_faglflext INTO w_faglflext.
READ TABLE s_rhype WITH KEY low = w_faglflext-hyperion_acct.
IF sy-subrc NE 0.
CLEAR w_faglflext-hyperion_acct.
MODIFY i_faglflext FROM w_faglflext.
ENDIF.
ENDLOOP.
DELETE i_faglflext WHERE hyperion_acct IS INITIAL.
ENDFORM. " derive_add_fields_faglflext
*& Form derive_entity
Derive the entity using the company code.
-->RCOMP - Company code.
<--ENTITY - Entity
FORM derive_entity USING rcomp TYPE t_t001-rcomp
CHANGING entity TYPE t_faglflext-entity.
CLEAR:
entity.
Get necessary global company code data.
READ TABLE i_t880 INTO w_t880
WITH KEY rcomp = rcomp
BINARY SEARCH.
IF sy-subrc = 0.
entity = w_t880-name2+0(3).
TRANSLATE entity TO UPPER CASE.
ELSE.
MESSAGE e060
WITH w_t001-rcomp.
Company code & not found on table T880
ENDIF.
ENDFORM. " derive_entity
*& Form get_t001_data
Get T001 (Company Codes) data from the database.
FORM get_t001_data.
SELECT bukrs waers rcomp
INTO TABLE i_t001
FROM t001
CLIENT SPECIFIED
WHERE mandt = sy-mandt.
SORT i_t001 BY bukrs.
ENDFORM. " get_t001_data
*& Form get_t880_data
Get T880 (Global Company Data (for KONS Ledger)) data from the
database.
FORM get_t880_data.
SELECT rcomp name2
INTO TABLE i_t880
FROM t880
CLIENT SPECIFIED
WHERE mandt = sy-mandt.
SORT i_t880 BY rcomp.
ENDFORM. " get_t880_data
*& Form derive_all_item_id
Derive the all item ID from the company code currency key.
-->WAERS - Currency key.
<--ALL_ITEM_ID - All item ID.
<--ALL_ITEM_ID - All item ID.
FORM derive_all_item_id USING waers TYPE t_t001-waers
CHANGING all_item_id TYPE t_faglflext-all_item_id
all_products TYPE t_faglflext-all_products
CLEAR:
all_item_id.
Populate all item ID.
all_item_id = c_all_item_id.
IF waers = c_us_dollars.
REPLACE '*' WITH c_united_states INTO all_item_id.
ELSE.
REPLACE '*' WITH c_local INTO all_item_id.
ENDIF.
Populate all products.
all_products = c_all_products.
TRANSLATE all_products TO UPPER CASE.
ENDFORM. " derive_all_item_id
*& Form derive_all_customers_fields
Derive the all customers and all customer channel fields from
the strategic segment and strategic segment channel respectively.
-->STRAT_SEG - Strategic segment.
-->STRAT_SEG_CHNL - Strategic segment channel.
<--ALL_CUST - All customers.
<--ALL_CUST_CHNL - All customers channel.
FORM derive_all_customers_fields USING strat_seg TYPE
t_faglflext-strat_seg
strat_seg_chnl TYPE
t_faglflext-strat_seg_chnl
CHANGING all_cust TYPE
t_faglflext-all_cust
all_cust_chnl TYPE
t_faglflext-all_cust_chnl.
CLEAR:
all_cust,
all_cust_chnl.
all_cust = strat_seg.
all_cust+2(1) = c_all_customers.
TRANSLATE all_cust TO UPPER CASE.
all_cust_chnl = strat_seg_chnl.
TRANSLATE all_cust_chnl TO UPPER CASE.
ENDFORM. " derive_all_customers_fields
*& Form derive_hyperion_account
Read G/L account long text to get the Hyperion account number.
-->RACCT - SAP G/L account number.
<--HYPERION_ACCT - Hyperion account number.
FORM derive_hyperion_account USING racct TYPE t_faglflext-racct
farea TYPE t_faglflext-rfarea
"KMK5/22/06 ITR 20592
sub_account TYPE
t_faglflext-sub_acct
rassc TYPE t_faglflext-rassc
prctr TYPE t_faglflext-prctr
CHANGING hyperion_acct TYPE t_faglflext-hyperion_acct
reverse_sign TYPE t_faglflext-reverse_sign "NEM8/21/06 ITR: 24286
balance_sheet TYPE t_faglflext-balance_sheet "NEM8/21/06 ITR: 24286
zzsarea TYPE t_faglflext-zzsarea
zzsareaim TYPE t_faglflext-zzsareaim
strat_seg TYPE t_faglflext-strat_seg.
DATA:
lv_text_name TYPE thead-tdname,
l_strl TYPE i VALUE 0,
l_hyperion_acct(10), "KMK5/20/06 ITR 20527
l_farea(10) VALUE '0000000000', "KMK5/22/06 ITR 20592
l_balance_sheet(1), "NEM8/17/06 ITR 25792
l_string TYPE tline-tdline. "NEM8/17/06 ITR 25792
DATA: l_hyp_account_1 TYPE tline-tdline,
l_hyp_account_2 TYPE tline-tdline,
l_hyp_account_3 TYPE tline-tdline.
reverse_sign = '1'.
SELECT SINGLE bilkt xbilk
FROM ska1
INTO (l_hyperion_acct,l_balance_sheet)
WHERE ktopl = c_global_tcoa
AND saknr = racct.
balance_sheet = l_balance_sheet.
l_string = w_zall_gl-hyper.
SEARCH l_string FOR '-'.
IF sy-subrc = '0'.
reverse_sign = -1.
ELSE.
reverse_sign = 1.
ENDIF.
CHECK w_zall_gl-hyper IS NOT INITIAL.
CLEAR: l_hyp_account_1, l_hyp_account_2, l_hyp_account_3.
SPLIT w_zall_gl-hyper
AT ';'
INTO l_hyp_account_1 l_hyp_account_2 l_hyp_account_3.
IF l_hyp_account_2 IS INITIAL. " Only one hyperion account
hyperion_acct = l_hyp_account_1+0(7).
l_strl = STRLEN( hyperion_acct ) - 1.
IF hyperion_acct+l_strl(1) EQ '1'.
CLEAR sub_account.
PERFORM repopulate_strategic_segment
USING rassc prctr
CHANGING strat_seg.
zzsareaim = g_hold_sales_type.
zzsarea = g_hold_sales_area.
ENDIF.
ELSE. " Two or more hyperion accounts
IF sub_account > ''.
hyperion_acct = l_hyp_account_2+0(7).
ELSE.
hyperion_acct = l_hyp_account_1+0(7).
ENDIF.
ENDIF.
CLEAR: w_hyperion.
w_hyperion-racct = racct.
w_hyperion-hyperion_acct = hyperion_acct.
w_hyperion-reverse_sign = reverse_sign.
ENDFORM. " derive_hyperion_account
*& Form derive_sub_account
Determine the sub account based on the company ID of the trading
partner.
-->RASSC - Company ID of trading partner.
<--SUB_ACCT - Sub account.
*FORM derive_sub_account USING rassc TYPE t_faglflext-rassc
CHANGING sub_acct TYPE t_faglflext-sub_acct.
IF rassc IS INITIAL.
CLEAR: sub_acct.
ELSE.
sub_acct = rassc.
TRANSLATE sub_acct TO UPPER CASE.
ENDIF.
*ENDFORM. " derive_sub_account
FORM derive_sub_account USING rcomp TYPE t_t001-rcomp
rassc TYPE t_faglflext-rassc
CHANGING sub_acct TYPE t_faglflext-sub_acct.
IF rassc IS INITIAL.
CLEAR: sub_acct.
ELSE.
READ TABLE i_t880 INTO w_t880
WITH KEY rcomp = rassc
BINARY SEARCH.
IF sy-subrc = 0.
sub_acct = w_t880-name2.
TRANSLATE sub_acct TO UPPER CASE.
ELSE.
MESSAGE e060
WITH w_t001-rcomp.
Company code & not found on table T880
ENDIF.
ENDIF.
ENDFORM. " derive_sub_account
*& Form repopulate_strategic_segment
Derive the strategic segment based on the company ID of the trading
partner or the profit center.
-->RASSC - Company ID of trading partner.
-->PRCTR - Profit center.
<--STRAT_SEG - Strategic segment.
FORM repopulate_strategic_segment USING rassc TYPE t_faglflext-rassc
prctr TYPE t_faglflext-prctr
CHANGING strat_seg TYPE t_faglflext-strat_seg
DATA:
lv_segment TYPE cepc-segment.
CLEAR:
strat_seg.
Find the valid profit center record.
LOOP AT i_cepc INTO w_cepc
WHERE prctr = prctr AND
datab <= sy-datum AND
datbi >= sy-datum.
Pad segment with leading zeros if necessary.
lv_segment = w_cepc-segment.
SHIFT lv_segment RIGHT DELETING TRAILING ' '.
TRANSLATE lv_segment USING ' 0'.
Get the segment name from FAGL_SEGMT (Master Data for Segments).
SELECT SINGLE *
FROM fagl_segmt
WHERE langu = sy-langu AND
segment = lv_segment.
IF sy-subrc = 0.
strat_seg = fagl_segmt-name+0(3).
TRANSLATE strat_seg TO UPPER CASE.
ENDIF.
ENDLOOP.
ENDFORM. "repopulate_strategic_segment
" repopulate_strategic_segment&----
*& Form derive_strategic_segment
Derive the strategic segment based on the company ID of the trading
partner or the profit center.
-->RASSC - Company ID of trading partner.
-->PRCTR - Profit center.
<--STRAT_SEG - Strategic segment.
FORM derive_strategic_segment USING rassc TYPE t_faglflext-rassc
prctr TYPE t_faglflext-prctr
CHANGING strat_seg TYPE t_faglflext-strat_seg
sales_type TYPE t_faglflext-zzsareaim
sales_area TYPE t_faglflext-zzsarea.
DATA:
lv_segment TYPE cepc-segment.
CLEAR:
strat_seg.
*Hold values in Sales Type and Sales area before setting to default
*values
In case need to use them later
g_hold_sales_type = sales_type.
g_hold_sales_area = sales_area.
If the company ID of the trading partner is populated, then set the
strategic segment to a default value.
And set Sales Type and Sales area to default values **NEM 07/13/06
IF NOT rassc IS INITIAL.
strat_seg = c_def_strat_seg.
sales_type = c_sales_type.
sales_area = c_sales_area.
TRANSLATE strat_seg TO UPPER CASE.
TRANSLATE sales_type TO UPPER CASE.
TRANSLATE sales_area TO UPPER CASE.
EXIT.
ENDIF.
Find the valid profit center record.
LOOP AT i_cepc INTO w_cepc
WHERE prctr = prctr AND
datab <= sy-datum AND
datbi >= sy-datum.
Pad segment with leading zeros if necessary.
lv_segment = w_cepc-segment.
SHIFT lv_segment RIGHT DELETING TRAILING ' '.
TRANSLATE lv_segment USING ' 0'.
Get the segment name from FAGL_SEGMT (Master Data for Segments).
SELECT SINGLE *
FROM fagl_segmt
WHERE langu = sy-langu AND
segment = lv_segment.
IF sy-subrc = 0.
strat_seg = fagl_segmt-name+0(3).
TRANSLATE strat_seg TO UPPER CASE.
ENDIF.
ENDLOOP.
ENDFORM. " derive_strategic_segment
*& Form get_cepc_data
Get CEPC (Profit Center Master Data Table) data from the database.
FORM get_cepc_data.
SELECT prctr datbi kokrs datab khinr segment
INTO TABLE i_cepc
FROM cepc
FOR ALL ENTRIES IN i_faglflext
WHERE prctr = i_faglflext-prctr.
SORT i_cepc BY prctr datab.
ENDFORM. " get_cepc_data
*& Form derive_strat_seg_chnl
Derive the strategic segment channel based on the company ID of the
trading partner or the profit center area.
-->RASSC - Company ID of trading partner.
-->PRCTR - Profit center.
<--STRAT_SEG_CHNL - Strategic segment channel.
FORM derive_strat_seg_chnl USING rassc TYPE t_faglflext-rassc
prctr TYPE t_faglflext-prctr
CHANGING strat_seg_chnl TYPE
t_faglflext-strat_seg_chnl.
CLEAR:
g_setclass,
g_subclass,
g_setname,
strat_seg_chnl.
If the company ID of the trading partner is populated, then set the
strategic segment to a default value.
IF NOT rassc IS INITIAL.
strat_seg_chnl = c_def_strat_seg_chnl.
TRANSLATE strat_seg_chnl TO UPPER CASE.
EXIT.
ENDIF.
Check for SETNAME = 2*** in setleaf table.
PERFORM get_setleaf_data USING c_prctr_group
prctr
CHANGING g_subrc.
IF g_subrc NE c_no_record.
PERFORM find_setleaf_record CHANGING g_subrc.
SELECT SINGLE *
FROM setheadert
WHERE setclass = g_setclass AND
subclass = g_subclass AND
setname = g_setname AND
langu = sy-langu.
IF sy-subrc = 0.
strat_seg_chnl = setheadert-descript+0(2).
TRANSLATE strat_seg_chnl TO UPPER CASE.
ENDIF.
ELSE.
Find the valid profit center record.
LOOP AT i_cepc INTO w_cepc
WHERE prctr = prctr AND
datab <= sy-datum AND
datbi >= sy-datum.
Get the correct SETNODE (Lower-level sets in sets) record.
PERFORM get_setnode_data USING c_prctr_group
w_cepc-khinr
CHANGING g_subrc.
PERFORM find_setnode_record CHANGING g_subrc.
IF g_subrc = c_no_record.
EXIT.
ENDIF.
If an appropriate SETNODE record still has not been found, then
keep looking.
IF g_subrc = c_wrong_record.
DO.
PERFORM get_setnode_data USING c_prctr_group
w_setnode-setname
CHANGING g_subrc.
PERFORM find_setnode_record CHANGING g_subrc.
IF g_subrc = c_no_record OR
g_subrc = c_correct_record.
EXIT.
ENDIF.
ENDDO.
ENDIF.
In the end, there was no SETNODE record to find.
IF g_subrc = c_no_record.
EXIT.
ENDIF.
SELECT SINGLE *
FROM setheadert
WHERE setclass = g_setclass AND
subclass = g_subclass AND
setname = g_setname AND
langu = sy-langu.
IF sy-subrc = 0.
strat_seg_chnl = setheadert-descript+0(2).
TRANSLATE strat_seg_chnl TO UPPER CASE.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. " derive_strat_seg_chnl
*& Form get_setnode_data
Get SETNODE (Lower-level sets in sets) data from the database.
-->SETCLASS - Set class.
-->SUBSETNAME - Subordinate set ID.
<--SUBRC - Return code.
FORM get_setnode_data USING setclass TYPE c
subsetname TYPE c
CHANGING subrc TYPE sy-subrc.
SELECT setclass subclass setname
INTO TABLE i_setnode
FROM setnode
WHERE setclass = c_prctr_group AND
subsetname = subsetname.
subrc = sy-subrc.
ENDFORM. " get_setnode_data
*& Form get_setleaf_data
Get SETLEAF (Values in Sets) data from the database.
-->SETCLASS - Set class.
-->VALFROM - Subordinate set ID.
<--SUBRC - Return code.
FORM get_setleaf_data USING setclass TYPE c
valfrom TYPE c
CHANGING subrc TYPE sy-subrc.
subrc = c_correct_record.
SELECT setclass setname valfrom subclass
INTO TABLE i_setleaf
FROM setleaf
WHERE setclass = c_prctr_group AND
valfrom = valfrom AND
setname GE '2000' AND
setname LE '2999'.
IF sy-subrc <> 0.
subrc = c_no_record.
EXIT.
ENDIF.
ENDFORM. " get_setleaf_data
*& Form find_setleaf_record
Find the appropriate SETLEAF record.
<--SUBRC - Return code.
FORM find_setleaf_record CHANGING subrc TYPE sy-subrc.
subrc = c_wrong_record.
If no records were found during selection, then exit the routine.
READ TABLE i_setleaf INDEX 1 TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
subrc = c_no_record.
EXIT.
ENDIF.
Check to see if one of the records has a setname in the 2000 series of
numbers.
LOOP AT i_setleaf INTO w_setleaf.
g_setclass = w_setleaf-setclass.
g_subclass = w_setleaf-subclass.
g_setname = w_setleaf-setname.
subrc = c_correct_record.
ENDLOOP.
ENDFORM. " find_setleaf_record
*& Form find_setnode_record
Find the appropriate SETNODE record.
<--SUBRC - Return code.
FORM find_setnode_record CHANGING subrc TYPE sy-subrc.
subrc = c_wrong_record.
If no records were found during selection, then exit the routine.
READ TABLE i_setnode INDEX 1 TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
subrc = c_no_record.
EXIT.
ENDIF.
Check to see if one of the records has a setname in the 2000 series of
numbers.
LOOP AT i_setnode INTO w_setnode.
IF w_setnode-setname+0(1) = c_valid_number.
g_setclass = w_setnode-setclass.
g_subclass = w_setnode-subclass.
g_setname = w_setnode-setname.
subrc = c_correct_record.
EXIT.
ENDIF.
ENDLOOP.
ENDFORM. " find_setnode_record
*& Form split_records_by_period
Split the i_FAGLFLEXT records by fiscal period. This is necessary
because all (16) fiscal periods are on one record.
FORM split_records_by_period .
REFRESH:
i_output_detail.
LOOP AT i_faglflext INTO w_faglflext.
START OF CHANGES BY BAYAPV on 07/07/2007**********************
*SELECT SINGLE BUKRS
SAKNR
XOPVW
into w_skb1
from skb1
FOR ALL ENTRIES IN I_FAGLFLEXT
where bukrs = w_faglflext-rbukrs
and SAKNR = w_faglflext-racct.
*IF w_skb1-XOPVW = 'X'.
*SELECT BUKRS
HKONT
Maybe you are looking for
-
I installed the Adobe Creative Cloud, now how do I acess the programs I downloaded?
I downloaded Adobe Creative Cloud , now how do I acess the programs I downloaded like Illustrator etc..?
-
Moving from one iPhone to another
Hi Can you please kindly clear this up for me. I'm reading and clicking around and just getting more confused. Recently I moved from an iPhone 3G -> 3GS. I did a back up and used this to restore on to the new phone. Brilliant. Everything was there ex
-
Upgrading to Newer Version of Pages
Do I have to purchase newer versions of Pages? I thought Pages would automatically upgrade to the latest version. However, the system is asking me to go to the store to purchase version 5.0.
-
Reset enable password and factory reset LAP1131AG
HI, I have an LAP1131AG that is configured and has a secret set for enable operations. The file system shows: XXX-AP-XXX>sh flash Directory of flash:/ 2 -rwx 256 May 05 2010 18:17:39 +00:00 lwapp_officeextend.cfg 3 -rwx 12
-
Does photoshop elements have an airbrushing tool for skin corrections?
does photoshop elements have an airbrushing tool for skin corrections?