How can I use ENQUEUEGETSTAT function module in gateway service, this fm returns 3 parameter (ENTRIES_TOTAL, ENTRIES_PEAK, ENTRIES_ACTUAL)
I can map tables in Gateway but cant figure out this. How can I collect these parameters in to internal table and export then?
it looks like a function import use case to me .
First of all, you have to define a ABAP structure for the returning data like below
#EndUserText.label : 'ENQUEUEGETSTAT'
#AbapCatalog.enhancementCategory : #NOT_EXTENSIBLE
define structure zza_enqueuegetstat {
entries_total : abap.int4;
entries_peak : abap.int4;
entries_actual : abap.int4;
}
In your SEGW project, create a entity type ENQUEUEGETSTAT mapping to this structure.
.
Afterwards, create a function import ENQUEUEGETSTAT.
Go to your DPC_EXT class and redefine the method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~EXECUTE_ACTION.
method /iwbep/if_mgw_appl_srv_runtime~execute_action.
data ls_enqueuegetstat type zza_enqueuegetstat.
if iv_action_name = 'ENQUEUEGETSTAT'.
call function 'ENQUEUEGETSTAT'
importing
entries_total = ls_enqueuegetstat-entries_actual
entries_peak = ls_enqueuegetstat-entries_peak
entries_actual = ls_enqueuegetstat-entries_total.
copy_data_to_ref(
exporting
is_data = ls_enqueuegetstat
changing
cr_data = er_data
).
endif.
endmethod.
Save and activate everything. Then you should able to access your function import /sap/opu/odata/sap/**YOUR_SERVICE**/ENQUEUEGETSTAT?$format=json
{
"d": {
"EntriesTotal": 382,
"EntriesPeak": 43189,
"EntriesActual": 500000
}
}
Hope it helps.
Related
I need a help with a terraform module that I've created. It works perfectly, but I need to add some automation.
I created a module which creates multiple private endpoints, but I always need to put the variable values in manually.
This is the module:
resource "azurerm_private_endpoint" "endpoint" {
for_each = try({ for endpoint in var.endpoints : endpoint.name => endpoint }, toset([]))
name = each.key
location = var.location
resource_group_name = var.resource_group_name
subnet_id = each.value.subnet_id
dynamic "private_service_connection" {
for_each = each.value.private_service_connection
content {
name = each.key
private_connection_resource_id = private_service_connection.value.private_connection_resource_id
is_manual_connection = false
subresource_names = var.subresource_name ### see values on : https://learn.microsoft.com/fr-fr/azure/private-link/private-endpoint-overview#private-link-resource
}
}
lifecycle {
ignore_changes = [
private_dns_zone_group
]
}
tags = var.tags
}
I need to have:
1 - for the private endpoint name : I need it to be automatically provided: "pendp-(the subresource_name value in lower cases- my resource_name =>(mysql server for example))"
2 - for the private connection name: I need the values to be automatically: "connection-(the subresource_name value in lower cases- my ressource_name =>(mysql server for exemple))"
3 - some automation to detect automatically the subresource_name ( if I create a private endpoint for a blob or for a mariadb or for a mysqlserver, the module should detected it.
terraform version:
terraform {
required_version = "~> 1"
required_providers {
azurerm = "~> 3.0"
}
}
The easiest way to combine values automatically would be to use the Terraform string join() function to join multiple strings together. For lower case strings, you can use the lower() function.
Some examples:
name = join("-", ["pandp", lower(var.subresource_name)])
...
name = join("-", ["connection", lower(var.subresource_name), lower(each.key)])
For your third rule, you want to use a conditional expression to determine if it's a blob, or mariadb, or mysqlserver.
In this example, we set an example_name local with a value some-blob-value if var.subresource_name contains a string that starts with "blob", and set it to something-else if the condition is false:
locals {
example_name = startswith(lower(var.subresource_name), "blob") ? "some-blob-value" : "something-else"
}
There are many options available for doing a conditional on if a value is passed to what you expect and then determine a result based on that value. What exactly you want isn't clear in the question, but hopefully this will get you pointed in the right direction.
Terraform even has several helper functions that might help you if you only need part of a string, such as startswith(), endswith(), or contains() depending on your needs.
I'm learning ABAP at the moment and got the task to build a function that creates a .txt file or a .csv file from an internal table and save it on the application server.
I know you can use, for example, GUI_DOWNLOAD for that, but the task is to build my own function to do that.
So I got an internal table filled and I want that to be saved as .txt file on the AS. I'm coding in Eclipse, BTW.
Anybody has an idea how to do that, using a function?
EDIT:
Here's what I tried already:
I created a function in the function builder. On the import parameters I put a parameter with the name "lv_mytab" with type table.
The source code of my function looks like this:
*"-------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" REFERENCE(LV_MYTAB) TYPE TABLE
*"-------------------------------------------------------------------
DATA(myfile) = '/usr/sap/S42/data/textfile.txt'.
OPEN DATASET myfile FOR OUTPUT IN TEXT MODE ENCODING DEFAULT WITH SMART LINEFEED.
LOOP AT lv_mytab into lt_table.
TRANSFER lt_table to myfile.
CLOSE DATASET myfile.
In my program I tried calling the function like this:
CALL FUNCTION 'EXPORT_TXT_CSV_MR'
EXPORTING
lv_mytab = lt_summe.
lt_summe is the internal table I want to be exported as txt or csv.
Something like this:
OPEN DATASET lv_p_app FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT gt_error INTO gs_final.
TRANSFER gs_final TO lv_p_app.
ENDLOOP.
CLOSE DATASET lv_p_app.
ENDIF.
More samples here https://answers.sap.com/questions/3704234/download-internal-table-onto-the-application-serve.html
Okay with the help of a fellow student I got it working.
Heres the solution I found:
Code source of the function:
FUNCTION EXPORT_TXT_CSV_MR.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" REFERENCE(S_FILENAME) TYPE STRING
*" CHANGING
*" REFERENCE(GT_MYTAB) TYPE STANDARD TABLE
*" REFERENCE(GD_VERARBEITUNG) TYPE INT4
*"----------------------------------------------------------------------
DATA:
ld_filename TYPE string,
ld_datei type standard table of sbook,
ld_Zeile like line of ld_datei,
gd_useraction TYPE i,
lt_Ausgabe TYPE STANDARD TABLE OF sbook.
CONCATENATE '/usr/sap/S42/data/' s_filename into ld_filename.
IF gd_Verarbeitung = 1.
ld_datei = gt_mytab.
OPEN DATASET ld_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT ld_datei into ld_Zeile.
Data(ld_string) = | Partnernummer: { ld_Zeile-customid } Betrag: { ld_Zeile-forcuram } Waehrung: { ld_Zeile-forcurkey } Name: { ld_Zeile-passname }|.
Transfer ld_string to ld_filename.
ENDLOOP.
Close dataset ld_filename.
ElseIF gd_Verarbeitung = 2.
ld_datei = gt_mytab.
*ld_filename = '/usr/sap/S42/data/CSVFile_MR.csv'.
Open Dataset ld_filename for output in text mode encoding default with SMART LINEFEED.
LOOP AT ld_datei into ld_Zeile.
ld_string = | Partnernummer: { ld_Zeile-customid } Betrag: { ld_Zeile-forcuram } Waehrung: { ld_Zeile-forcurkey } Name: { ld_Zeile-passname }|.
Transfer ld_string to ld_filename.
ENDLOOP.
Close dataset ld_filename.
ENDIF.
ENDFUNCTION.
And in my program I call it like this:
if p_txt = 'X'.
ld_txtcsv = 1.
CALL FUNCTION 'EXPORT_TXT_CSV_MR'
EXPORTING
s_filename = 'TXTFile_MR.txt'
CHANGING
gt_mytab = lt_summe
gd_verarbeitung = ld_txtcsv.
clear ld_txtcsv.
endif.
if p_csv = 'X'.
ld_txtcsv = 2.
CALL FUNCTION 'EXPORT_TXT_CSV_MR'
EXPORTING
s_filename = 'CSVFile_MR.csv'
CHANGING
gt_mytab = lt_summe
gd_verarbeitung = ld_txtcsv.
clear ld_txtcsv.
ENDIF.
Thanks for all of your help! I got it now! :)
example :
Contents of FooGetRequest.feature file
* eval for (var i=0; i<foobarInDB.length; i++) call read('../features/BarGetRequest.feature') { foo_code:'#(foo_code)' , bar_code:'#(foobarInDB[i])'}
This is how BarGetRequest.feature file looks like :
Background:
* url baseUrl
Given path
"/v1/foo/"+foo_code+"/skus/"+bar_code+"/bar"
When method get
Then status 200
When I execute FooGetRequest.feature file i get the following error
[java.lang.RuntimeException: javascript evaluation failed: Expected ; but found read
you can use driven data driven feature in karate for loop over feature multiple times
Assuming foobarInDB is an array of bar_code and foo_code will always be same
* set foobarInDB[*].foo_code = foo_code
* call read('../features/BarGetRequest.feature') foobarInDB
refer Data driven feature
I wrote a small java script to return me a map like { foo : bar}
* def fun = function(x){return {foo :x }}
* def fooBarMap = karate.map(fooBarMap,fun)
* def validateResponse = call read('../features/BarGetRequest.feature) propertySkuMap
and in the BarGetRequest.feature I read the values accordingly.
I have a problem with fixtures in yii2 , I just created all required file according to this document but it's not working.
let me explain , I have a module called Authyii and inside this module I have a model named User .
this is my directory structure :
my fixture file is like this :
namespace app\modules\Authyii\tests\fixtures;
use app\modules\Authyii\models;
use yii\test\ActiveFixture;
use yii\test\Fixture;
class UserFixture extends ActiveFixture
{
public $modelClass = 'app\modules\Aythyii\models\User';
public $tableName = 'authyii_user';
}
this is my command line :
but after I type 'yes' and command line says :
but when I check my database there is not new record inside authyii_user tables .
what I missed ?
File User.php id data dir must have table name authyii_user.php. In framework source code in file ActiveFixture.php line with code:
$dataFile = dirname($class->getFileName()) . '/data/'
. $this->getTableSchema()->fullName . '.php';
Best regards.
There is method getFixturesConfig() in \vendor\yiisoft\yii2\console\controllers\FixtureController.php
private function getFixturesConfig($fixtures)
{
$config = [];
foreach ($fixtures as $fixture) {
$isNamespaced = (strpos($fixture, '\\') !== false);
$fullClassName = $isNamespaced ? $fixture . 'Fixture' : $this->namespace . '\\' . $fixture . 'Fixture';
if (class_exists($fullClassName)) { // <<< I think you lose your UserFixture here
$config[] = $fullClassName;
}
}
return $config;
}
You should check what $fullClassName Yii expects it to be (for example logging or echoing it) and tweak your UserFixture's namespace accordingly.
I have a Grid.
Get Data Code
Code:
var myParam = {
typeId : 1,
xxxx : 'xxxx' //some else
}
grid.store.load(myParam);
When to do something such as time renovate
Code:
grid.store.reload();
But this lost param.
In ExtJs3 have a Config of LastParam .
How to do in Extjs4.
thanks.
use the proxy's extraParams config.
grid.store.getProxy().extraParams = myParam;
grid.store.load();
grid.store.reload();
This way the params will be sent until you modify the extra param again with code.