Pivot table runtime error 1004
Hello, i have problem with creating pivot table using vba...this is the code:
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Zdroj!R1C1:R" & Pocet & "C5", Version:=xlPivotTableVersion12).CreatePivotTable _
TableDestination:="Vysledek!R1C1", TableName:="Kontingenční tabulka 2", _
DefaultVersion:=xlPivotTableVersion12
every time when i run macro i receive this message: runtime errror 1004...
Please can you help me solve this issue???
Thanks a lot...
Mathew
You can only run that macro code once - because then you have the pivotcache existing and cannot add the same one again. Try it this way:
On Error Resume Next
ActiveWorkbook.PivotTables("Kontingencní tabulka 2").PivotCache.Delete
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Zdroj!R1C1:R" & pocet & "C5", Version:=xlPivotTableVersion12).CreatePivotTable _
TableDestination:="Vysledek!R1C1", TableName:="Kontingencní tabulka 2", _
DefaultVersion:=xlPivotTableVersion12
Similar Messages
-
Runtime Error '1004':, Method 'Intersect' of object '_Global' failed
Hello
I am getting a runtime error 1004, can someone tell me why? I am getting the runtime error on the first Application.Intercept statement.
Thank you for your help!
smsemail
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If Not Application.Intersect(Target, Me.Range("A:A")) Is Nothing Then
lastRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
If lastRow < 17 Then
Exit Sub
End If
If lastRow > 67 Then
lastRow = 67
End If
Else
Exit Sub
End If
If Not Application.Intersect(Target, Me.Range("A17:A" & lastRow)) Is Nothing Then
Application.EnableEvents = False
If Application.WorksheetFunction.CountA(Worksheets("RIPS").Range("A17:A67")) = 0 Then
Exit Sub
End If
If Application.WorksheetFunction.CountA(Worksheets("RIPS").Range("B17:B67")) = 0 And _
Application.WorksheetFunction.CountA(Worksheets("RIPS").Range("C17:C67")) = 0 And _
Application.WorksheetFunction.CountA(Worksheets("RIPS").Range("D17:D67")) = 0 Then
Exit Sub
End If
If CmdExecute = True Then
Exit Sub
End If
If CmdClear = True Then
Exit Sub
End If
Worksheets("RIPSSummary").Activate
lastRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
Set SourceRange = Application.Intersect(Range("A2:A" & lastRow), ActiveSheet.UsedRange)
MsgBox "Source Range: " & SourceRange
Worksheets("RIPS").Activate
lastRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
Set TargetRange = Application.Intersect(Range("A17:A" & lastRow), ActiveSheet.UsedRange)
MsgBox "Target Range: " & TargetRange
Exit Sub
wsDeleted = False
For Each acell In SourceRange.Cells
RecordFound = True
If Not IsEmpty(acell.Value) Then
Set C = TargetRange.Find(acell.Value, LookIn:=x1values)
If C Is Nothing Then
RecordFound = False
End If
If RecordFound = False Then
wsDeleted = True
For Each Worksheet In Worksheets
If Worksheet.Name = acell.Value Then
Worksheet.Delete
End If
Next Worksheet
End If
End If
Next acell
If vbKeyDelete Or _
vbKeyClear Then
r = lastRow
Do Until r < 17
If Worksheets("RIPS").Range("A" & r).Value = "" Then
Rows(r).Delete
End If
r = r - 1
Loop
End If
Application.EnableEvents = True
End If
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End SubIt should work but maybe there's something about your workbook we can't see.
In passing generally best not to disable screenupdating, alerts or events unless need to do so. More importantly though you should ensure they always get reset. As written you have several Exit Sub's before any code that resets them. Also in case of an error
consider resetting them in an error handler. -
BExAnalyzer: SAPBEXsetFilterValue and others: runtime error 1004, Intersect
Hello there,
any idea why e.g. SAPBexSetFilterValue does not work any more in BI7.0?
We need to set serveral filter values by macro which worked like a charme in BW3.5.
Now, all functions that have to to with filter values cause a runtime error 1004, saying that the intersect-property of the application object could not be assigned.
Does anyone have the same problem or even a solution or just a snipplet of working code (set or get a filter value).
As far as I've found out, the drill-down-functions may cause the same problem.
Any hints are welcome. Thank you.Sure, here it is. Simple enough, but not working no matter what I try:
Dim result As Long
' last parameter (atCell) left out. Cursor placed on filter cell for costcenter. If you have a look
' at the API, then the ActiveCell will be used in that case. This worked quite good in BW 3.5
result = Run("SAPBEXSetFilterValue", "DE00DECCR10000", "0HIER")
' The statement above will call the following code inside the API:
' Public Function SAPBEXsetFilterValue(intValue As String, Optional hierValue As String, Optional atCell As Range) As Integer
' extErrorBegin ("3.x API SAPBEXsetFilterValue called")
' If atCell Is Nothing Then Set atCell = Application.ActiveCell
' SAPBEXsetFilterValue = paddin.SAPBEXsetFilterValue(ActiveWorkbook.Name, intValue, hierValue, atCell)
' extErrorEnd
' End Function
' No matter if I use my statement (Run(...)) or call the API statement directly, I always receive a runtime error '1004',
' saying that the intersect-property of application-object could not be assigned.
SAPBEXSetFilterValue worked like a charme in BW3.5. We used it in several workbooks for automation and this becomes a really big problem now in BW7.0.
Any help/idea welcome! -
I have a workbook with VBA and I am getting a 'Run-time Error 1004' and when I hit the debug the process stops at below lines of codes:
' Insert blank rows, one to hold each period and one for the total line
With resultArea.Cells(RowNum, KeyFigCol - 1) {it says Application defined or Object defined error}
If .Value <> "" Then
I saw other threads for this error and I checked the OSS-429183. Also my macro>>security is set to low.
Any suggestions? Plus I am getting this error only in dev environment, stage & production work fine. I have verified the VBA code and they all have same code.Hi All, I still have this problem. I have the same VBA code in all the systems, but it gets error in development system only. its working fine in other systems. That's what breaks my head:(
Any suggestions. I have attached my VBA code.
'* Variable Declarations
Dim Column As Integer
Dim StrPos As Long
Dim TempStr As String
Dim RowNum As Integer
Dim StrRowNum As Integer
Dim EndRowNum As Integer
Dim EndColNum As Integer
Dim KeyFigCol As Integer
Dim DelStrCol As Integer
Dim LabelPos As Integer
Dim ActiveCellSave As String
Dim MonthFlag As String
Dim MonthFlagPrev As String
Dim MonthColStr As Integer
Dim MonthColEnd As Integer
Dim MonthCol1st As Integer
Dim MatMonRow As Integer
Dim ColPrjAvl As Integer
Dim ColTopGrn As Integer
Dim ColTopYel As Integer
Dim ColTopRed As Integer
Dim ColRmdRpl As Integer '001A
Dim ColMaxQty As Integer
Dim ColRplQty As Integer
Dim First As Boolean
Dim NumPeriods As Integer '001A
Dim UsgPerDay As Integer '001A
Dim StartTime
Dim EndTime
' Check the query id to determine which sheet to activate
If queryID = "SAPBEXq0016" Then 'Monthly Query
'Application.ScreenUpdating = False
'Set sheet "Inventory Montly Analysis" to active
Sheets(3).Activate
NumPeriods = 13 '001A
'* 001A: Set "Inventory Weekly Analysis" to active
ElseIf queryID = "SAPBEXq0018" Then ' Weekly query
Sheets(4).Activate
NumPeriods = 24
'* 001A: Set "Inventory Replenishment" to active
ElseIf queryID = "SAPBEXq0017" Then ' Replenishment Detail query
Sheets(6).Activate
NumPeriods = 0
Else
Exit Sub
End If
'* 001A: End of new code
'* Initialization Routines
First = True
' For performance testing, save off the start time of the macro
StartTime = Time
' Save off the current cell location so that we can restore that location
' when formatting is compelte
ActiveCellSave = ActiveCell.Address()
If ActiveCell.Value <> "No applicable data found." Then
' Determine the First Row in the spreadsheet where query results are displayed
' The first row will be stored in variable RowNum
TempStr = resultArea.Address(RowAbsolute:=False, ColumnAbsolute:=False)
StrRowNum = 0
Do While StrRowNum = 0
StrRowNum = Val(TempStr)
If StrRowNum = 0 Then
TempStr = Mid(TempStr, 2, 20)
End If
If TempStr = "" Then
Exit Do
End If
Loop
' Determine the Last Row in the spreadsheet where query results are displayed
' The last row will be stored in variable EndRowNum
TempStr = resultArea.Address(RowAbsolute:=False, ColumnAbsolute:=False)
StrPos = InStr(TempStr, ":")
TempStr = Right(TempStr, Len(TempStr) - StrPos)
EndRowNum = 0
Do While EndRowNum = 0
EndRowNum = Val(TempStr)
If EndRowNum = 0 Then
TempStr = Mid(TempStr, 2, 20)
End If
If TempStr = "" Then
Exit Do
End If
Loop
' Determine the Last Column in the spreadsheet where query results are displayed
' The last column number will be stored in EndColNum
TempStr = resultArea.Address(RowAbsolute:=False, ColumnAbsolute:=False, ReferenceStyle:=xlR1C1)
StrPos = InStr(TempStr, ":")
If StrPos > 0 Then
TempStr = Right(TempStr, Len(TempStr) - StrPos)
StrPos = InStr(TempStr, "C")
If StrPos = 0 Then
EndColNum = 255
Else
TempStr = Right(TempStr, Len(TempStr) - StrPos - 1)
EndColNum = Val(TempStr)
End If
End If
' Clear all of the old contents below the query result area
TempStr = Format(EndRowNum + 1) + ":" + Format(65536)
ActiveSheet.Rows(TempStr).Select
Selection.Clear
' Determine the location of various key figure columns needed in subsequent processing
KeyFigCol = 0
For Column = 1 To EndColNum
' Find the start column for the key figures - Indicated by the first column
' with a dash "-" character in it.
If InStr(resultArea.Cells(1, Column).Value, " - ") <> 0 Then
If KeyFigCol = 0 Then KeyFigCol = Column
End If
' Find the Projected Available Column
If (ColPrjAvl = 0) And (InStr(resultArea.Cells(1, Column).Value, "Proj") <> 0) Then
ColPrjAvl = Column
End If
' Find the Top of Green Column
If (ColTopGrn = 0) And (InStr(resultArea.Cells(1, Column).Value, "Top of Green") <> 0) Then
ColTopGrn = Column
End If
' Find the Top of Yellow Column
If (ColTopYel = 0) And (InStr(resultArea.Cells(1, Column).Value, "Top of Yellow") <> 0) Then
ColTopYel = Column
End If
' Find the Top of Red Column
If (ColTopRed = 0) And (InStr(resultArea.Cells(1, Column).Value, "Top of Red") <> 0) Then
ColTopRed = Column
End If
' Find the Recommended Replenishment Quantity
If (ColRmdRpl = 0) And (InStr(resultArea.Cells(1, Column).Value, "Recommended Replenishment Qty") <> 0) Then
ColRmdRpl = Column
End If
' Find the Usage Per Day
If (UsgPerDay = 0) And (InStr(resultArea.Cells(1, Column).Value, "Usage Per") <> 0) Then
UsgPerDay = Column
End If
' Find the Maximum Order Column
If (ColMaxQty = 0) And (InStr(resultArea.Cells(1, Column).Value, "Maximum Order Quantity") <> 0) Then
ColMaxQty = Column
End If
' Find the Recommended Replenishment Column
If (ColRplQty = 0) And (InStr(resultArea.Cells(1, Column).Value, "Recommended Replenishment") <> 0) Then
ColRplQty = Column
End If
Next Column
'* Begin of main formatting loop
'* Logic for Recommended Repl Highlighting
If NumPeriods = 0 Then
' Highlight the Recommended Replenishment Quantity
For RowNum = 2 To EndRowNum
If resultArea.Cells(RowNum, ColRplQty).Value > resultArea.Cells(RowNum, ColMaxQty).Value Then
resultArea.Cells(RowNum, ColRplQty).Interior.ColorIndex = 7 'Highlight Red
End If
Next RowNum
'* Logic for Monthly and Weekly Queries
Else
' Work from the bottom up, inserting new lines and folding the keyfigures
' downward into one row for each month
For RowNum = EndRowNum To 2 Step -1
' Insert blank rows, one to hold each period and one for the total line
With resultArea.Cells(RowNum, KeyFigCol - 1) This is where it stops & gives Runtime Error 1004
If .Value <> "" Then
' For the bottom-most characteristic row, we must cut and paste differently to ensure
' the cells formats are properly pasted in the new rows
If First Then
TempStr = Format(RowNum) + ":" + Format(RowNum + NumPeriods)
resultArea.Rows(TempStr).Select
Selection.Insert Shift:=xlDown
resultArea.Rows(RowNum + NumPeriods + 1).Select
Selection.Cut
resultArea.Rows(RowNum).Select
ActiveSheet.Paste
First = False
' If this is the first characteristic record, and it resides in row 2, then we know that the
' query only has one row of data - special formatting is required in this situation
If RowNum = 2 Then
resultArea.Cells(2, 1).Select
Selection.Copy
Range(ActiveSheet.Cells(StrRowNum + 2, 1), ActiveSheet.Cells(EndRowNum + NumPeriods, KeyFigCol - 1)).Select
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End If
' Not the first row, use normal processing
Else
TempStr = Format(RowNum + 1) + ":" + Format(RowNum + NumPeriods)
resultArea.Rows(TempStr).Select
Selection.Insert Shift:=xlDown
End If
' As we insert rows for each characteristic row, we need to adjust the end row
' number accordingly
EndRowNum = EndRowNum + NumPeriods
' Initialize variables used for each set of month processing
MatMonRow = RowNum + 1
MonthFlagPrev = ""
MonthFlag = ""
MonthColStr = 0
' Scan key figure column headings from left to right, looking for changes in month
For i = KeyFigCol To EndColNum + 1
' Get the month text for each column
MonthFlag = ""
TempStr = resultArea.Cells(1, i).Value
MonthFlag = Mid(TempStr, InStr(TempStr, "-") + 1, 15)
' If we move into a new month, then copy and paste the previous month downward
If ((MonthFlag <> MonthFlagPrev) And (MonthFlagPrev <> "")) Or (i = EndColNum + 1) Then
If DelStrCol = 0 Then DelStrCol = i + 1 ' Capture last key figure of first month
If i = EndColNum + 1 Then i = i + 1 'For results row, need to extend by one
' Copy and paste values for previous month
Range(resultArea.Cells(RowNum, MonthColStr), resultArea.Cells(RowNum, i - 1)).Select
Selection.Copy
resultArea.Cells(MatMonRow, MonthCol1st).Select
ActiveSheet.Paste
' Paste the Month text into the row heading
resultArea.Cells(MatMonRow, MonthCol1st - 1).Value = MonthFlagPrev
If MonthFlagPrev = " Average Result" Then
Range(resultArea.Cells(MatMonRow, MonthCol1st - 1), resultArea.Cells(MatMonRow, EndColNum)).Select
Selection.Interior.ColorIndex = 36
End If
With resultArea.Cells(MatMonRow, ColPrjAvl)
If .Value >= resultArea.Cells(RowNum, ColTopGrn).Value Then
.Interior.ColorIndex = 43 'Green Green
ElseIf .Value >= resultArea.Cells(RowNum, ColTopYel).Value Then
.Interior.ColorIndex = 14 'Green
ElseIf .Value >= resultArea.Cells(RowNum, ColTopRed).Value Then
.Interior.ColorIndex = 44 'Yellow
Else
.Interior.ColorIndex = 7 'Red
End If
End With
MonthColStr = i
MatMonRow = MatMonRow + 1
End If
' Set variables on first pass through
If MonthColStr = 0 Then
MonthColStr = i
MonthCol1st = i
MonthFlagPrev = MonthFlag
End If
' Capture the previous month text
If MonthFlagPrev <> "" Then
MonthFlagPrev = MonthFlag
End If
Next i
' Clear out the key figure data at the lowest characteristic level
Range(resultArea.Cells(RowNum, KeyFigCol), resultArea.Cells(RowNum, EndColNum)).Select
Selection.ClearContents
End If
End With
Next RowNum
' Strip out the month text from column headings
For i = KeyFigCol To DelStrCol
LabelPos = InStr(resultArea.Cells(1, i).Value, "-")
If LabelPos > 1 Then resultArea.Cells(1, i).Value = _
Left(resultArea.Cells(1, i).Value, LabelPos - 1)
Next i
' Remove Extraneous columns (months 2-12)
Range(resultArea.Cells(1, DelStrCol - 1), resultArea.Cells(EndRowNum, EndColNum + 1)).Select
Selection.Clear
' Format Column Headings with appropriate column widths and heights
resultArea.Rows(1).Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 1
.ShrinkToFit = False
.MergeCells = False
.RowHeight = 31.5
End With
' 001A: Add empty cells for Recommended replenishment
If ColRmdRpl <> 0 Then
For i = 2 To EndRowNum
If resultArea.Cells(i - 1, 1) = "" Then
Range(resultArea.Cells(i, ColRmdRpl), resultArea.Cells(i, ColRmdRpl + 4)).Insert Shift:=xlToRight
End If
Next i
Columns(ColRmdRpl + 5).Copy
Range(Columns(ColRmdRpl), Columns(ColRmdRpl + 4)).PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
If UsgPerDay <> 0 Then
For i = 2 To EndRowNum
If resultArea.Cells(i - 1, 1) = "" Then
resultArea.Cells(i, UsgPerDay).Insert Shift:=xlToRight
End If
Next i
Columns(ColRmdRpl + 5).Copy
Range(Columns(ColRmdRpl), Columns(ColRmdRpl + 4)).PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
End If
For i = 3 To EndRowNum
If resultArea.Cells(i - 1, 1) <> "" Then
Range(resultArea.Cells(i, ColRmdRpl + 1), resultArea.Cells(i + NumPeriods - 1, ColRmdRpl + 4)).Select
Selection.FillDown
Range(resultArea.Cells(i, UsgPerDay), resultArea.Cells(i + NumPeriods - 1, UsgPerDay)).Select
Selection.FillDown
End If
Next i
' Remove Extraneous columns (months 2-12)
Range(resultArea.Cells(1, DelStrCol - 1), resultArea.Cells(EndRowNum, EndColNum + 1)).Select
Selection.Clear
End If
' 001A: End of new code
End If
End If
Columns("A:BA").ColumnWidth = 10
resultArea.Columns.AutoFit
' Set Zoom level at 75%
ActiveWindow.Zoom = 75
' Restore the active cell
Range(ActiveCellSave).Select
' EndTime = Time
' MsgBox StartTime
' MsgBox EndTime
' StartTime = EndTime - StartTime
' MsgBox StartTime
' End If
' End If
'Application.ScreenUpdating = True
End Sub -
Hi everyone.
We are working on upgrading from 4.6c to ECC 6.0 and I've run into a programming problem.
I have a class that I use to convert any internal table based on a dictionary structure to a comma-separated text file. For the most part, I use the dynamic table techniques that are easy to find here and in other code forums.
In 6.0 I can not get it to work. The value assignment of the input table to the field-symbol for the dynamic table causes a "OBJECTS_TABLES_NOT_COMPATIBLE" runtime error. So far what I can find on this error specific to dynamic tables is related to BW and/or PI. And I can't seem to find any alternative ways of dealing with dynamic tables. In debug I can see that decimal number fields in the dynamic table have a different length than what's in the dictionary.
Any help or ideas would be greately appreciated.
Here is part of the method that converts the itab to an dynamic internal table, then creates a csv record for each record (I've hilighted the line that causes the dump) :
Get the structure of the table.
ref_table_des ?=
cl_abap_typedescr=>describe_by_name( i_structure ).
idetails[] = ref_table_des->components[].
loop at idetails into xdetails.
clear xfc.
xfc-fieldname = xdetails-name .
xfc-datatype = xdetails-type_kind.
xfc-inttype = xdetails-type_kind.
xfc-intlen = xdetails-length.
xfc-decimals = xdetails-decimals.
append xfc to ifc.
endloop.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = ifc
importing
ep_table = dy_table.
assign dy_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data dy_line like line of <dyn_table>.
assign dy_line->* to <dyn_wa>.
put data into the dynamic table
<dyn_table> = it_data[]. "<<==the runtime error happens on this line
loop at <dyn_table> into <dyn_wa>.
clear: l_fdata, l_data.
do.
l_index = sy-index.
assign component l_index
of structure <dyn_wa> to <dyn_field>.
if sy-subrc <> 0.
exit.
endif.
read table ifc into xfc index l_index.
if xfc-inttype = 'D'.
*etc...
Thank you,
- GeorgeHi,
For Dynamic internal table.u check SM30 Transaction.ther is one simple way to find the code in debugging.
if not possible i will send code which is relatd to dynamic table .
*& Form get_table_structure
* Get structure of an SAP table
form get_table_structure.
data : it_tabdescr type abap_compdescr_tab,
wa_tabdescr type abap_compdescr.
data : ref_table_descr type ref to cl_abap_structdescr.
* Return structure of the table.
ref_table_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
it_tabdescr[] = ref_table_descr->components[].
loop at it_tabdescr into wa_tabdescr.
clear wa_fieldcat.
wa_fieldcat-fieldname = wa_tabdescr-name .
wa_fieldcat-datatype = wa_tabdescr-type_kind.
wa_fieldcat-inttype = wa_tabdescr-type_kind.
wa_fieldcat-intlen = wa_tabdescr-length.
wa_fieldcat-decimals = wa_tabdescr-decimals.
append wa_fieldcat to it_fieldcat.
endloop.
endform. "get_table_structure
*& Form create_itab_dynamically
* Create internal table dynamically
form create_itab_dynamically.
* Create dynamic internal table and assign to Field-Symbol
call method cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = dyn_table.
assign dyn_table->* to <fs_table>.
* Create dynamic work area and assign to Field Symbol
create data dyn_line like line of <fs_table>.
assign dyn_line->* to <fs_wa>.
endform. "create_itab_dynamically
Edited by: subrahmanyam24 on Nov 18, 2010 5:12 AM
Edited by: subrahmanyam24 on Nov 18, 2010 5:15 AM -
Hash Table -Runtime error.
Hi,
i am defining internal table as hash table but it is giving runtime error like bolow. some times it is executing properly or giving dump.please give me some suggestions to come out of this problem.
Ex:
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLZGIT_MED" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
An entry was to be entered into the table
"\FUNCTION=ZBAPI_GIT_MED_HD_BOTELLAS_RPT\DATA=T_THERAPY_INFO" (which should
have
had a unique table key (UNIQUE KEY)).
However, there already existed a line with an identical key.
The insert-operation could have ocurred as a result of an INSERT- or
MOVE command, or in conjunction with a SELECT ... INTO.
The statement "INSERT INITIAL LINE ..." cannot be used to insert several
initial lines into a table with a unique key.
Code: .....................................
TYPES: BEGIN OF X_THERAPY_INFO,
GIT_THERAPY_ID TYPE ZGIT_VBELN_GIT,
CHO_THERAPY_ID TYPE VBELN,
SERVICE_ID TYPE MATNR,
SERVICE_DESC TYPE ARKTX,
FLOW TYPE ZGIT_ZFLOW,
DURATION TYPE ZGIT_ZDURATION,
GIT_PAT_ID TYPE ZGIT_KUNNR_GIT,
CHORUS_PAT_ID TYPE KUNNR,
END OF X_THERAPY_INFO,
DATA:
T_THERAPY_INFO TYPE HASHED TABLE OF X_THERAPY_INFO WITH UNIQUE KEY GIT_THERAPY_ID, " Internal table for extracting the therapy Informamtion
Extract the Therapy Details
SELECT VBELN_GIT
VBELN
MATNR
ARKTX
ZFLOW
ZDURATION
KUNNR_GIT
KUNNR
INTO TABLE T_THERAPY_INFO
FROM ZGIT_T_VBAK
WHERE KUNNR_GIT NE SPACE
AND KVGR2 IN TR_KVGR2
AND ZDOCTOR IN TR_DOC_SEL_ID
AND ZHOSPITAL IN TR_HOSPITAL_ID
AND ( ZSTATUS_ID NE C_HIDDEN
AND ZSTATUS_ID NE C_DISABLED
AND ZSTATUS_ID NE C_OTHERS )
AND VBELN IN TR_VBELN.
IF SY-SUBRC NE C_0.
Thanks in advance,
Srinivas PWhen you are using hashed tables, you cannot have duplicate records (considering it's key). So DELETE ADJACENT DUPLICATES won't solve it. It will dump before that.
Find if you are inserting records with the same fields you inserted in the key.
Example.
If your key is VBELN, you cannot make it like this:
SELECT a~vbeln b~matnr
INTO TABLE hashed_itab
FROM vbak AS a INNER JOIN vbap as b
ON a~vbeln = b~vbeln
WHERE ...
It will dump if your vbeln has 2 lines in vbap.
Two solutions:
1 - expand the itab key to VBELN and POSNR (for example) or
2
SELECT DISTINCT a~vbeln b~matnr
INTO TABLE hashed_itab
FROM vbak AS a INNER JOIN vbap as b
ON a~vbeln = b~vbeln
WHERE ...
Regards,
Valter Oliveira. -
VBA Runtime Error 1004 "Application-defined or Object-defined error"
I have code VBA code written in MS Access 2010 (.mbd file) to write data into an Excel file (.xls file). Below is the code to write data into that excel file. When you run this code, it always throws Error#1004 "Application-defined or Object-defined
error". When you debug the code (F8) or run it (F5), it runs absolutely fine with out any issues. I am still not able to figure it out on what exactly the issue is. This code works fine when executed in MS Access 2007.
Below is thr code that's getting executed and when it fails, the focus is set on the 3rd last line of the code marked in double astriek mark.
Sub PopulateReport(appExcel As Object, testcam)
Dim Site As String, intRec As Integer, i As Integer, cnt As Integer, intRecSet As Integer, cntr As Integer
Dim F1 As String, F2 As String, F3 As String, F4 As String, F5 As String, F6 As String, F7 As String
Dim F8 As String, F9 As String, F10 As String, F11 As String, F12 As String, F13 As String, CAMDate As Date
Close
i = 0
cnt = 0
cntr = 0
Set cnn = CurrentProject.Connection
rec.Open "SELECT * FROM Site", cnn, adOpenStatic, adLockPessimistic
rec.MoveLast
rec.MoveFirst
intRec = rec.RecordCount
Do Until cnt = intRec
rec.MoveLast
rec.MoveFirst
rec.Move cnt
Site = rec(4)
Select Case Site
Case "Fort Worth"
cntr = 0
recset.Open "SELECT * FROM Employee", cnn, adOpenStatic, adLockPessimistic
recset.MoveLast
recset.MoveFirst
intRecSet = recset.RecordCount
appExcel.Application.Goto Reference:="START_FW_CL"
Do Until cntr = intRecSet - 1
appExcel.Selection.EntireRow.Copy
appExcel.Selection.EntireRow.Insert
cntr = cntr + 1
Loop
appExcel.Application.CutCopyMode = False
appExcel.Application.Goto Reference:="START_FW2_CL"
go = appExcel.Application.Range("START_FW2_CL")
cntr = 1
With appExcel.Worksheets("Accts. > Clearing").[START_FW2_CL]
Do Until recset.EOF
**.Offset(cntr, 0) = recset(0)**
.Offset(cntr, 1) = recset(1)
.Offset(cntr, 2) = recset(2)
End SubWhat's wrong about it? It can only copy what you chose to have in the recordset. If you only want some fields or fields in a different order, replace
SELECT * FROM with
SELECT Field1, Field2, etc
CopyFromRecordset is bay far the best method and runs much faster.
Rod Gill
Author of the one and only Project VBA Book
www.project-systems.co.nz -
BSEG table : Runtime error
Dear Experts,
Table BSEG is throws time-out error, how to solve this error.
regards
rajakarthik>
Rajeev P wrote:
> This shows that an internal table does not have enough space to execute ur action. U need to increase the space or add datafiles to the that table.
> Check SM21 or log files at the time of error to find out the table name. Then u can increase the space either through SE14 or from Database itself.
I doubt your recommendation to increase datafiles of the table.
Internal tables are filled/created while executing programs, transactions....
There are several options to solve the issue:
- to adjust the memory parameter of the application server
- change the selection / program and retrieve less records
Best regards,
Ruediger -
Runtime Error '1004': Unable to get the DropDowns property of the Worksheet class
Private Sub SponsorList_Change()
'On Error GoTo EH
UnprotectWorksheets
Application.ScreenUpdating = False
With ActiveSheet.DropDowns("SponsorList")
Dim tmpPivotTable As PivotTable
For Each tmpPivotTable In ActiveSheet.PivotTables
tmpPivotTable.PivotFields("Sponsor").CurrentPage = .list(.ListIndex)
Next
End With
sponsorUpdateView
Application.ScreenUpdating = True
ActiveSheet.Select
ProtectWorksheets
Exit Sub
EH:
ErrorHandler
End Sub
The above code works fine with Excel 2010, but throws the error when executing the "With ActiveSheet.DropDowns("SponsorList")" statement with Excel 2013 (Windows 7 on both machines). Also works fine with Excel 2013 in debug
mode. Help please!My testing indicates the line should work fine in xl2013. Have you got the correct worksheet activated? Try ensuring that the correct worksheet is activated by inserting the following code before the problem line.
Worksheets("Sheet1").Select 'Edit "Sheet1" to the correct sheet name
Regards, OssieMac -
Runtime error:ABAP program lines are longer than the internal table
Hi all,
Below is the code I have written,when Iam running it Iam getting
'ABAP program lines are longer than the internal table' runtime error.How can I resolve it.
REPORT ZTEST1 NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES:MARC,CDHDR,CDPOS.
TYPE-POOLS:SLIS.
DATA:HEADER TYPE SLIS_T_FIELDCAT_ALV,
WA TYPE SLIS_FIELDCAT_ALV,
LAYOUT TYPE SLIS_LAYOUT_ALV.
TYPES:BEGIN OF MARC_TY,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
EKGRP LIKE MARC-EKGRP,
MINBE LIKE MARC-MINBE,
EISBE LIKE MARC-EISBE,
MABST LIKE MARC-MABST,
END OF MARC_TY.
TYPES:BEGIN OF MATNR1_TY,
MATNR1 LIKE CDHDR-OBJECTID,
END OF MATNR1_TY.
TYPES:BEGIN OF CDHDR_TY,
OBJECTCLAS LIKE CDHDR-OBJECTCLAS,
OBJECTID LIKE CDHDR-OBJECTID,
CHANGENR LIKE CDHDR-CHANGENR,
USERNAME LIKE CDHDR-USERNAME,
UDATE LIKE CDHDR-UDATE,
END OF CDHDR_TY.
TYPES:BEGIN OF CDPOS_TY,
OBJECTCLAS LIKE CDPOS-OBJECTCLAS,
OBJECTID LIKE CDPOS-OBJECTID,
CHANGENR LIKE CDPOS-CHANGENR,
TABNAME LIKE CDPOS-TABNAME,
FNAME LIKE CDPOS-FNAME,
CHNGIND LIKE CDPOS-CHNGIND,
VALUE_NEW LIKE CDPOS-VALUE_NEW,
VALUE_OLD LIKE CDPOS-VALUE_OLD,
END OF CDPOS_TY.
**************TABLE TYPES********************************************
TYPES: MARC_TAB TYPE TABLE OF MARC_TY,
MATNR1_TAB TYPE TABLE OF MATNR1_TY,
CDHDR_TAB TYPE TABLE OF CDHDR_TY,
CDPOS_TAB TYPE TABLE OF CDPOS_TY.
*******************INTERNAL TABLES************************************
DATA:MARC_ITAB TYPE MARC_TAB,
MATNR1_ITAB TYPE MATNR1_TAB,
CDHDR_ITAB TYPE CDHDR_TAB,
CDPOS_ITAB TYPE CDPOS_TAB.
****************WORK AREAS********************************************
DATA:MARC_WA TYPE MARC_TY,
MATNR1_WA TYPE MATNR1_TY,
CDHDR_WA TYPE CDHDR_TY,
CDPOS_WA TYPE CDPOS_TY.
*******************SELECTION-SCREEN***********************************
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
PARAMETERS:PLANT LIKE MARC-WERKS.
SELECT-OPTIONS:MATERIAL FOR MARC-MATNR.
SELECT-OPTIONS:DATE FOR CDHDR-UDATE.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
SELECT MATNR
WERKS
EKGRP
MINBE
EISBE
MABST
FROM MARC INTO TABLE MARC_ITAB
WHERE MATNR IN MATERIAL
AND WERKS = PLANT.
CHECK MARC_ITAB[] IS NOT INITIAL.
LOOP AT MARC_ITAB INTO MARC_WA.
MATNR1_WA-MATNR1 = MARC_WA-MATNR.
APPEND MATNR1_WA TO MATNR1_ITAB.
CLEAR MATNR1_WA.
ENDLOOP.
CHECK MATNR1_ITAB[] IS NOT INITIAL.
SELECT OBJECTCLAS
OBJECTID
CHANGENR
USERNAME
UDATE
FROM CDHDR INTO TABLE CDHDR_ITAB
FOR ALL ENTRIES IN MATNR1_ITAB
WHERE OBJECTCLAS = 'MATERIAL'
AND OBJECTID = MATNR1_ITAB-MATNR1
AND UDATE IN DATE.
CHECK CDHDR_ITAB[] IS NOT INITIAL.
SORT CDHDR_ITAB[] DESCENDING BY OBJECTID CHANGENR.
DELETE ADJACENT DUPLICATES FROM CDHDR_ITAB[] COMPARING OBJECTID.
SELECT OBJECTCLAS
OBJECTID
CHANGENR
TABNAME
FNAME
CHNGIND
VALUE_NEW
VALUE_OLD
FROM CDPOS INTO CORRESPONDING FIELDS OF TABLE CDPOS_ITAB
FOR ALL ENTRIES IN CDHDR_ITAB
WHERE OBJECTCLAS = CDHDR_ITAB-OBJECTCLAS
AND OBJECTID = CDHDR_ITAB-OBJECTID
AND CHANGENR = CDHDR_ITAB-CHANGENR
AND TABNAME = 'MARC'
AND FNAME IN ('MINBE','EISBE','MABST','LVORM')
AND CHNGIND = 'U'.
CHECK CDPOS_ITAB[] IS NOT INITIAL.
*LOOP AT CDPOS_ITAB INTO CDPOS_WA.
WRITE: / CDPOS_WA-OBJECTCLAS,
CDPOS_WA-OBJECTID,
CDPOS_WA-CHANGENR,
CDPOS_WA-TABNAME,
CDPOS_WA-FNAME,
CDPOS_WA-CHNGIND,
CDPOS_WA-VALUE_NEW,
CDPOS_WA-VALUE_OLD.
*ENDLOOP.
WA-SELTEXT_L = 'OBJECTCLAS'.
WA-COL_POS = '1'.
WA-FIELDNAME = 'OBJECTCLAS'.
WA-TABNAME = 'CDPOS_ITAB'.
WA-OUTPUTLEN = '15'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'OBJECTID'.
WA-COL_POS = '2'.
WA-FIELDNAME = 'OBJECTID'.
WA-TABNAME = 'CDPOS_ITAB'.
WA-OUTPUTLEN = '20'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'CHANGENR'.
WA-COL_POS = '3'.
WA-FIELDNAME = 'CHANGENR'.
WA-TABNAME = 'CDPOS_ITAB'.
WA-OUTPUTLEN = '8'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'TABNAME'.
WA-COL_POS = '4'.
WA-FIELDNAME = 'TABNAME'.
WA-TABNAME = 'CDPOS_ITAB'.
WA-OUTPUTLEN = '5'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'FNAME'.
WA-COL_POS = '5'.
WA-FIELDNAME = 'FNAME'.
WA-TABNAME = 'CDPOS_ITAB'.
WA-OUTPUTLEN = '7'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'CHANGING'.
WA-COL_POS = '6'.
WA-FIELDNAME = 'CHANGING'.
WA-TABNAME = 'CDPOS_ITAB'.
WA-OUTPUTLEN = '1'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'VALUE_NEW'.
WA-COL_POS = '7'.
WA-FIELDNAME = 'VALUE_NEW'.
WA-TABNAME = 'CDPOS_ITAB'.
WA-OUTPUTLEN = '5'.
APPEND WA TO HEADER.
CLEAR WA.
WA-SELTEXT_L = 'VALUE_OLD'.
WA-COL_POS = '8'.
WA-FIELDNAME = 'VALUE_OLD'.
WA-TABNAME = 'CDPOS_ITAB'.
WA-OUTPUTLEN = '5'.
APPEND WA TO HEADER.
CLEAR WA.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'CDPOS_ITAB'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = HEADER[]
EXCEPTIONS
IF SY-SUBRC <> 0.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = HEADER[]
TABLES
T_OUTTAB = CDPOS_ITAB[]
IF SY-SUBRC <> 0.
ENDIF.Your select querry on MARC is not matching with MARC_TY.
The field in the MARC table and MARC_TY should be same.
and also, when you are making select querry on CDPOS table
with all entries.
When ever you are using all entries select statement, you should check whether the internal table is having value.
you should check
if CDPOS_IT[] is not initial.
SELECT OBJECTCLAS
OBJECTID
CHANGENR
TABNAME
FNAME
CHNGIND
VALUE_NEW
VALUE_OLD
FROM CDPOS INTO CORRESPONDING FIELDS OF TABLE CDPOS_ITAB
FOR ALL ENTRIES IN CDHDR_ITAB
WHERE OBJECTCLAS = CDHDR_ITAB-OBJECTCLAS
AND OBJECTID = CDHDR_ITAB-OBJECTID
AND CHANGENR = CDHDR_ITAB-CHANGENR
AND TABNAME = 'MARC'
AND FNAME IN ('MINBE','EISBE','MABST','LVORM')
AND CHNGIND = 'U'.
endif.
Regards
Madhan D -
Run-time error '1004' Application-Defined or object-defined error
Hello friends,
My requirement is to make the cells under Columns Actual, forecast and target (Dimesnion Category) Locked.
I've used various methods like GetOnlyRange but it didnt work.
Now, i've selected all the cells of the sheet, where user can input and made them unlocked. ( from Right-click>FormatCells>Protection tab-->Locked checkbox unchecked)
Then, go to "review" tab, click "Allow Users to edit Ranges",-> Protect Sheet---> ticked "Unlocked Cells"
Then go to WorkBook Options and set a password for the worksheet.
But on expand, I'm facing Run-time error '1004' Application-Defined or object-defined error.
Please help.
Please help.Hi,
I think that is VBA Runtime error, you can fix these errors by downloading in various sites.
http://www.articlesbase.com/data-recovery-articles/vba-runtime-error-1004-application-defined-or-object-defined-error-fix-these-errors--1339060.html
You can try with the above link. I hope this could solve your problem.
Regards,
B.S.RAGHU -
Error while creating pivot table in recording macro
im getting error " Run time error 1004: unable to get the pivottables property of the worksheet class
below is the code
Sub Macro16()
' Macro16 Macro
' Keyboard Shortcut: Ctrl+t
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Premium Data!R1C1:R25000C11", Version:=xlPivotTableVersion14). _
CreatePivotTable TableDestination:="", TableName:= _
"PivotTable14", DefaultVersion:=xlPivotTableVersion14
Sheets("Premium Pivot").Select
Cells(2, 2).Select
With ActiveSheet.PivotTables("PivotTable14").PivotFields("RM")
.Orientation = xlRowField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable14").AddDataField ActiveSheet.PivotTables( _
"PivotTable14").PivotFields("KL"), "Sum of KL", xlSum
End SubYou have TableDestination:="" which means you are not specifying a destination and therefore a new sheet gets created and it becomes the active sheet. You are selecting Sheets("Premium Pivot") which will not
have the pivot table and the remainder of the code references the ActiveSheet.
Either delete the line Sheets("Premium Pivot").Select or set the table destination like the following.
TableDestination:="'Premium Pivot'!R3C1" (Note the single quotes around the sheet name that contains a space. Edit the range on the destination to suit your requirements.)
Regards, OssieMac -
Error when creating pivot table in BI publisher template
When I try to create a chart or pivot in BI publisher it keeps throwing error
'Please load Datasource first'
It allows me to create table so I am not sure why is complaing when creating a pivot.Hi
This error you are getting while creating RTF template right?
yes, before proceeding to use the columns you need to load the XML data of your data model into your template
1. Open Microsoft Word.
2. From the Oracle BI Publisher menu, select Log On.
3. Enter your BI Publisher credentials and the URL for the BI Publisher server. (Contact your system administrator if you do not know the URL.)
4. The Open Template dialog presents the same folder structure as your BI Publisher Reports home page. Select the report for which you want to build a template.
5. Select Open Report to load the data to the Template Builder; or double-click <New> in the Layout Templates pane.
Note that any existing templates will be listed in the Layout Templates pane.
select <New> in Layout template section than select Open layout tempate to get automatically load your data into template..
ELSE
do manually,
in publisher,
after saving your report go to view the report
select data template and import that to your local drive.
now in your MS-Word.. in bi publisher toolbar
you find Data option, then select the load xml and give that path...
after this you can carry on creating charts or tables..
Hope this is what you want..
Thanks & Regards
Kishore Guggilla -
Hi,
One of our users encountered this problem with Excel 2013 while creating pivot tables, particularly with large files. We tried to modify Virtual Memory
of the pc but error still persist. Why does this happen and how can we resolve this? Thanks.
Another error message encountered by the user, this time when opening large files. The files she tried to open are working fine in 2010. But when opened in 2013, it prompted : "There
isn't enough memory to complete this action. Try using less data or closing other applications."Hi,
In regarding of the issue, please provide us more information to assist you better.
Did your user using the Excel 2013 and Excel 2010 with same PC? If not, please let me know the both of the 2 PCs' hardware list/Windows operation system info.
Did you using Excel 2013 32bit version and Excel 2010 64bit version?
General speaking, this issue usually occurs with Office 2013 32 bit version. It has a limitation of 2Gb of memory that can be used by its process. And the 64-bit Excel can handle larger workbooks.
Thus, if your user using 32bit Excel, I recommend try 64bit Excel instead.
Here is a similar issue, we also could try it:
http://answers.microsoft.com/en-us/office/forum/office_2007-excel/excel-cannot-complete-the-task-with-available/d31b1822-ebde-4c9b-8d11-e54bb652847d
If you have any update, please feel free let us know.
Regards,
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
Runtime error while putting negative value in to table control field
Hi Guys,
I am working on a Table Control which has Currency
and quantity fields.In PBO when the program is trying put a
negative value then It is going into a runtime error.
The Error description is,
Runtime errors DYNPRO_FIELD_CONVERSION
Error analysis
The program flow was interrupted and could not be resumed.
Program "SAPMZDBPRJCTEDFIG" tried to display fields on screen 0100. However, an
error occurred while this data was being converted.
How to correct the error
A conversion error occurred while the program was trying to display data on the screen.
The ABAP output field and the screen field may not have the same format.
Some field types require more characters on the screen than
in the ABAP program. For example, a date field on a screen needs
two characters more than it would in the program. When attempting to
display the date on the screen, an error will occur that triggers the
error message.
Screen name.............. "SAPMZDBPRJCTEDFIG"
Screen number............ 0100
Screen field............. "ZDB_PROJCTD_FIG-ZWORKDONE"
Error text............... "FX015: Sign lost." Further data:
I have tried increase the screen field length to more than the ABAP program field length and the scrren field name is of data type which supports signed value.
But still I am getting the error.the error is 'Sign is lost'.
I would appreaciate if you can help me with this.
Correct answer will be rewarded.
Thank you in advance,
Sanujit AcharyaCheck The Forum
Re: PA-BN : "FX015: Sign lost." dump
Kanagaraja L
Maybe you are looking for
-
ERROR IN ESS AND MSS pages when deleting the superadmin role
hi all According to my clent requirement i have worked with uwl for leave request.....for that i configured uwl and added uwl iview to the standard user role......after i have assigned standard user role to my manager. but' after some time they told
-
How do I authorize my computer to rent movies?
How do I authorize my computer to rent movies?
-
Invoke a command-line from java
Hello! I wonder if there' s a way to invoke a command or running an .exe file from java code. 10X, Yaron
-
OracleConnection .Open() hangs
Hi All, First time posting here. I have a scheduled script which connect to around 200 Oracle databases and retrieve some records. sometimes, there is an Oracle db which when trying to connect it will hang the script until I manually stop it; I try t
-
If anyone can do this for me they will get the 10 duke points plus I will post another message with that persons name in the description and when they reply I will give them another ten. Please please help!!!!!! I have a question which I am so stuck