READ REPORT for global classes? - abap

I tried READ REPORT for global class but it's not working. I need to read global class' source code into table.
I found SEO_METHOD_* FM, but those only returned metadata about class, not its source code.
Is there any FM or method similar to READ REPORT but for global classes ?
Thank you for your help.

All ABAP code is stored in the table REPOSRC, reports, function modules, class pools, etc., in "include programs". This table may only be read via the ABAP statement READ REPORT.
You need to know what are the names of these include programs for a class pool.
For a class pool named ZCL_X, the ABAP source code is stored in these include programs:
ZCL_X=========================CS : this include contains the whole source code, but only if it has been changed via the source-based editor or via Eclipse ADT.
ZCL_X=========================CP : main code, which lists all or most of next include programs
** NB: CP starts always at the 31st character, all characters between class name and 31st character are to be replaced with =. Example: if the class pool is named ZCL_XXXXX, the include is named ZCL_XXXXX=====================CP.
ZCL_X=========================CU : public section
ZCL_X=========================CI : private section
ZCL_X=========================CO : protected section
ZCL_X=========================CM+++ : methods
** +++ is a 3-characters code corresponding to a method as defined in table TMDIR. The column METHODNAME contains the method name and METHODINDX contains an integer used to build +++, examples:
** 1 to 9 : 001 to 009
** 10 to 35 : 00A to 00Z
** 36 to 45 : 010 to 019
** 46 to 71 : 01A to 01Z
** 72 to 81 : 020 to 02Z
** etc.
ZCL_X=========================CCDEF : local class definitions
ZCL_X=========================CCMAC : macros
ZCL_X=========================CCIMP : local class implementations
ZCL_X=========================CCAU : local test classes
and more ...

Use CL_RECA_RS_SERVICES, method GET_SOURCE like this:
CALL METHOD cl_reca_rs_services=>get_source
EXPORTING
id_objtype = 'CLAS'
id_objname = 'CL_SALV_BS_RUNTIME_INFO'
IMPORTING
et_source = DATA(source)
EXCEPTIONS
not_found = 1
others = 2
.

Related

How to prevent #Rollback in a specific method?

I'm doing tests using Spock in Grails 3. A particular test case is breaking because Grails is speaking to my database in two different sessions in this case. My spec is annotated with #Rollback, to rollback all changes made with each test.
Is there a way to disable #Rollback for this one method, then after the test is complete, manually rollback the changes?
Update
A stripped down example of my test spec is below:
#Log4j
#Integration
#Rollback
class PublicationReportBreakingSpec extends Specification {
#Unroll
#Rollback
void "Invalidate #type object and check not in report"(type, status, hits, expect)
{
//We want to roll back the changes made to the publication after each pass.
given: "Find a valid #type publication"
//Finding publication which is Read (valid, should appear in report)
final Publication pub = getSinglePub(type, status, hits)
//Set publication to be Unread (invalid, shouldn't appear in report)
when: "The #type publication is altered to fail"
pub.setStatus('Unread')
pub.save(flush:true, failOnError: true)
then: "Check the properties match the test case"
pub.status = 'Unread'
//Generate report of read publications
when: "The report is run"
def resp = PublicationController.reportReadPublications()
//Make sure report doesn't contain the publication
then: "Check for expected result #expect"
checkReportExpectedResult(resp, expect)
where:
clause | type | status | hits || expect
"Book is unread" | 'Book' | 'Read' | 1200 || 0
"Article is unread" | 'Article' | 'Read' | 200 || 0
}
//Checks report for expect value
public void checkReportExpectedResult(resp, expect){...}
//Returns single publication based on passed in parameters
public Publication getSinglePub(type, status){...}
}
The stacktrace for the error is:
<testcase name="Testing breaking domain class changes. Book is unread" classname="com.my.project.PublicationReportBreakingSpec" time="118.216">
<failure message="java.lang.IllegalStateException: No transactionManager was specified. Using #Transactional or #Rollback requires a valid configured transaction manager. If you are running in a unit test ensure the test has been properly configured and that you run the test suite not an individual test method." type="java.lang.IllegalStateException">java.lang.IllegalStateException: No transactionManager was specified. Using #Transactional or #Rollback requires a valid configured transaction manager. If you are running in a unit test ensure the test has been properly configured and that you run the test suite not an individual test method.
at grails.transaction.GrailsTransactionTemplate.<init>(GrailsTransactionTemplate.groovy:60)
at com.my.project.PublicationReportBreakingSpec (Removed due to sensitivity)
at com.my.project.PublicationReportBreakingSpec (Removed due to sensitivity)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at grails.transaction.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:96)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at grails.transaction.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:93)
at com.my.project.PublicationReportBreakingSpec.Invalidate #type object and check not in report. Check #clause, publication type #type(PublicationReportBreakingSpec.groovy)
According to the Javadoc annotating the test with #Rollback(false) should do the trick.
It might be an issue if #Rollback(false) is not working...
As a workaround, the annotation can be put at method level too. So remove the annotation from your test class and put it on your test methods, except the one you don't want to rollback. Then add a cleanup: section in that spec to cleanup the data you created.
If you are not interested in rolling back your changes, you don't want to use a transaction... therefore you can skip the transaction in THAT method. You can do it using #NotTransactional.

error : can't read .... no such variable in TCL script using "after"

I am working in a TCL automation environent at my workplace.
I'm trying to run a delayed command in my script using "after".
The problem i encounter is that when i try to specify commands with variables inside a code block under an "after" , the vars are not recognized and i get an error message.
I'll quote the relevant parts of the code.
proc test_script1 {{bh0 0} ...more vars....} {
.
.
.
after [expr 20000] {
set some_value[ ns1::probe_TCP_connections $bh0 $main_duration 1 15] }
puts "the value i got is $some_value"
}
And i seem to get an error:
can't read "some_value": no such variable
Can anyone suggets what is the problem , and how to oversome it?
thx
You can capture the values of local variables with the help of apply (and it's advisable to use list to build callbacks when they get even slightly non-trivial). Since the body of an apply is a lambda expression with its own scope — a little nameless procedure — you have to use global in it to access state that will persist, and in any case after callbacks are called from the global namespace always (since the mechanism doesn't know how to keep arbitrary stack frames around for the duration of the asynchronous operation).
after 20000 [list apply {{bh0 main_duration} {
global some_value
set some_value [ns1::probe_TCP_connections $bh0 $main_duration 1 15]
}} $bh0 $main_duration]
global some_value
vwait some_value
puts "The value was changed to $some_value"
It's possible to get even more sophisticated, especially in Tcl 8.6 which has a coroutine system that can be used to hide the complexity of using continuation passing style programming.
Here is a proc that will do something similar to what you're trying to do:
proc foo {} {
# Make 'a' available to both the global scope and local scope
global a
# This is to check the current level
puts "Current level: [info level]"
# The command to be run in 500 ms, and I have added another check for the level
after 500 {puts "Current level: [info level]"; set a 100}
# Wait for further execution until the global variable 'a' changes
vwait a
# Prints a
puts "Value of \$a: $a"
}
The output of the above will be:
Current level: 1
# After 500 ms, the below will print
Current level: 0
Value of $a: 100
When you use after, the variable a is being created in the global scope, that is not accessible to the proc unless explicitly given access. One of the simplest ways is to first make sure that a within the proc is accessible both globally and locally, with global (level 0).

How do I determine what a Crystal Reports function does?

I have a custom crystal report which retrieves invoices from a database. There is a formula in the report that has the following code:
V6AttachmentsGetAttachment ({Command.AttachmentID},{?ReportAttachmentChannel} )
From my understanding, the formula has a function called 'V6AttachmentsGetAttachment' which takes two parameters (the first is a report field and the second is a report parameter).
This calculates a dynamic hyperlink.
How can I determine how exactly this is calculated? I am trying to figure out if I can replicate this calculation in SQL.
Is V6AttachmentsGetAttachment something that is stored in the SQL database? I can not find any references to it in Crystal Reports.
This is a custom function created by Viewpoint Construction Software (V6). It is used to connect with Construction Imaging, a document management system, to return images of things like invoices.
I believe the custom function is available if you have the Viewpoint client installed.
It could either be a custom function or one contained in a user-function library (UFL).
Custom Function
Edit a formula (any formula will do)
Assuming that it is a custom function, it will be listed below the Report Custom Functions node:
UFL
If this function is contained in a user-function library (UFL), you should see it listed in the Function tree:
u252000.dll contains a single function DateTimeto2000().
If this is the case, then you will need to locate the source code for the UFL.
CRUFLE and CRUFLV6 are viewpoint dlls. They are registered as global access controls using regasm. Crystal reports can then access the functionality within the dll.
https://support.viewpoint.com/s/knowledgedetail?c__urlname=Issue-109356-Error-when-running-crystal-reports-via-remote-access-not-VRL-UFL-u212com-dll-or-u2lcom-dll-that-implements-this-function-is-missing
CRUFLE and CRUFLV6
file version 22.2.0.716
I use crystal reports 2016, 32 bit
I downloaded the 32 bit crufle.dll and cruflv6
I copied the crufle.dll and cruflv6 to C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win32_x86
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\regasm.exe crufle.dll
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\regasm.exe cruflv6.dll
regedit and search for the crufle and cruflv6 ensuring there were no other versions register. The u2lcom.dll error message was misleading because the dll is loaded from C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win32_x86. you can see u2lcom.dll is loaded in the crystal report about-> more info which shows the loaded modules.
dumpbin will show that u2lcom.dll is loaded and availabe
dumpbin /EXPORTs u2lcom.dll
Section contains the following exports for U2LCOM.dll
00000000 characteristics
5A54B943 time date stamp Tue Jan 9 05:44:51 2018
0.00 version
1 ordinal base
15 number of functions
15 number of names
ordinal hint RVA name
3 0 00005670 InitPerThread
4 1 00005680 IsThreadSafe
5 2 000056A0 UFCallCOMFunction
6 3 000056C0 UFEndJob
7 4 000056F0 UFErrorRecovery
8 5 00005720 UFGetFunctionDefStrings
9 6 00005730 UFGetFunctionExamples
10 7 00005740 UFGetFunctionTemplates
11 8 00005750 UFGetVersion
12 9 00005760 UFInitialize
1 A 00005610 UFSetPreferredViewingLocale
2 B 00005630 UFSetProductLocale
13 C 000057E0 UFStartJob
14 D 00005810 UFTerminate
15 E 00005860 UninitPerThread
Summary
1000 .data
1000 .gfids
4000 .rdata
1000 .reloc
1000 .rsrc
8000 .text

ConnectionString' is not a member of .My.MySettings' in DataSet.Designer.vb After deleting unused connectionstring

I deleted an unused connectionstring and now I have wasted a lot of hours trying to get it back to work. Cause the rest of the program worked like a char and the connectiontring was never used I was working on another database.
Error 1 'dbGIPEXConnectionString' is not a member of
'GIP_Eindwerk.My.MySettings'. D:\GIP\GIP+Eindwerk\GIP+Eindwerk\dbGIPEXDataSet.Designer.vb 2544 47 GIP+Eindwerk Error 2 'dbGIPEXConnectionString' is not a member of
'GIP_Eindwerk.My.MySettings'. D:\GIP\GIP+Eindwerk\GIP+Eindwerk\dbGIPEXDataSet.Designer.vb 2957 47 GIP+Eindwerk Error 3 'dbGIPEXConnectionString' is not a member of
'GIP_Eindwerk.My.MySettings'. D:\GIP\GIP+Eindwerk\GIP+Eindwerk\dbGIPEXDataSet.Designer.vb 3583 47 GIP+Eindwerk Error 4 'dbGIPEXConnectionString' is not a member of
'GIP_Eindwerk.My.MySettings'. D:\GIP\GIP+Eindwerk\GIP+Eindwerk\dbGIPEXDataSet.Designer.vb 3901 47 GIP+Eindwerk
All the errors lead to a code that looks like
Private Sub InitConnection()
Me._connection = New Global.System.Data.OleDb.OleDbConnection()
Me._connection.ConnectionString = Global.GIP_Eindwerk.My.MySettings.Default.dbGIPEXConnectionString
End Sub
I've tried removing
<Connection AppSettingsObjectName="MySettings" AppSettingsPropertyName="dbGIPEXConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="dbGIPEXConnectionString (MySettings)" PropertyReference="ApplicationSettings.GIP_Eindwerk.My.MySettings.GlobalReference.Default.dbGIPEXConnectionString" Provider="System.Data.OleDb" />
in the dbGIPexdataset.xsd.. Didn't change anything.
Cleaning the project also changed nothing.
I would suggest that you simply delete your Data Source and create a new one. You would have to add instance of the DataSet and table adapters back to forms in the designer but any of your own code will just continue to work as long as the names are still the same.

Coldfusion 8 -> 9 update, functions no longer working

HELP!!
Just migrating a site from one server to another, the coldfusion version is changing from cf8 to cf9 [linux/centos]
this code used to work before:
cfinclude('../SQL/contact.sql.cfc');
form.phone = unFormatPhone(form.phone);
contactID = InsertContact(form);
In the included file is:
<cfcomponent output="false" >
<!--- -------------------------------- insert -------------------------------- --->
<cffunction name="InsertContact" returntype="numeric" output="false" access="public" >
now I get an error when browsing the pages:
Variable INSERTCONTACT is undefined.
The error occurred in /var/www/vhosts/xxxxxx.com/httpdocs/Assets/XHTML/buy-my-car.cfm: line 54
Called from /var/www/vhosts/newride.ca/httpdocs/Application.cfc: line 232
Called from /var/www/vhosts/newride.ca/httpdocs/Application.cfc: line 230
Called from /var/www/vhosts/newride.ca/httpdocs/Application.cfc: line 162
52 : cfinclude('../SQL/contact.sql.cfc');
53 : form.phone = unFormatPhone(form.phone);
54 : contactID = InsertContact(form);
55 :
56 : //insert vehicle with app id
What is going on here? the included file is being found, is there some difference between the two versions that is causing this?
Are you sure its being included? try:
include "../SQL/contact.sql.cfc";
form.phone = unFormatPhone(form.phone);
contactID = InsertContact(form);
Well, I'll say first off that I've only worked with CF9, so I can't comment on what you used to be able to do in CF8. But, in CF9 I'm pretty sure you cant use a CFC that way. The closest thing to what you're doing would be transient invocation using <cfinvoke>. See here: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7db3.html
But, also look at instantiating the cfc as an object and then calling methods on that object. I like doing it that way as it reminds me of other languages such as Java and C#.