Thursday, June 5, 2008

REPORTS EXAMPLES

I have a report, with a select-options with G/L Account nr. (ska1-saknr).
I have one authorization object with the field skanr.
I can select more than one account in auth, or a range of accounts.
By example - saknr: 11102070, 11102095, 11102097-11102099
Is not possible exclude accounts in this case.

The objective of the report is list all authorization objects that apply with the selection.

So, there is a complete (and little complex) example.
=> authorization objects
auth1: 11102070, 11102095, 11102097-11102099
auth2: 11102068, 11102070-11102098
1) select-options: I-EQ-11102070.
result -> auth1, auth2
2) select-options: I-EQ-11102069.
result -> none
3) select-options: I-EQ-11102071.
result -> auth2
4) select-options: I-EQ-11102071, I-BT-11102096->11102098.
result -> auth1, auth2
5) select-options: I-BT-11102060->11102069, E-EQ-11102068.
result -> none
6) select-options: I-BT-11102072->11102096, E-EQ-11102095.
result -> auth2

*****************************************************
In my interactive report, when user clicks on Material no, then only it should go to next level while currently it's going to next level even if user clicks anywhere.
I have used hide, at selection, get cursor field ..., etc.
*******************************************************
Searched for this but could not find anything. Is this a function module that can read the values of your ALV variant. i.e. what columns you have choosen.
The client would like the output file(unix) to reflect the choosen ALV variant so i will need to known the columns in the ALV Variant in order to dissect (sounds more interesting than it is) the file contents.

SELECT SINGLE REPORT VARIANT FROM LTDX INTO
(L_LTDXKEY-REPORT,L_LTDXKEY-VARIANT)
WHERE RELID = 'LT' AND REPORT = G_REPID AND VARIANT = P_VARI.
CHECK SY-SUBRC = 0.
L_LTDXKEY-TYPE = 'F'.

CALL FUNCTION 'LT_DBDATA_READ_FROM_LTDX'
EXPORTING
I_TOOL = 'LT'
IS_VARKEY = L_LTDXKEY
TABLES
T_DBFIELDCAT = L_LTDXDATA
* T_DBSORTINFO =
* T_DBFILTER =
EXCEPTIONS
NOT_FOUND = 1
WRONG_RELID = 2
OTHERS = 3.
Where L_LTDXDATA contains the ALV fields. If you need more code, I will post it here.
************************************************************

I got the task to program a report, that displays some of the conditions that are specific for a combination of Sales Organization, Distribution Channel, Division, Customer, Material and Validity period.
In which table or table join can I find the assignment (via KNUMH) of the condition types to this combination, to use it to read more condition data from KONP?

AFAIK:
run v/06 and read access sequence for your condition
run v/07 and read accesses assigned to access seqence. Remember table number and key fields. All sale pricing condition master data are stored in table with names Annn where nnn means 3 digits number. So if you read table number you can calculate condition ddic tablename.
Build a report browsing all tables from access sequence with all key fields.
Notify me when you finish version 2.0 where two first steeps you'll code inside your report to make it usefull for all conditions.

First of all be sure there is no FM doing the same in the system.

*******************************************************************************************************************
Recently I came accorss one report painter 12 month rolling actuals cost center report which is made by report painter. This report is slow. TheSQL trace shows that
. access new table.
. data pages are read in advance
. pure sequential prefetch is used
. new table:
. SAPR3.COSP
. table space locked in mode: N
. Accesstype: by index.
. Index: SAPR3.COSP~1 (matching index)
. Index columns (ordered):
. OBJNR
. MANDT
. LEDNR
. VERSN
. WRTTP
. GJAHR
. VRGNG
. with 1 matching columns of 7 index columns.

Please help how to make the performace improvement in Painter to make all the matching column of index column

as per my knowledge u cann't increase performance of reports which are Generated thru Report Painter . But what u can do is u can change the Chat/Key figures for what Report Selection which is tough Job for a ABAPers .


2. other option is u have to develop a Report based on the Key figures , and this one also Big one .
Please , i am telling on my experience . I have workedout on trail balance report.
*****************************************
When we display classical report. How to check, how many number of records it has displayed.
Kindly Advice.
One that you've written yourself ??
Count them as you output them and then output that at the end of the report.
For a standard SAP report that doesn't do that for you, count the number of records on the first page, multiply by no of pages - 1 and add the number of records on the last page.
*************************************************
I have a user requesting to view 2 alv reports on the same screen. I can provide a facility to switch between the reports but they would like to see both at the same time.
Any suggestions?
Hi,
It is possible to display two ALV Grids on the same screen, if you use OOPS ALV..
Otherwise, to display two ALV List using Function modules you can see the programs BALVBT01 and BALVBT02.

Yes, we can display the two reports in the same screen using 2 grids.

But we faced the problem when we ran the program in background.In the spool we found that only first report was being displayed(in first grid)...second grid was not coming at all.
***************************************************************************
what is the main use of logical databases?

In my experience thay are a standard SAP grouping of database tables, that can be accessed in a simple manner using their own built-in selection screens and join logic.

Did I use them a long long time ago? Yes.

Would I use them now? No.

They are useful, however, if you are not familiar with certain functional modules in SAP and require a quick point in the right direction!

Good luck with them!

And rightly so,
They are pretty fast and flexible (using HR report category).

I wouldn't bother with logical databases outside of the HR-module though.
I stopped using them 7 or 8 years ago because we kept finding erroneous results with them. Are they more robust now? I don't know but don't take chances any more and use the good old SELECTS.

But in HR I also know they are currently used without problems so....

I use to like them then because in certain cases for small programs, they were kinda neet, and constituted nice structured coding.

***********************************
i use fm ALSM_EXCEL_TO_INTERNAL_TABLE.

if there's any space in excel file i don't get it in internal table.
how can i get the space in internal table ? ?

Put an Apostrophe (an Apostrophe doc... not a Quote) in front of the string.
Why is that a problem? There are numerous examples of code using that FM that seem to magically cope with it.

You can check this sample code,


REPORT ztmptl_upload_excel_from_pc3 NO STANDARD PAGE HEADING.

TABLES : t001.
DATA : BEGIN OF i_tab OCCURS 0,
row TYPE alsmex_tabline-row,
col TYPE alsmex_tabline-col,
value TYPE alsmex_tabline-value,
END OF i_tab.
DATA : BEGIN OF it_tab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : END OF it_tab.
DATA wa_itab LIKE i_tab.
DATA : l_file TYPE rlgrap-filename.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
PARAMETER: dataset TYPE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK b1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR dataset.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
*def_filename = ' '
*def_path = ' '
*mask = ' '
mode = '0'
title = 'Choose the Appropriate excel sheet'
IMPORTING
filename = dataset
*EXCEPTIONS
*inv_winsys = 01
*no_batch = 02
*selection_cancel = 03
*selection_error = 04
.
l_file = dataset.

START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = l_file
i_begin_col = 1
i_begin_row = 1
i_end_col = 10
i_end_row = 65300
TABLES
intern = i_tab
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
.
break tlise.
*********************************************************************************************
I want to get a list of tables (as found in the SAP data dictionary) used in ABAP report programs created using transaction SE38.

That is, for example, I have created a report program ZEXAMPLE1.
In this program, I have used tables MARA, MAKT, T001W and MSEG.

I want to get a list of the above table names populated in an internal table. Though I can write a separate program to fulfill the purpose, I want to know whether any ready-made solution is available in SAP in the form of Function Modules or SAP's utility report programs.

Can anyone help me in saving the time of writing a new report program that will generate a list of SAP tables (including Z-tables) used in report programs ?
**************************************
Hi All,
I would like to know the difference between user exit and BADI.. If i have to change the standard menus, fields or program flow and if user exit is availble then accordingly it can be enabled..
But also SAP has provided BADIs ( business add ins) for taking care of adding additional features to standard system.. How BADI works? Is it like an external program to be plugged in or like user exit does it gets executed during the program flow ?

Please clarify
BADI is just an object-oriented version of user-exit. Instead of entering program code into some function module (as in customer-exit), you define some class which has to implement predefined methods and those methods are fired at predefined points just like an old user-exit. Some BADI can have multiple independent
implementations which is much better for software deployment as several developers can implement the same BADI independently.

SAP MEMORY AND ABAP MEMORY

SAP Memory
SAP memory is the memory area where all main sessions with in the SAP GUI have the access. We can use SAP memory either
to pass data from one program to other within the session, or to pass data from one session to other. Application programs that
use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set
either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve
the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on
screens

The SAP memory, otherwise known as the global memory, is available to a user during the entire duration of a terminal session. Its
contents are retained across transaction boundaries as well as external and internal sessions. The SET PARAMETER and GET
PARAMETER statements allow you to write to, or read from, the SAP memory.

ABAP/4 Memory
ABAP memory is the memory area that all ABAP programs within the same internal session can access using the EXPORT and
IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data
to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of
the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is
then returned to the program which made the initial call, the same process operates in reverse.