When creating a new log object I want the subobject to be created on the fly if it doesn't exist yet.
This is what I have right now:
ls_log-object = mc_log_object.
ls_log-subobject = mv_log_subobject.
CALL FUNCTION 'BAL_LOG_CREATE'
EXPORTING
i_s_log = ls_log
IMPORTING
e_log_handle = mv_log_handle.
In order to avoid an error I check the object and subobject like this before:
CALL FUNCTION 'BAL_OBJECT_SUBOBJECT_CHECK'
EXPORTING
i_object = mc_log_object
i_subobject = mv_log_subobject
EXCEPTIONS
object_not_found = 1
subobject_not_found = 2
subobject_necessary = 3
OTHERS = 4.
CASE sy-subrc.
WHEN 2.
mv_log_subobject = ''.
ENDCASE.
But I don't want to do it like this, I want to create a new subobject if it doesn't exist yet!
Is there some secret function call that can do this? :D
There is no secret function call or something similar. In fact SLG0 is nothing else than view cluster maintenance call (SM34). But I'm also wondering why you need this? If you need some more or dynamic differentiation of your logs you can you use field "extnumber" which you can set in your structure ls_log.
You can select in SLG1 with this field and also via log api.
Related
I am currently trying to program a function module which should, in theory, output a custom table like T052, but with an additional field Z_TEXTLONG, which explains the details of the chosen ZTERM, akin to the text in FI_F4_ZTERM's popup. Here's what I tried:
LOOP AT T_ZBEDS ASSIGNING FIELD-SYMBOL(<line>).
CALL FUNCTION 'FI_F4_ZTERM'
EXPORTING
I_KOART = 'K'
I_ZTERM = <line>-zterm
I_XSHOW = ''
I_ZTYPE = ''
I_NO_POPUP = 'X'
IMPORTING
E_ZTERM = v_text
EXCEPTIONS
NOTHING_FOUND = 1
OTHERS = 2.
WRITE v_text TO <line>-Z_TEXTLONG.
From what I gathered, this does not work due to FI_F4_ZTERM writing the list it returns into E_ZTERM, not a single value, which would be what I need. I am a bit lost as to what I should do next. I tried looking into how exactly FI_F4_ZTERM generates these texts or where it calls them from, but I was not successful. Currently, I am trying to maybe get this text from V_T052, but that does not work either. I would be thankful for any suggestions.
Try function FI_TEXT_ZTERM, it has single import parameter I_T052
why not just call CALL FUNCTION 'FI_F4_ZTERM'
with I_NO_POPUP = 'X'
importing
ET_ZTERM = lt_zterm.
you get the list of payment terms and their texts.
Then in the loop read it from the table of payment terms.
LOOP AT T_ZBEDS ASSIGNING FIELD-SYMBOL(<line>).
read table lt_zterm assigning <term>
with key ZTERM = <line>-zterm.
ENDLOOP.
I have a script for a game server, and I'm stuck in some shit that look easy to solve
Exists a variable which receive content dynamically based on user action, so we will name this variable: example, and attrib some random value
local example = Potato
Then I have a function which sends a message to a discord webhook
SendWebhookMessage(varNAME, "Message content")
Where varname is the variable containing the link of the webhook.
I want to use the content of variable example to generate the variable name like
webhook_ds_example
So in this case it will be
webhook_ds_potato
Hope you guys could understand and help to solve
local menu = { name = "Baú" }
local cb_take = function(idname)
local citem = chest.items[idname]
local amount = vRP.prompt(source,"Quantidade:","")
amount = parseInt(amount)
if amount >= 0 and amount <= citem.amount then
local new_weight = vRP.getInventoryWeight(user_id)+vRP.getItemWeight(idname)*amount
if new_weight <= vRP.getInventoryMaxWeight(user_id) then
citem.amount = citem.amount - amount
local temp = os.date("%x %X")
vRP.logs("savedata/bau.txt","Bau: "..name.." [ID]: "..user_id.." /"..temp.." [FUNÇÃO]: Retirar / [ITEM]: "..idname.." / [QTD]: "..amount)
local webhook_bau_fac1 = ""
local webhook_bau_fac2 = ""
local webhook_bau_fac3 = ""
local webhook_bau_fac4 = ""
SendWebhookMessage(webhook_bau_..name,"```prolog\n[ID]: "..user_id.." "..identity.name.." "..identity.firstname.." \n[GUARDOU]: "..vRP.format(parseInt(amount)).." "..vRP.itemNameList(itemName).." \n[BAU]: "..chestName.." "..os.date("\n[Data]: %d/%m/%Y [Hora]: %H:%M:%S").." \r```")
You are looking for tables, which let you store lots of different named values in one variable.
local webhook_bau -- make a variable
-- create a table with 4 entries, put it in the variable
webhook_bau = {fac1="", fac2="", fac3="", fac4=""}
-- if you want to start with an empty table, use {} instead
-- change one of them based on the name
webhook_bau[name] = "something"
-- use one of the entries based on the name
SendWebhookMessage(webhook_bau[name], "whatever you want to send")
Table entries "magically" appear when you use them, you don't have to create them first. If you access an entry that doesn't exist, you will read the value nil. You can also delete an entry by putting nil in the entry.
In the example you provided, you have:
SendWebhookMessage(webhook_bau_..name,"```prolog\n[ID]: "..user_id.." "..identity.name.." "..identity.firstname.." \n[GUARDOU]: "..vRP.format(parseInt(amount)).." "..vRP.itemNameList(itemName).." \n[BAU]: "..chestName.." "..os.date("\n[Data]: %d/%m/%Y [Hora]: %H:%M:%S").." \r```")
You are missing quotes around webhook_bau_ which would result in an error trying to concatenate a nil variable.
I'm also not seeing where name is set (only menu.name), so I'm assuming you have that elsewhere in your program, if not, that will also be nil, so just make sure that is set somewhere as well.
I have this data type to hold the information to create a notification.
DATA: LS_NOTIFHEADER LIKE BAPI2080_NOTHDRI.
I want to create a notification with a functional location and an affected functional location. I know I can add the functional location with
LS_NOTIFHEADER-TPLNR = '1010-XXXXXXXXXXXXXX'.
Is there also a field to add the affected functional location (BTPLN)?
This is the code I use to create the notification.
CALL FUNCTION 'BAPI_ALM_NOTIF_CREATE'
EXPORTING
NOTIF_TYPE = 'M1'
NOTIFHEADER = LS_NOTIFHEADER
IMPORTING
NOTIFHEADER_EXPORT = LS_NOTIF
TABLES
RETURN = LT_RETURN.
There is no possibility to specify affected location in BAPI.
But user-exit EXIT_SAPLIQS0_017 (enhancement QQMA0025) may be helpful for you. It is called by BAPI and there you can modify BTPLN.
I need to set Channel object to ChannelMedia.
I don't have Channel object, I've got ID instead.
I could use ChannelPeer static method, retrieveByPK, but that makes Select to DB only to get the object.
How do I achieve that?
Check below code:
$channel = ChannelPeer::retrieveByPK($channelID);
$channel_media = new ChannelMedia();
$channel_media->setMedia($this->object);
// How to pass ID here?
// Alternatively, how to create object from $channelID without DB conn?
$channel_media->setChannel($channel);
$channel_media->setStatus(3);
$channel_media->save();
Your ChannelMedia class should have a setChannelId() method. You could use that to set the channel ID, thus avoiding the need to make an extra call to the DB.
$channel_media = new ChannelMedia();
$channel_media->setMedia($this->object);
$channel_media->setChannelId($channelID);
$channel_media->setStatus(3);
$channel_media->save();
I have problems to read the error codes and corresponding messages of SCI message classes.
Is there an way to easy access those?
I'm using "Praxishandbuch SAP Code Inspector" as a reference, but in that regard it is of no help.
I looked in Se11 but the information to the messages isn't helpful.
Has someone an approch to build such a table?
You can try this, perhaps it will work for you. I use the code below to get the access to all the errors found by Code Inspector for particular user(s):
data: ref_inspec_a type ref to cl_ci_inspection.
ref_inspec_a = cl_ci_inspection=>get_ref(
p_user = pa_iuser
p_name = pa_inam
p_vers = pa_ivers ).
data: ls_resp type scir_resp,
lt_resp type scit_resp.
clear: ls_resp, lt_resp.
ls_resp-sign = 'I'.
ls_resp-option = 'EQ'.
ls_resp-low = pa_fuser.
insert ls_resp into table lt_resp.
call method ref_inspec_a->get_results
exporting
p_responsibl = lt_resp
exceptions
insp_not_yet_executed = 1
overflow = 2
others = 3.
Playing around with LT_RESP you can get results for more users at the same time.
After you execute the code above, you can check the attributes SCIRESTPS and SCIRESTHD of the object REF_INSPEC_A. These are the large tables, which contain the result data of the SCI check. You can either work with them on your own, or you can simply pass the object REF_INSPEC_A into the function module SCI_SHOW_RESULTS to get regular SCI user interface.
I found out that you can get all the changeable messages (found in SCI GoTo/Management Of/ Message Priorities) can be read from the scimessages attribute of the test classes.
With this help you can get about 60% of all errors.