*&---------------------------------------------------------------------*
*& Report INVERSE_BOM_EXPLOSION
*& Inverse BOM Explosion
*&---------------------------------------------------------------------*
*&
*& BOM 역전개 : 긁어서 테스트 해 보시기바랍니다.
*&---------------------------------------------------------------------*
REPORT y_inverse_bom_explosion.
TABLES :stas, mara, makt, marc, t179t.
TYPE-POOLS: slis.
TYPES: BEGIN OF ty_1,
vwalt(2) TYPE c,
matnr TYPE marc-matnr,
menge TYPE p DECIMALS 0,
END OF ty_1,
BEGIN OF ty_2,
matnr TYPE stpov-matnr,
vwalt(2) TYPE c,
pmatnr TYPE stpov-matnr,
maktx TYPE stpov-ojtxb,
maktx1 TYPE stpov-ojtxb,
menge TYPE p DECIMALS 0,
vtext TYPE t179t-vtext,
END OF ty_2.
DATA : wa_store TYPE ty_2,
wa_gather TYPE ty_1,
wa_stpov TYPE stpov,
wa_gather2 TYPE ty_1.
DATA : it_store TYPE TABLE OF ty_2,
it_gather TYPE TABLE OF ty_1,
it_gather2 TYPE TABLE OF ty_1,
it_list TYPE TABLE OF stpov,
it_equicat TYPE TABLE OF cscequi,
it_kndcat TYPE TABLE OF cscknd,
it_matcat TYPE TABLE OF cscmat,
it_stdcat TYPE TABLE OF cscstd,
it_tplcat TYPE TABLE OF csctpl.
DATA : g_partno TYPE marc-matnr.
DATA : g_valdat TYPE sy-datum.
DATA : g_lang TYPE sy-langu.
DATA : g_index TYPE sy-tabix.
DATA : g_cnt TYPE sy-tfill.
DATA : g_repid TYPE sy-repid.
DATA : g_initmenge(1) TYPE p DECIMALS 0 VALUE 1.
DATA : g_altbom(2) TYPE c VALUE '01'.
DATA : g_abaptrue(1) TYPE c VALUE 'X'.
DATA : wk_layout TYPE slis_layout_alv,
alvfld TYPE slis_fieldcat_alv,
fieldcat TYPE TABLE OF slis_fieldcat_alv,
i_sort TYPE slis_t_sortinfo_alv,
w_sort LIKE LINE OF i_sort.
SELECT-OPTIONS:
so_matnr FOR marc-matnr NO INTERVALS OBLIGATORY.
PARAMETERS:
p_werks TYPE marc-werks OBLIGATORY.
DEFINE alv_spec.
alvfld-fieldname = &1.
alvfld-seltext_m = &2.
alvfld-tabname = 'IT_STORE'.
case &1.
when 'VWALT'.
alvfld-no_zero = g_abaptrue.
when 'MATNR'.
w_sort-fieldname = &1.
w_sort-up = g_abaptrue.
w_sort-subtot = g_abaptrue.
append w_sort to i_sort.
clear w_sort.
when 'MAKTX'.
w_sort-fieldname = &1.
w_sort-down = g_abaptrue.
append w_sort to i_sort.
clear w_sort.
when 'MENGE'.
alvfld-emphasize = 'C310'.
endcase.
append alvfld to fieldcat.
clear alvfld.
END-OF-DEFINITION.
*
INITIALIZATION.
g_valdat = sy-datum.
g_lang = sy-langu.
g_repid = sy-repid.
alv_spec 'VWALT' 'Alternative BOM'.
alv_spec 'MATNR' 'Child_Partno'.
alv_spec 'MAKTX' 'Child_Text'.
alv_spec 'MENGE' 'Qty Required'.
alv_spec 'PMATNR' 'Parent_Partno'.
alv_spec 'MAKTX1' 'Parent_Text'.
wk_layout-colwidth_optimize = g_abaptrue.
wk_layout-zebra = g_abaptrue.
wk_layout-no_vline = g_abaptrue.
wk_layout-no_hline = g_abaptrue.
wk_layout-window_titlebar =
'INVERSE BILL OF MATERIAL MATRIX EXPLOSION' .
*
START-OF-SELECTION.
LOOP AT so_matnr.
CLEAR: g_index, g_cnt, wa_stpov, wa_gather, wa_store, g_partno.
REFRESH: it_gather[],it_gather2[],it_equicat[],it_kndcat[].
REFRESH: it_stdcat[],it_tplcat[],it_list[],it_matcat[].
g_partno = so_matnr-low.
wa_gather-matnr = so_matnr-low.
wa_gather-menge = g_initmenge.
wa_gather-vwalt = g_altbom.
APPEND wa_gather TO it_gather[].
CLEAR wa_gather.
PERFORM get_parts.
ENDLOOP.
CHECK it_store[] IS NOT INITIAL.
PERFORM get_model_child_texts.
SORT it_store[] BY vwalt matnr ASCENDING.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
is_layout = wk_layout
it_fieldcat = fieldcat[]
it_sort = i_sort[]
TABLES
t_outtab = it_store[].
*&---------------------------------------------------------------------*
*& Form GET_PARTS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_parts .
CLEAR g_cnt.
DESCRIBE TABLE it_gather LINES g_cnt.
IF g_cnt = 0.
EXIT.
ENDIF.
LOOP AT it_gather INTO wa_gather.
CALL FUNCTION 'CS_WHERE_USED_MAT'
EXPORTING
datub = g_valdat
datuv = g_valdat
matnr = wa_gather-matnr
werks = p_werks
TABLES
wultb = it_list[]
equicat = it_equicat[]
kndcat = it_kndcat[]
matcat = it_matcat[]
stdcat = it_stdcat[]
tplcat = it_tplcat[]
EXCEPTIONS
call_invalid = 1
material_not_found = 2
no_where_used_rec_found = 3
no_where_used_rec_selected = 4
no_where_used_rec_valid = 5
OTHERS = 6.
CLEAR g_cnt.
*Move to final itab
DESCRIBE TABLE it_list[] LINES g_cnt.
IF g_cnt = 0.
wa_store-matnr = g_partno.
MOVE wa_gather-matnr TO wa_store-pmatnr.
MOVE wa_gather-vwalt TO wa_store-vwalt.
wa_store-menge = wa_gather-menge.
COLLECT wa_store INTO it_store .
CLEAR wa_store.
CLEAR wa_gather.
ELSE.
*Assign Alternative BOM if any ( VWALT )
LOOP AT it_list INTO wa_stpov
WHERE postp NE 'F' AND ( sumfg = space OR sumfg = 'x' ).
g_index = sy-tabix.
CHECK ( wa_stpov-vwalt = space ).
MOVE wa_gather-vwalt TO wa_stpov-vwalt.
MODIFY it_list INDEX g_index FROM wa_stpov TRANSPORTING vwalt.
ENDLOOP.
g_index = 0.
*Check if deleted from BOM Hierarchy
LOOP AT it_list INTO wa_stpov
WHERE postp NE 'F' AND ( sumfg = space OR sumfg = 'x' ).
SELECT lkenz INTO (stas-lkenz)
FROM stas
WHERE ( stlnr = wa_stpov-stlnr ) AND
( stlkn = wa_stpov-stlkn ) AND
( lkenz = g_abaptrue ).
EXIT.
ENDSELECT.
IF sy-subrc NE 0.
*Material Master Deletion indicator check
SELECT matnr INTO (mara-matnr)
FROM mara
WHERE ( matnr EQ wa_stpov-matnr ) AND
( lvorm EQ space ).
EXIT.
ENDSELECT.
IF sy-subrc EQ 0.
*Prepare it_list for next level
MOVE wa_stpov-matnr TO wa_gather2-matnr.
MOVE wa_stpov-vwalt TO wa_gather2-vwalt.
wa_gather2-menge = wa_stpov-menge * wa_gather-menge.
COLLECT wa_gather2 INTO it_gather2.
CLEAR wa_gather2.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
REFRESH it_list[].
ENDLOOP.
it_gather[] = it_gather2[].
REFRESH it_gather2[].
*Recursive process for exploding next level values
PERFORM get_parts.
ENDFORM. "get_parts
*&---------------------------------------------------------------------*
*& Form VALIDATE_ENTRIES
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM validate_entries .
DESCRIBE TABLE so_matnr[] LINES g_cnt.
DO g_cnt TIMES.
g_index = sy-index.
READ TABLE so_matnr INDEX g_index.
CHECK ( sy-subrc EQ 0 ).
MOVE so_matnr-low TO g_partno.
SELECT mara~matnr INTO (mara-matnr)
FROM mara INNER JOIN marc ON ( mara~matnr = marc~matnr )
WHERE ( mara~matnr EQ g_partno ) AND
( mara~mtart EQ 'HALB' ) AND
( mara~lvorm EQ space ) AND
( marc~werks EQ p_werks ) AND
( marc~lvorm EQ space ).
EXIT.
ENDSELECT.
CHECK ( sy-subrc NE 0 ).
MESSAGE e983(zpp) WITH g_partno.
EXIT.
ENDDO.
ENDFORM. " VALIDATE_ENTRIES
*&---------------------------------------------------------------------*
*& Form GET_CHILD_TEXTS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_model_child_texts .
TYPES: BEGIN OF ty_makt,
matnr TYPE makt-matnr,
maktx TYPE makt-maktx,
END OF ty_makt.
DATA : wa_makt TYPE ty_makt,
it_makt TYPE TABLE OF ty_makt.
SELECT matnr maktx
FROM makt INTO TABLE it_makt
FOR ALL ENTRIES IN it_store
WHERE matnr = it_store-matnr
AND spras = g_lang.
SELECT matnr maktx
FROM makt APPENDING TABLE it_makt
FOR ALL ENTRIES IN it_store
WHERE matnr = it_store-pmatnr
AND spras = g_lang.
CHECK it_makt[] IS NOT INITIAL.
SORT it_store BY matnr pmatnr ASCENDING.
LOOP AT it_store INTO wa_store.
g_index = sy-tabix.
AT NEW matnr.
READ TABLE it_makt[] INTO wa_makt WITH KEY matnr = wa_store-matnr
TRANSPORTING maktx.
CHECK ( sy-subrc EQ 0 ).
READ TABLE it_store INTO wa_store INDEX g_index.
IF ( sy-subrc EQ 0 ).
MOVE wa_makt-maktx TO wa_store-maktx.
MODIFY it_store FROM wa_store TRANSPORTING maktx
WHERE ( matnr = wa_store-matnr ).
ENDIF.
ENDAT.
READ TABLE it_makt[] INTO wa_makt WITH KEY matnr = wa_store-pmatnr
TRANSPORTING maktx.
CHECK ( sy-subrc EQ 0 ).
MOVE wa_makt-maktx TO wa_store-maktx1.
MODIFY it_store INDEX g_index FROM wa_store TRANSPORTING maktx1.
ENDLOOP.
ENDFORM. " GET_CHILD_TEXTS
나의 스크랩북
인터넷 자료중 개인적으로 필요한 자료를 스크립해 놓은 곳입니다.
2025년 3월 4일 화요일
[ABAP]_BOM 역전개 프로그램
2024년 12월 24일 화요일
Letsencrypt 인증서
[ 출처: https://www.fntec.net/ ] [ https://letsencrypt.org/ ]
Letsencrypt 인증서에 도메인 등록하기, 수정하기, 추가하기
처음으로 도메인을 등록하는 경우
Letsencrypt를 설치한 후 처음으로 도메인을 등록하는 방법은 다음과 같습니다.
certbot --apache -d 도메인명
만약 서브 도메인을 하나로 묶어서 등록하고자 하는 경우에는 다음과 같이 '-d 도메인명'를 띄어쓰기로 구분하여 뒤에 열거해줍니다.
복수 도메인 등록시
certbot --apache -d aaa.com -d www.aaa.com -d ko.aaa.com -d en.aaa.com -d ja.aaa.com
참고로 첫번째 도메인이 체인명으로 지정되어 등록되므로 도메인 등록 후 '/etc/letsencrypt/live'에 접속해보면 'aaa.com' 도메인명으로 파일이 생성된 것을 확인할 수 있습니다.
이미 등록한 체인에 도메인을 추가 또는 삭제하는 경우
처음 Letsencrypt에 도메인을 등록할 때와 방법은 매우 비슷합니다. 처음 등록시 'certbot --apache -d 도메인명'와 같은 형식을 취하는데 이미 존재하는 체인에 도메인을 추가 또는 삭제하는 경우에는 'certbot --cert-name 체인명 -d 도메인명'와 같이 입력하면 됩니다.
도메인 추가시 또는 삭제시
certbot --cert-name aaa.com -d aaa.com -d www.aaa.com -d ko.aaa.com -d en.aaa.com -d ja.aaa.com
위의 명령어를 잘 보면 'aaa.com -d aaa.com'와 같이 aaa.com이 2차례 보이는데 이것은 잘 못 입력된 것이 아니라 앞의 aaa.com는 체인명, 뒤의 aaa.com은 도메인명입니다. aaa.com도메인에 인증서를 설정하고 싶다면 잊지말고 도메인 목록 부분에도 넣어줘야 합니다.
도메인명을 입력하는 곳에는 삭제할 도메인은 제거하고 추가할 도메인은 추가해서 이 체인에 등록될 도메인을 모두 적어줘야 합니다. 예를 들어 현재 등록되어 있는 도메인이 aaa.com, www.aaa.com, en.aaa.com인데 en.aaa.com을 삭제하고 ko.aaa.com을 추가하고 싶다면 다음과 같이 실행하면 됩니다.
도메인 추가시 또는 삭제시 예시
certbot --cert-name aaa.com -d aaa.com -d www.aaa.com -d ko.aaa.com
Letsencrypt에 등록된 체인명을 모를 때에는?
'/etc/letsencrypt/live'에 접속해보면 생성된 체인이 디렉토리로 존재하므로 유추할 수 있습니다.
Letsencrypt의 특정 체인에 등록된 도메인 목록을 모를 때에는?
체인명만 알고 있다면 도메인명을 대충 아무거나 넣어서 아래와 같이 명령해봅니다.
certbot --cert-name 체인명 -d 도메인명(대충 입력)
그러면 현재 등록된 도메인명이 이러이러한데 당신은 현재 이러이러한 도메인을 새로 등록하거나 삭제하려고 하는데 맞느냐는 확인을 해오므로 이때 등록된 도메인 목록을 알 수있습니다. 물론 이 질문에는 'NO'라고 대답해야 하겠습니다.
certbot --cert-name aaa.com 와 같이 체인명만 적어주면?
'certbot --cert-name 체인명 -d 도메인명'과 같은 형식으로 Letsencrypt의 도메인을 추가 또는 삭제할 수 있으나 도메인명을 빼고 입력하면 다음과 같은 메세지를 볼 수 있습니다.
What would you like to do?
1: Attempt to reinstall this existing certificate
2: Renew & replace the cert (limit ~5 per 7 days)
이 때 1번을 선택하면 이미 존재하는 인증서를 재설치하게 되고 2번을 선택하면 갱신 또는 대체 작업이 시작되는데 2번 과정은 7일 이내에 최대 5회까지만 가능하므로 주의가 필요합니다.
2024년 12월 17일 화요일
[ABAP]_Table Control에서 필드 Sort 처리 기능 넣기
[출처 : https://sapjoy.co.kr/ ]
DATA : SORT_FIELD(30),
LS_COLS TYPE CXTAB_COLUMN.
WHEN 'ASC' OR 'DES'.
READ TABLE TC1-COLS INTO LS_COLS WITH KEY SELECTED = 'X'.
IF SY-SUBRC = 0.
MOVE LS_COLS-SCREEN-NAME+8(20) TO SORT_FIELD.
CASE SAVE_OK.
WHEN 'ASC'.
SORT IT_301_S BY (SORT_FIELD) ASCENDING.
when 'DESC'.
SORT IT_301_S BY (SORT_FIELD) DESCENDING.
ENDCASE.
ELSE.
MESSAGE I001 WITH 'Select the field you want to sort on.!'.
ENDIF.
2024년 12월 2일 월요일
[CAMEL]_Apache CAMEL과 SAP RFC 연동
[ 출처 : https://www.cdata.com/ ]
Integrate with SAP Data using Apache Camel2
Create a simple Java app that uses Apache Camel routing and the CData JDBC Driver to copy SAP data to a JSON file on disk.
Apache Camel is an open source integration framework that allows you to integrate various systems consuming or producing data. When paired with the CData JDBC Driver for SAP ERP, you can write Java apps that use Camel routes that integrate with live SAP data. This article walks through creating an app in NetBeans that connects, queries, and routes SAP data to a JSON file.
With built-in optimized data processing, the CData JDBC Driver offers unmatched performance for interacting with live SAP data. When you issue complex SQL queries to SAP, the driver pushes supported SQL operations, like filters and aggregations, directly to SAP and utilizes the embedded SQL engine to process unsupported operations client-side (often SQL functions and JOIN operations). Its built-in dynamic metadata querying allows you to work with and analyze SAP data using native data types.
About SAP Data Integration
CData provides the easiest way to access and integrate live data from SAP. Customers use CData connectivity to:
Access every edition of SAP, including SAP R/3, SAP NetWeaver, SAP ERP / ECC 6.0, and SAP S/4 HANA on premises data that is exposed by the RFC.
Perform actions like sending IDoc or IDoc XML files to the server and creating schemas for functions or queries through SQL stored procedures.
Connect optimally depending on where a customer's SAP instance is hosted.
Customers using SAP S/4HANA cloud public edition will use SAP NetWeaver Gateway connectivity
Customers using SAP S/4HANA private edition will use either SAP ERP or SAP NetWeaver Gateway connectivity.
While most users leverage our tools to replicate SAP data to databases or data warehouses, many also integrate live SAP data with analytics tools such as Tableau, Power BI, and Excel.
Getting Started
Creating A New Maven/Java Project
Follow the steps below to create a new Java project and add the appropriate dependencies:
Open NetBeans and create a new project.
Select Maven from the categories list and Java Application from the projects list, then click Next.
Name the project (and adjust any other properties) and click Finish.
In the source package, create a new Java class (we used App.java for this article) and add the main method to the class.
Adding Project Dependencies
With the project created, we can start adding the dependencies needed to work with live SAP data from our App. If you have not already done so, install Maven in your environment, as it is required to add the JAR file for the CData JDBC Driver to your project.
Installing the CData JDBC Driver for SAP ERP with Maven
1. Download the CData JDBC Driver for SAP ERP installer, unzip the package, and run the JAR file to install the driver.
2. Use Maven to install the JDBC Driver as a connector.
mvn install:install-file
-Dfile="C:\Program Files\CData[product_name] 2019\lib\cdata.jdbc.saperp.jar"
-DgroupId="org.cdata.connectors"
-DartifactId="cdata-saperp-connector"
-Dversion="19"
-Dpackaging=jar
Once the JDBC Driver is installed, we can add dependencies to our project. To add a dependency, you can either edit the pom.xml file or right-click the dependencies folder and click Add Dependency. The properties for each dependency follow, but you can search through the available libraries by typing the name of the dependency in the Query box in the Add Dependency wizard.
Accessing SAP Data in Java Apps with Camel
After adding the required dependencies, we can use the Java DSL (Domain Specific Language) to create routes with access to live SAP data. Code snippets follow. Download the sample project (zip file) to follow along (make note of the TODO comments).
Start by importing the necessary classes into our main class.
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.support.SimpleRegistry;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.log4j.BasicConfigurator;
Then in the main method, we configure logging, create a new BasicDataSource and add it to the registry, create a new CamelContext, and finally add a route to the context. In this sample, we route SAP data to a JSON file.
Configure Logging
BasicConfigurator.configure();
Create a BasicDataSource
Create a BasicDataSource and set the driver class name (cdata.jdbc.salesforce.SalesforceDriver) and URL (using the required connection properties).
The driver supports connecting to an SAP system using the SAP Java Connector (SAP JCo). Install the files (sapjco3.jar and sapjco3.dll) to the appropriate directory for the hosting application or platform. See the "Getting Started" chapter in the help documentation for information on using the SAP JCo files.
In addition, you can connect to an SAP system using Web services (SOAP). To use Web services, you must enable SOAP access to your SAP system and set the Client, RFCUrl, User, and Password properties, under the Authentication section.
For more information, see this guide on obtaining the connection properties needed to connect to any SAP system.
BasicDataSource basic = new BasicDataSource();
basic.setDriverClassName("cdata.jdbc.saperp.SAPERPDriver");
basic.setUrl("jdbc:saperp:Host=sap.mydomain.com;User=EXT90033;Password=xxx;Client=800;System Number=09;ConnectionType=Classic;Location=C:/mysapschemafolder;");>
The CData JDBC Driver includes a built-in connection string designer to help you configure the connection URL.
Built-in Connection String Designer
For assistance in constructing the JDBC URL, use the connection string designer built into the SAP JDBC Driver. Either double-click the JAR file or execute the jar file from the command line.
Fill in the connection properties and copy the connection string to the clipboard.
Add the BasicDataSource to the Registry and Create a CamelContext
SimpleRegistry reg = new SimpleRegistry();
reg.bind("myDataSource", basic);
CamelContext context = new DefaultCamelContext(reg);
Add Routing to the CamelContext
The routing below uses a timer component to run one time and passes a SQL query to the JDBC Driver. The results are marshaled as JSON (and formatted for pretty print) and passed to a file component to write to disk as a JSON file.
@Override
public void configure() {
from("timer://foo?repeatCount=1")
.setBody(constant("SELECT * FROM Account LIMIT 10"))
.to("jdbc:myDataSource")
.marshal().json(true)
.to("file:C:\\Users\\USER\\Documents?fileName=account.json");
}
});
Managing the CamelContext Lifecycle
With the route defined, start the CamelContext to begin the lifecycle. In this example, we wait 10 seconds and then shut down the context.
Thread.sleep(10000);
context.stop();
Free Trial, Sample Project & Technical Support
Now, you have a working Java application that uses Camel to route data from SAP to a JSON file. Download a free, 30-day trial of the CData JDBC Driver for SAP ERP and the sample project (make note of the TODO comments) and start working with your live SAP data in Apache Camel. Reach out to our Support Team if you have any questions.
[ 출처 : https://camel.apache.org/ ]
SAP NetWeaver
Since Camel 2.12
Only producer is supported
The SAP Netweaver integrates with the SAP NetWeaver Gateway using HTTP transports.
This camel component supports only producer endpoints.
Maven users will need to add the following dependency to their pom.xml
for this component:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-sap-netweaver</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
URI format
The URI scheme for a sap netweaver gateway component is as follows
sap-netweaver:https://host:8080/path?username=foo&password=secret
Prerequisites
You would need to have an account on the SAP NetWeaver system to be able to leverage this component. SAP provides a demo setup where you can request an account.
This component uses the basic authentication scheme for logging into SAP NetWeaver.
Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties
,*.yaml
files, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The SAP NetWeaver component supports 2 options, which are listed below.
Name | Description | Default | Type |
---|---|---|---|
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean |
Endpoint Options
The SAP NetWeaver endpoint is configured using URI syntax:
sap-netweaver:url
With the following path and query parameters:
Query Parameters (6 parameters)
Name | Description | Default | Type |
---|---|---|---|
If the JSON Map contains only a single entry, then flattern by storing that single entry value as the message body. | true | boolean | |
Whether to return data in JSON format. If this option is false, then XML is returned in Atom format. | true | boolean | |
To transform the JSON from a String to a Map in the message body. | true | boolean | |
Required Password for account. | String | ||
Required Username for account. | String | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean |
Message Headers
The SAP NetWeaver component supports 3 message header(s), which is/are listed below:
Name | Description | Default | Type |
---|---|---|---|
CamelNetWeaverCommand (producer) Constant: | Required The command to execute in http://msdn.microsoft.com/en-us/library/cc956153.aspxMS ADO.Net Data Service format. | String | |
Constant: | The http path. | String | |
Constant: | The media type. | String |
Examples
This example is using the flight demo example from SAP, which is available online over the internet here.
In the route below we request the SAP NetWeaver demo server using the following url
https://sapes4.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT
And we want to execute the following command
FlightCollection(carrid='AA',connid='0017',fldate=datetime'2016-04-20T00%3A00%3A00')
To get flight details for the given flight. The command syntax is in MS ADO.Net Data Service format.
We have the following Camel route
from("direct:start")
.setHeader(NetWeaverConstants.COMMAND, constant(command))
.toF("sap-netweaver:%s?username=%s&password=%s", url, username, password)
.to("log:response")
.to("velocity:flight-info.vm")
Where url
, username
, password
and command
are defined as:
private String username = "P1909969254";
private String password = "TODO";
private String url = "https://sapes4.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT";
private String command = "FlightCollection(carrid='AA',connid='0017',fldate=datetime'2016-04-20T00%3A00%3A00')";
The password is invalid. You would need to create an account at SAP first to run the demo.
The velocity template is used for formatting the response to a basic HTML page
<html>
<body>
Flight information:
<p/>
<br/>Airline ID: $body["AirLineID"]
<br/>Aircraft Type: $body["AirCraftType"]
<br/>Departure city: $body["FlightDetails"]["DepartureCity"]
<br/>Departure airport: $body["FlightDetails"]["DepartureAirPort"]
<br/>Destination city: $body["FlightDetails"]["DestinationCity"]
<br/>Destination airport: $body["FlightDetails"]["DestinationAirPort"]
</body>
</html>
When running the application, you get sample output:
Flight information: Airline ID: AA Aircraft Type: 747-400 Departure city: new york Departure airport: JFK Destination city: SAN FRANCISCO Destination airport: SFO
Spring Boot Auto-Configuration
When using sap-netweaver with Spring Boot make sure to use the following Maven dependency to have support for auto configuration:
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-sap-netweaver-starter</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
The component supports 3 options, which are listed below.
Name | Description | Default | Type |
---|---|---|---|
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean | |
Whether to enable auto configuration of the sap-netweaver component. This is enabled by default. | Boolean | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean |
2024년 11월 25일 월요일
[LINUX] 로그 메세지 한도 조정 처리
2024년 6월 24일 월요일
2024년 5월 30일 목요일
[LDAP]_LDAP 명령어
Enter LDAP Password:
# extended LDIF
#
# LDAPv3
# base <o=domains,dc=qnct,dc=cn> with scope subtree
# filter: (domainName=*)
# requesting: ALL
#
# xxxx.xx, domains, xxxx.xx
dn: domainName=xxxx.xx,o=domains,dc=xxxx,dc=xx
objectClass: mailDomain
domainName: xxxx.xx
mtaTransport: dovecot
accountSetting: minPasswordLength:8
accountSetting: defaultQuota:1024
enabledService: mail
cn: xxxxxxxxxxxxxxxxxxxxxxxx
accountStatus: active
domainCurrentUserNumber: 194
domainCurrentQuotaSize: 1887436800
# xxx.xxx, domains, xxxx.xx
dn: domainName=xxx.xxx,o=domains,dc=xxxx,dc=xx
objectClass: mailDomain
domainName: xxx.xxx
mtaTransport: dovecot
enabledService: mail
accountSetting: minPasswordLength:8
cn: xxxxxxxx
accountStatus: active
domainCurrentUserNumber: xxx
domainCurrentQuotaSize: 1153433600
# search result
search: 2
result: 0 Success
# numResponses: 3
# numEntries: 2
* LDAP로 항목 추가하기(빨간색이 입력하는 내용임)
# ldapmodify -a -D cn=Manager,dc=xxxx,dc=xx -W -H ldap://xxx.xxx.xxx.xxx:389 -x
Enter LDAP Password: xxxxxxxxxx
dn: mail=xxxx@xxxx.xxx,ou=Users,domainName=xxxx.xxx,o=domains,dc=xxxx,dc=xxx
changetype: modify
add: mailForwardingAddress
mailForwardingAddress: xxxx@xxxx.xxx
<--엔터를 쳐야 modify 메세지가 보임
modifying entry "mail=xxxx@xxxx.xxx,ou=Users,domainName=xxxx.xxx,o=domains,dc=xxxx,dc=xxx"