Find out formname and progname from EXPORT statement? - abap

This maybe sound like a silly question but: I've got this Line in my Code:
It's part of a piece of code I found online, to edit fields using CL_SALV_TABLE.
EXPORT formname FROM 'OPEN_FIELDS_FOR_EDITING' progname FROM sy-repid TO MEMORY ID 'CL_SALV_TABLE'.
So, "formname" is the name of my script, right? But what is "progname"? And where do I find this name?

A more sensible way of formatting the code would be
EXPORT formname FROM 'OPEN_FIELDS_FOR_EDITING'
progname FROM sy-repid
TO MEMORY ID 'CL_SALV_TABLE'.
If you check the keyword documentation that is available through F1 in your system as well as online, you will see that both formname and progname are just names.

The formname is the name of a form within a report. The progname is the name of a report. Have a look at the system variables to understand what sy-repid is.
Forms are subroutines you can use to separate different parts of a report.
You might find this helpful:
https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenabap_subroutines.htm

Related

VBA DIM a string of TEXT to use as part of a value

I am trying to calculate an abbreviation based on a combobox value to use it as part as a value in another module and for some reason the value doesn't transfer to another module at all.
I have it declared as
Public MachineLetter As String
Above the module in which an if function finds what the actual string should say.
But when I try to reference this MachineLetter in another sub, it doesn't show up. I did try to do the dim and if function inside the actual module in which I currently need it and it did work. So I wonder what's the problem?
Could someone help me finding a solution to this problem?
Check where you've declared MachineLetter, it should be declared in a standard module.
Also, make sure you you haven't accidentally declared it more than once, for example in a function/sub. If you do that then it's value will be 'hidden'.
Finally, make sure you are actually setting it's value.
I tested and no problem. When something fells strange try to put a breakpoint to see better the problem.

Can I make a sub-routine from a text file

I don't think is possible but I just wanted to check if someone knew better. Basically, I don't want to store a sub-routine in the code itself but in a text file and then, I guess, import that and have it run as if it were a sub-routine.
So, the file would look like this:
Private Sub AutoRunsWinsockProvidersTranslation()
AutoRuns.AutoRunsWinsockProviders(Me)
AutoRuns.AutoRunsWriteData(True, "Winsock Providers")
End Sub
And it would be saved as, say, AutoRunsWinsock.txt. I want to know if I could import that somehow at run-time and then reference that sub-routine name or not. I suspect the answer is no but want to check.
The reason for this, by the way, is that then I could write a lot of txt files for different bits I'd want out of my other code without having to include them all before publishing the app.

VBA: Add to a UserForm's Title with current text already as caption

Good Evening,
I am having trouble with some VBA code. I need the add the Userform's Caption, with text already in place. This is for a application I'm writing which opens a file, and once the file has been opened, it will add the file name to the end of the UserForm's caption. For example:
Program Name: [File Name]
I wouldn't where to start really, which is why I'm here, but I think it might be something like
UserForm1.caption = "Program Name" + file.name
I don't know if this is really possible, but I would greatly appreciate some help
Cheers
Yes it' possible. I think a couple more steps needed
On open of application
logic example / not code:
Pub WriteFileName ()
Range("A:10")
End Sub
For the above, adaptable code example here : How to extract a file name from its path in vba
Then write another macro reading that cell range as string
to your UserForm.Caption object i.e ="string" + range.("A10")

Finding a VBAS defnied Named Range definition

a valueI've inherited a large VBA project and whilst I have lots of dev expereince I have a small amount of VBA. The code reads data off a sheet in the form:
Intersect(Range("colName"), .Rows(intCurrentRow)).Value
Where colName is a named range, or so I thought. I have searched all of the project code and the excel sheets and cannot find where colName is defined ?
So far I have searched the code, looked in Name Manager on the sheet and have googled furiously but hit a total blank. As I now need to read in another value from the Sheet I would really prefer to use the code that is currently used with another value instead of colName to reference my new data field.
Is there anything obvious I'm missing ?
Edits:
activesheet.range("colName").address gives a value of "$L:$l"
Its probably a hidden name.As Doug Glancy said, you can unhide it using VBA
Activeworkbook.Names("colName").Visible=True
If you are working with defined names you may find it useful to get My & Jan Karel Pieterse's Name Manager addin which (amongst many other things) handles hidden names. download from
http://www.decisionmodels.com/downloads.htm
It could be a hidden Name. Try:
ActiveWorkbook.Names("colName").Visible=True

VB.net VS2010: Dynamic object type that changes to match class name

I tried to search a bit before asking but I really had no idea what to search for on this one so here's what I'm looking for:
I need a way to declare an object in VB.net so that I can set it to the current class(using the class as the object type) but if the class name changes then the object type changes to match the new class name. Here's an example.
Class UhhWhat
Dim L As List(Of UhhWhat)
Sub add()
L.Add(Me)
End Sub
End Class
So if this were my code and someone copied it to a new class with a different name say... "UhhNo" then I would want the "List(Of UhhWhat)" to change to "List(Of UhhNo)".
Does that make sense? I'm not really stuck on having the name for the object type, I just want something that will function like the List object's Of T but use the current class' type rather than a type supplied to a subroutine.
I would like this done when the code is written, not at runtime because I need intellisense to continue to function for the new type.
Lastly, I do know that simply using "List(Of Object)" would help my problem.. however this will not work for intellisense and I have heard that declaring an object as "object" type is slower than if you declared it as a specific type.
To sum it up what I'm looking for is a way to change the object type to whatever the programmer changes the class name to, automatically.
Thx a bunch :)
--EDIT--
I found the solution I was looking for in a rather simple place.. the VS rename function.. ahh another time when the answer was so simple.
Kudos to David W for their patience with me, thx a bunch David W!
I hope i didn't bug ya too much with my vague ideas :)
I appreciate the suggestions :)
In Solution Explorer, when you rename a class file, Visual Studio will fix the corresponding class names accordingly.