SAPBW@TW
Monday, December 26, 2005
Wednesday, December 07, 2005
[BW] Bex VBA - Example 1
Sub SAPBEXonRefresh(queryID As String, resultArea As Range)
Dim ws As Worksheet, myCell As Range, docWS As Worksheet
Dim firstRow As Long, lastRow As Long
Dim firstCol As Integer, lastCol As Integer
Dim myRange As Range, ProdFam As String, SubFam As String
Dim firstResultCol As Integer
'indentify / select worksheet containing query results
Set ws = resultArea.Parent
If ws Is Nothing Then
Exit Sub
Else:
ws.Select
End If
'locate first and last row and column in query results
Set myRange = resultArea
firstRow = myRange.Cells(1).Row
firstCol = myRange.Cells(1).Column
lastRow = myRange.Cells(myRange.Cells.Count).Row
lastCol = myRange.Cells(myRange.Cells.Count).Column
'find columns for Product Family and Sub Family,
'customer Number and product name, and first result column
pfCol = 0: sfCol = 0: custCol = 0: prodCol = 0: firstResultCol = 0
custNum = 0: custName = 0: prodCol = 0
For j = firstCol To lastCol
If Cells(firstRow + 1, j) Like "*Product Family*" Then pfCol = j
If Cells(firstRow + 1, j) Like "*Prod Sub-Family*" Then sfCol = j
If Cells(firstRow + 1, j) Like "*Customer*" Then custCol = j
If Cells(firstRow + 1, j) Like "*Fin Prod*" Then prodCol = j
If firstResultCol = 0 And Cells(firstRow, j).Style Like "*Item*" Then
firstResultCol = j
Exit For
End If
Next j
'ensure that we found all required columns
If pfCol = 0 Or sfCol = 0 or custCol = 0 or prodCol = 0 Then
MsgBox "Unable to locate all requuired columns." _
& vbLf & vbLf & "Routine will now terminate.", _
vbCritical, "Routine did not update successfully"
Exit Sub
End If
'now work on each row in result table
For i = firstRow + 1 To lastRow
'do some things based on results found in each row
Next i
'eliminate X from Key Figures
If firstResultCol > 0 Then
Set myRange = Range(Cells(firstRow + 1, firstResultCol), Cells(lastRow, lastCol))
myRange.Replace What:="X", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
End If
End Sub
[BW] Find BW report element ID with table RSZELTDIR
You can use table RSZELTDIR to search for the element id of all query components.
Useful for transport!!
RSZELTXREF - Query <--> Query elements
===========================
REPORT ZQUERY_DEF_TEST .
Tables: rszeltdir, "query element table
rszelttxt, "query element texts
rszcompdir, "global query elements
e071. "objects in transport requests
*parameters
parameters: Req_id like e071-trkorr.
* selection screen to input long ID 25 char generated name
select-options: long_ID for rszeltdir-eltuid.
*itab to hold related info
data: begin of i_query_desc occurs 0,
local, "Local to Query
eltuid like rszeltdir-eltuid, "25 char generated ID
compid like rszcompdir-compid, "technical name
deftp like rszeltdir-deftp, "element type
el_txt(16), "element type text
* txtsh like rszelttxt-txtsh, "short text
txtlg like rszelttxt-txtlg, "long text
owner like rszcompdir-owner, "owner
end of i_query_desc.
data: xlocal.
sy-tvar0 = Req_id.
*find all query objects for transport request entered
select * from e071 where trkorr = req_id and
object = 'ELEM'.
* add them to the select-options list
long_ID-low = e071-obj_name.
append long_ID.
clear long_ID.
endselect.
*loop through select option table and find details of Query element
Loop at long_ID.
clear: i_query_desc,
rszeltdir,
rszelttxt,
rszcompdir,
xlocal.
select single * from rszeltdir where eltuid = long_ID-low and
objvers = 'A'.
if sy-subrc <> 0.
write: / long_ID-low, ' Query element not found.'.
write: / .
else.
select single * from rszelttxt where eltuid = long_ID-low and
objvers = 'A'.
* if sy-subrc <> 0.
* write: / long_ID-low, ' not found in table RSZELTTXT.'.
endif.
select single * from rszcompdir where compuid = long_ID-low and
objvers = 'A'.
if sy-subrc <> 0.
* write: / long_ID-low, ' not found in table RSZCOMPDIR.'.
xlocal = 'X'.
endif.
* fill itab for list
i_query_desc-local = xlocal.
i_query_desc-eltuid = rszeltdir-eltuid. "25 char generated ID
i_query_desc-compid = rszcompdir-compid. "technical name
i_query_desc-deftp = rszeltdir-deftp. "element type
case i_query_desc-deftp.
when 'SEL'.
if xlocal = 'X'.
i_query_desc-el_txt = 'Selection'.
else.
i_query_desc-el_txt = 'Restricted K/Fig'.
endif.
when 'REP'.
i_query_desc-el_txt = 'Query'.
when 'VAR'.
i_query_desc-el_txt = 'Variable'.
when 'STR'.
i_query_desc-el_txt = 'Structure'.
when 'CKF'.
i_query_desc-el_txt = 'Calculated K/Fig'.
when 'FML'.
i_query_desc-el_txt = 'Formula'.
endcase.
* i_query_desc-txtsh = rszelttxt-txtsh. "short text
i_query_desc-txtlg = rszelttxt-txtlg. "long text
i_query_desc-owner = rszcompdir-owner. "owner
append i_query_desc.
clear i_query_desc.
endloop. "@ long_ID
* list results
sort i_query_desc by local deftp owner.
loop at i_query_desc.
write: / sy-vline,
i_query_desc-eltuid, sy-vline, "25 char generated ID
i_query_desc-compid , sy-vline, "technical name
i_query_desc-deftp , sy-vline, "element type
i_query_desc-el_txt, sy-vline, "element text
*write: / i_query_desc-txtsh , "short text
i_query_desc-txtlg(40) , sy-vline, "long text
i_query_desc-owner , sy-vline.
write: sy-uline .
endloop. "@ i_query_desc
Tuesday, December 06, 2005
[BW] Delete Error request in Infocube or ODS
FM : RSSM_DELETE_REQUEST
Table : RSMONICDP ( RNR within Cube or ODS )
RSREQDONE
RSSELDONE
RSMONVIEW
[BW] Transport Display Components of Process Chain
The entries are in table RSCOMPTLOGOT (TLOGO = "RSPC"). You can transport the entries of this table by going into SE16 for this table and going to "Table Entry > Transport Entries"
Monday, December 05, 2005
[BW] Steps of extract Asset data
Here are the steps you should follow:
1) In R/3 activate the BAdi FIAA_BW_DELTA_UPDATE in transaction SE19 if it is not active.
2) Now run a delta init (with data transfer!) for 0ASSET_ATTR_TEXT (and not
0ASSET_AFAB_TEXT).
3) Once this is successful, do a delta init for 0ASSET_AFAB_ATTR again with data transfer.
4) Now you can load 0ASSET_AFAB_TEXT and finally the 0FI_AA* transaction data. Also the
deltas for the master data should work now.
PS: After each step you can check in table BWOM2_TIMEST on R/3 if a delta init was
successful.