Java, JCo ile ABAP’a veri gönderimi kodu kullanımı örneği (Java, pass data to ABAP with JCo code usage example)

Java’da JCo ile SAP sisteminde ABAP’a veri gönderme yolları aşağıdaki gibidir.
IMPORT
*” VALUE(IV_A) TYPE GUID_32 OPTIONAL
*” VALUE(IV_B) TYPE B OPTIONAL
*” VALUE(IV_C) TYPE C OPTIONAL
*” VALUE(IV_D) TYPE D OPTIONAL
*” VALUE(IV_E) TYPE E OPTIONAL
*” VALUE(IV_F) TYPE F OPTIONAL
TABLE
*” ET_DETAY STRUCTURE G OPTIONAL

try{
	function = mRepository.getFunctionTemplate(FUNC_NAME_SEND_AGREEMENT_RESP_FI_BABS).getFunction();

// import
	function.getImportParameterList().setValue(baBs.getGuid(), "A");
	function.getImportParameterList().setValue(baBs.getSellerIdStr(), "B");
	function.getImportParameterList().setValue(baBs.getCustomerIdStr(), "C");
	function.getImportParameterList().setValue(baBs.getYearStr(), "D");
	function.getImportParameterList().setValue(baBs.getMonthStr(), "E");
	function.getImportParameterList().setValue(baBs.getFormType(), "F");

	// importing tables
	JCO.Table debitCreditExtractTbl = null;
	debitCreditExtractTbl = function.getTableParameterList().getTable("G");
	for(DebitCreditExtract debitCreditExtract : baBs.getDebitCreditExtractList()) {
		debitCreditExtractTbl.appendRow();
		debitCreditExtractTbl.setValue(debitCreditExtract.getAgreed().getValue(), "GA");
		debitCreditExtractTbl.setValue(debitCreditExtract.getDocNo() ,"GB");
		debitCreditExtractTbl.setValue(debitCreditExtract.getDocItemNo() ,"GC");
		debitCreditExtractTbl.setValue(debitCreditExtract.getDocDate() ,"GD");
		debitCreditExtractTbl.setValue(debitCreditExtract.getAmount() ,"GE");
		debitCreditExtractTbl.setValue(debitCreditExtract.getValueAddedTax() ,"GF");
		debitCreditExtractTbl.setValue(debitCreditExtract.getCurrency() ,"GG");
		debitCreditExtractTbl.setValue(debitCreditExtract.getPrintedNo() ,"GH");
		debitCreditExtractTbl.setValue(debitCreditExtract.getDescription() ,"GI");
	}

	mConnection.execute(function);

} catch (Exception e) {		
	// do log 
	requestResponse.setStatusCode(ConstantsApp.REQUEST_RESPONSE_EXCEPTION_INT);
	requestResponse.setMessage(MyStringUtils.getStackTraceString(e));
} finally {
	if (mConnection != null) {
		mConnection.disconnect();
	}
}
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on StumbleUpon0Share on Reddit0

Leave a Reply

*