Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am developing in ABAP.
I have a requirement to trigger a custom event in an ABAP Z-program.
Can anyone pls tell me how can I call a custom event in a Z-program to send an email.
(please note: It is not workflow, I need to complete this task in the Z-program).
Your description is a little vague, so in general if you talk about a button to press and a following action that is to be triggered you may need to:
define a button for the Application Toolbar in GUI-Status with a custom function code that is used when the button is clicked
add a gloabl general attribute with "type of screen element" = OK to the dynpro screen's element list
check this global attribute in the PAI module for the custom function code value and then perform/call your sendEmail function
You should create your custom event within transaction SM62. At your program, you call the function module BP_EVENT_RAISE, to raise your custom event. "eventid" is the name of the event you created previously at SM62.
Use the following code example to send an email in ABAP z-program code, via calling function module SO_NEW_DOCUMENT_SEND_API1 (SAPoffice: Send new document):
* Data Declarations
DATA: LT_MAILSUBJECT TYPE SODOCCHGI1.
DATA: LT_MAILRECIPIENTS TYPE STANDARD TABLE OF SOMLREC90 WITH HEADER LINE.
DATA: LT_MAILTXT TYPE STANDARD TABLE OF SOLI WITH HEADER LINE.
* Recipients
LT_MAILRECIPIENTS-REC_TYPE = 'U'.
LT_MAILRECIPIENTS-RECEIVER = 'sheetal#gmail.com'.
APPEND LT_MAILRECIPIENTS .
CLEAR LT_MAILRECIPIENTS .
* Subject.
LT_MAILSUBJECT-OBJ_NAME = 'TEST'.
LT_MAILSUBJECT-OBJ_LANGU = SY-LANGU.
LT_MAILSUBJECT-OBJ_DESCR = 'Mail Subject'.
* Mail Contents
LT_MAILTXT = 'This is a test mail'.
APPEND LT_MAILTXT. CLEAR LT_MAILTXT.
* Send Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = LT_MAILSUBJECT
TABLES
OBJECT_CONTENT = LT_MAILTXT
RECEIVERS = LT_MAILRECIPIENTS
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
IF SY-SUBRC EQ 0.
COMMIT WORK.
* Push mail out from SAP outbox
SUBMIT RSCONN01 WITH MODE = 'INT' AND RETURN.
ENDIF.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Issue: If I call with valid parameter I get a whole lot of results I should not.
So, while it seems aware of parameters, they're not used as I would expect.
If I call with no parameter at all I get an error there is no such function, so that's expected.
If I call with valid parameter I get a whole lot of results I should not.
So, while it seems aware of parameters, they're not used as I would expect.
Workaround: I can be redundantly specific with a where clause, but I know there's something I'm missing here. I expect to pass a territory id and get ONLY results for that territory id. I'm getting all territories right now.
select * from by_territory_id('TER-123') where territory = 'TER-123';
Of course I want to simply do the following, as that is what wrapping this in a function is for:
select * from by_territory_id('TER-123');
If anybody can see what is wrong here please point it out? The parameter is supposed to be used in the WHERE clause of this function:
CREATE OR REPLACE FUNCTION by_territory_id (territory_id char)
RETURNS TABLE (customer_id char, territory char, scan_id int, scan_status iol.consignment_audit_scan_status) AS $$
select distinct con.customer_id, cus.primary_territory stm_territory, cas.id, cas.status
from iol.consignment con
join iol.products prod
on con.description = prod.description
join iol.customers cus
on con.customer_id = cus.customer_id
left join iol.territories_and_roles tr
on cus.primary_territory = tr.territory_id
left outer join iol.consignment_audits_scan cas
on cus.customer_id = cas.customer_id
where prod.lvl3_id in ('PREMIUM', 'STANDARD')
and tr.role = 'STM' and cus.primary_territory = territory_id
order by cas.id
$$ LANGUAGE SQL;
EDIT: Two down votes saying I'm not clear enough at the point of this edit. All the same, the one answer is correct. I hope it is okay that I really just needed eyes on this and I believe somebody else will run into the exact same issue, so rather than expand on the above I'm going to leave it be because the issue was indeed the name of my parameter (and PG gave no complaint or indication).
Looks like one of your tables has a column named territory_id, and that is what is getting invoked by you unqualified reference. You can qualify it with the function name:
and tr.role = 'STM' and cus.primary_territory = by_territory_id.territory_id
Or better yet change the spelling of the parameter so that it is distinct.
I have google sheet where i would like to have an email notification been sent to a specified user whenever a cell in particular column has been edited.
The sheets contains 15 columns and one of the column is for comments and another for email address.
My requirement is whenever any cells in the comment column is edited, I would like to have an email sent to email address mentioned in a different column of the same sheet.
I did went over few of thread and found this thread had similar problem and has been successfully answered with a code. However, when i used this script it gives a a "Cannot read property 'range' of undefined (line 2, file "Code")" message.
I'm a noob to coding and not sure what does that means.
I also tried Magic Cell Notification addon but to no avail.
Any help will be greatly appreciated.
Send Email
You need to create an installable trigger for onMyEdit.
You need to provide the sheet name, the emailColumn, the commentColumn, the startingRow for data, the and the subject.
And please realize that you can't call this function from the script editor as it requires the event block from the onedit trigger.
`
function onMyEdit(e) {
var sh=e.range.getSheet();
if(sh.getName()!='Your Sheet Name')return;
var emailColumn=1;//you have to tell me what column the email is on
var commentColumn=2;//you have to tell me what column the comment is on
var startingRow=2;//you have to tell me what row the data starts on
var subject='You tell me what the subject is';
if(e.range.columnStart==emailColumn && e.range.rowStart>startingRow && e.value) {
GmailApp.sendEmail(sh.getRange(e.range.rowStart,emailColumn).getValue(), subject, sh.getRange(e.range.rowStart,commentColumn));
}
}
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
For my project, I am trying to read data from Wikipedia, I am not completely sure, how I can do that.
My main concern is to read, date, location and subject of event.
For a start, I have started reading above mentioned information for 91st academy awards.
I tried using Wikipedia query service, but it didn't helped much.
Then I came across API solution and ran following URL,
https://en.wikipedia.org/w/api.php?action=parse&format=json&prop=sections&page=91st_Academy_Awards
But didn't found the information what I was looking for.
I am trying to read the information marked in red box in below image,
Can somebody help me with this and let me know how can I read the above mentioned section.
PS:I am using Matlab for writing my algorithm
A possible solution is to read the webpage using webread, and process the data using the functions from the Text Analytics Toolbox:
% Read HTML data.
raw = webread('https://en.wikipedia.org/w/api.php?action=parse&format=json&prop=text&page=91st_Academy_Awards');
% Specify sections of interest.
SectionsOfInterest = ["Date","Site","Preshow hosts","Produced by","Directed by"];
% Parse HTML data.
myTree = htmlTree(raw.parse.text.x_);
% Find table element.
tableElements = findElement(myTree,'Table');
tableOfInterest = tableElements(1);
% Find header cell elements.
thElements = findElement(tableOfInterest,"th");
% Find cell elements.
tdElements = findElement(tableOfInterest,"td");
% Extract text.
thHTML = thElements.extractHTMLText;
tdHTML = tdElements.extractHTMLText;
for section = 1:numel(SectionsOfInterest)
sectionName = SectionsOfInterest(section);
sectIndex = strcmp(sectionName,thHTML);
% Remove spaces if present from section name.
sectionName = strrep(sectionName,' ','');
% Clean up data.
sectData = regexprep(tdHTML(sectIndex),'\n+','.');
% Create structure.
s.(sectionName) = sectData;
end
Visualising the output structure:
>> s
s =
struct with fields:
Date: "February 24, 2019"
Site: "Dolby Theatre.Hollywood, Los Angeles, California, U.S."
Preshowhosts: "Ashley Graham.Maria Menounos.Elaine Welteroth.Billy Porter.Ryan Seacrest. "
Producedby: "Donna Gigliotti.Glenn Weiss"
Directedby: "Glenn Weiss"
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I'm using web2py forms, but I need to set up a limit for 20 users registration. How can I do it?
PS: Edit to make easy to understand
Thanks in advance.
Best regards!
Assuming you wish to limit registration to a maximum of 20 users and you are using the standard /default/user function from the scaffolding application:
In the default.py controller:
def user():
if request.args(0) == 'register' and db.auth_user.count() >= 20:
form = None
else:
form = auth()
return dict(form=form)
In the default/user.html view:
{{if form is None:}}
<p>Sorry, no more registrations allowed.</p>
{{else:}}
{{=form}}
{{pass}}
I'm currently working on a Database which requires the following functionality:
For example given a specific project, I have a series of structures which belong to that project, which are displayed in a datasheet view on the project form. I am attempting to allow the user to on double click to navigate to that specific structure which is displayed on another form. Currently I am using filters to implement this behavior, however, this results in the filter being left on, and when I manually turn off the filter, the form I switch to returns back to the first entry.
I am using the current code on the datasheet:
Private Sub struct_name_DblClick(Cancel As Integer)
LookupValue = Me.struct_ID
Form_frm_control.pg_structure.SetFocus
Form_frm_control.subform_structure.Form.Filter = "struct_ID = " & LookupValue
Form_frm_control.subform_structure.Form.FilterOn = True
End Sub
Any help would be greatly appreciated. Thanks in advance.
It all depends on what you need to do.
If you want to display all records and navigate to the selected record, then you can use bookmark navigation:
With Forms!MyOtherForm
.RecordsetClone.FindFirst "struct_ID = " & Me!struct_ID
If Not .RecordsetClone.NoMatch Then
If .Dirty Then
.Dirty = False
End If
.Bookmark = .RecordsetClone.Bookmark
End If
End With
This assumes that the other form is open with all the records loaded.
Another approach to this problem, which I find more useful for popup situations like this, is to just open the other form as a dialog and require it be closed before returning to the calling context. In that case, you'd do this:
DoCmd.OpenForm "MyOtherForm", , , "struct_ID = " & Me!struct_ID, , acDialog
You'd then have to close the other form to get back to the original context.
You might think that with large numbers of records this would be inefficient, but it's actually very fast, as this operation is highly optimized within Access (moreso than filtering an already open form, in fact).