Show the warning message upon outbound delivery item deletion in VL03N? - abap

I am trying to find a way of implementing the new warning message window in the standard transaction when the user tries to delete Item on Item Overview window.
Right now there is a standard warning window with "Delete selected item(s)? Y/N" question and after that, my custom window should occur.
Because it is the standard transaction, I am not sure about the way of implementing that task. Should I look at enhancement or some other ways?
After exploring the code through the debugger, I found the line in which warning window is showed, Am I allowed to put mine part of code after call function for the first warning window?
The path is SAPMV50A -> MV50AF0F_FUNKTION_AUSFUEHREN -> call functioin FUNKTION_AUSFUEHREN (after line 65)

Use can use method CHECK_ITEM_DELETION or ITEM_DELETION of BadI LE_SHP_DELIVERY_PROC for showing your warning, here the official doc:
This method is called before a delivery item is deleted. You can use this method to perform checks to see whether an item can be deleted, and if necessary, to then prevent deletion of a delivery item.
DATA: lf_error TYPE abap_bool.
delete_item(
EXPORTING
is_xlips = is_xlips
if_check_only = abap_true
CHANGING
cf_error = lf_error
ct_log = ct_log
).
IF lf_error EQ abap_true.
cf_item_not_deletable = abap_true.
ENDIF.

I believe that the only way to add your customized message is by adding custom enhancement-point, and then implementing it with the message.
add an enhancement point where you need to implement the message
enhancement-point <enhancement> spots <spot>.
add an enhancement to this spot:
enhancement 1 <name>.
message 'my_msg' type 'W'.
endenhancement.

Related

Camunda : Set Assignee to all UserTasks of the process instance

I have a requirement where I need to set assignee's to all the "user-tasks" in a process instance as soon as the instance is created, which is based on the candidate group set to the user-task.
i tries getting the user-tasks using this :
Collection<UserTask> userTasks = execution.getBpmnModelInstance().getModelElementsByType(UserTask.class);
which is correct in someway but i am not able to set the assignee's , Also, looks like this would apply to the process itself and not the process instance.
secondly , I tried getting it from the taskQuery which gives me only the next task and not all the user-tasks inside a process.
Please help !!
It does not work that way. A process flow can be simplified to "a token moves through the bpmn diagram" ... only the current position of the token is relevant. So naturally, the tasklist only gives you the current task. Not what could happen after ... which you cannot know, because if you had a gateway that continues differently based on the task outcome? So drop playing with the BPMN meta model. Focus on the runtime.
You have two choices to dynamically assign user tasks:
1.) in the modeler, instead of hard-assigning the task to "a-user", use an expression like ${taskAssignment.assignTask(task)} where "taskAssignment" is a bean that provides a String method that returns the user.
2.) add a taskListener on "create" to the task and set the assignee in the listener.
for option 2 you can use the camunda spring boot events (or the (outdated) camunda-bpm-reactor extension) to register one central component rather than adding a listener to every task.

Runtime error "SYSTEM_ABAP_ACCESS_DENIED" when using SUBMIT via custom report

I am trying to use cl_salv_bs_runtime_info in order to get the ALV data in memory after using SUBMIT in a standard report.
The code for the above is:
REPORT ztest1.
FIELD-SYMBOLS <lt_pay_data> TYPE ANY TABLE.
DATA lr_pay_data TYPE REF TO data.
cl_salv_bs_runtime_info=>set(
EXPORTING display = abap_false
metadata = abap_false
data = abap_true ).
SUBMIT rfts7000
AND RETURN.
TRY.
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING r_data = lr_pay_data ).
ASSIGN lr_pay_data->* TO <lt_pay_data>.
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE `Unable to retrieve ALV data` TYPE 'E'.
ENDTRY.
cl_salv_bs_runtime_info=>clear_all( ).
When it is run the program rfts7000 runs and prompts for data selection.
After submitting the selection screen i get:
ST22 extract:
Any ideas?
After some research based on comments in the relative SCN Question the case is as follows.
The system is throwing this error in order to prevent me from running outdated and obsolete (or soon to be obsolete) programs.
The specific program that i call through SUBMIT, is part of the Cash Management (CM) module which although is still active in S4/HANA , i think that is going to be replaced.
So SAP Note 2392358 says exactly that: "According to the S/4HANA Simplification List, the totals tables of classic CM are completed eliminated and therefore they shall not be accessed any more."
In order for this protection to work, SAP has a blacklist where the programs are listed in order not to be used.
But there is a possible "backdoor" to that as explained in SAP Note 2249880. The backdoor is just a way to remove a program from the Blacklist.
The note suggests to get approval from SAP first and then to follow the steps to remove the program from the blacklist.
As a side note, i worry more that we have implemented cash management in an outdated module rather than worrying about the error after all...

Cumulocity using custom type properties in esper statements

I have a hard time using the properties of my custom types to write statements like contexts. For exemple, this is working:
create context TripContext
context PartionBySource
partition by source from EventCreated,
context ContextBorders
initiated by EventCreated(
type="c8y_SwitchPowerReport") as startEvent
terminated by EventCreated(
type="c8y_SwitchPowerReport") as endEvent;
However it's not enough and I need to check some of my custom properties to better define the context. I'd like to be able to do something like this:
create context TripContext
context PartionBySource
partition by
source,
getString(????, "customProp1"),
getNumber(????, "customProp2"),
...
from EventCreated,
context ContextBorders
initiated by EventCreated(
type="c8y_SwitchPowerReport",
getString(startEvent, "c8y_SwitchPower.newStatus") = "ON") as startEvent
terminated by EventCreated(
type="c8y_SwitchPowerReport",
getString(endEvent, "c8y_SwitchPower.newStatus") = "OFF") as endEvent;
I have no idea what to put instead of the ???? to make reference to the event. It's transparent for the "native" properties like source, time, type, etc. but as soon as there is a custom property, I have no idea how to access it.
As for the initiated/terminated syntax, there is something really weird I dont understand, but maybe it's more an Esper than Cumulocity problem. This is working:
terminated by EventCreated(
type="c8y_SwitchPowerReport",
getString(endEvent, "c8y_SwitchPower.newStatus") = "OFF") as endEvent
But this is not:
initiated by EventCreated(
type="c8y_SwitchPowerReport",
getString(startEvent, "c8y_SwitchPower.newStatus") = "ON") as startEvent
I got an error saying:
Failed to validate single-row function parameter expression 'startEvent': Property named 'startEvent' is not valid in any stream
Any insight would be appreciated.
I also couldn't find a quick way to get it run like you try.
But I would recommend the following approach. If you anyways relating heavily on custom fragments it makes sense to run the event through an additional stream that extracts this values:
create schema MyCustomEvent(
event Event,
myCustomString String,
myCustomNumber BigDecimal
);
insert into MyCustomEvent
select
e.event as Event,
getString(e, "myCustomString") as myCustomString,
getNumber(e, "myCustomNumber") as myCustomNumber
from EventCreated e
where getString(e, "myCustomString") is not null
and getNumber(e, "myCustomNumber") is not null;
Now you can easily create a context on MyCustomEvent instead on EventCreated.

BizTalk Receive binary file correlated on RecievedFileName

I'm having problem with routing a message of binary file to a running instance of an Orchestration using correlation of context property: ReceivedFileName. The correlation is initialized using a send with dummy file where in the Orchestration sets the ReceivedFileName context property of the message and the property gets promoted. After that routing fails of the message being received (as XmlDocument) and I can see that the ReveivedFileName context property of that message has not been promoted should it be like that? I cant figure out any way to get it promoted so I just want to make sure it should be like this.
The file names are identical but I noticed that the ReceivedFileName property of the send message doesn't have the path whereas the received message has path + file name. I have tried to add the path to the send message(sounds strange though, read it some where) but it doesn't change the outcome.
While you can set Context Proerties in an Orchestration, they are not Promoted.
You have to use the Correlation Technique described here to have the Properties Promoted when they hit the MessageBox: http://blogs.biztalk360.com/property-promotion-inside-orchestration/
Basically, you Initialize a Correlation Set based on the Properties you need Promoted.
As Ben Runchey pointed out in a comment above one have to resort to a custom pipeline and promote the FILE.ReceivedFileName there by calling:
messag.Context.Promote("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", receivedFileName);
I also removed the path from FILE.ReceivedFileName to only have the filename by calling the inmsg.Context.Read("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties")
and altered the value and wrote it back by calling:
inmsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", receivedFileName);

Get proper file notification using SCEvents (FSEvents wrapper )?

I had implemented file watcher part using SCEvents : https://github.com/mz2/SCEvents
Its notifying me changed in the form of event_id, event_path and event_flags. But how should I get information which event is raise. Its not giving any details like File created event occurs, File Renamed event occur etc.
How should i get proper information about which event is raised?
Please provide guidance. Thanks.
Use SCEventFlags.
if ((event.eventFlags & SCEventStreamEventFlagItemCreated) != 0)
{
//ItemCreated
}