Skip to content

Instantly share code, notes, and snippets.

package org.demo;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.datatype.DatatypeConfigurationException;
Httpconnection connection = null;
BufferedReader reader = null;
String forecastJsonStr = null;
try {
URL url = new URL("http://api.openweathermap.org/data/2.5/forecast/daily?q=94043&mode=json&units=metric&cnt=7");
connection = (Httpconnection) url.openConnection();
connection.setRequestMethod("GET");
connection.connect();
@viksingh
viksingh / gist:f29b897a8cd7e240aa1c
Created September 9, 2014 19:19
CSV_Upload_long_process
FORM convert_file_to_loading_data USING p_file_data TYPE zfile_data_tty " input file data table type
CHANGING c_loading_data TYPE z_data_tty. " Target data table type
DATA: lt_csv_table_struct TYPE REF TO data,
lo_csv_table_desc TYPE REF TO cl_abap_tabledescr,
lo_csv_table_desc_struc TYPE REF TO cl_abap_structdescr,
lt_csv_table_flds TYPE abap_compdescr_tab,
lw_csv_table_flds TYPE abap_compdescr,
lw_file_rawline TYPE LINE OF textline_t,
lt_file_columns TYPE table_of_strings,
@viksingh
viksingh / gist:c794ef0ee5cdbafa1d76
Created September 9, 2014 19:31
CSV_Reading_option_4
*&---------------------------------------------------------------------*
*& Report ZCSV
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
report zcsv.
@viksingh
viksingh / CSV_Trial
Last active August 29, 2015 14:06
CSV_Trial
REPORT ZCSV.
DATA:
gt_excel_data TYPE TRUXS_T_TEXT_DATA.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: p_file TYPE localfile OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b2 .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Name: ProCon Invoice Mapping
Author: Chris Mills
Details: Mapping implemented as an XSL as single SAP Invoice message needs to be split to mutliple ProCon messages, 1 per PO
and financials calculated by unique PO. i.e. if invoice has 3 line items which relate to two PO's then need to split to
two output messages and calculate the tax and net amounts by PO, recursion much easier in XSL
NOTE: This will only send items from the invoice that relate to a contract, the business rules are meant to be no multi-contract
invoices and no mix of 1 item against a contract and another not but if it happens ProCon will only see parts of the invoice
Tables involved
 
PROJ
PRPS
PRHI
@viksingh
viksingh / getRFCLookupUDF.java
Created February 9, 2018 01:09 — forked from SriniBlog/getRFCLookupUDF.java
RFC Lookup is simple UDF that can be used to execute RFC from UDF and fetch the output. This UDF uses RFC channel to make the calls to the SAP system.
public String getRFCLookupUDF(Container container) throws StreamTransformationException{
GlobalContainer globalContainer;
MappingTrace trace;
java.util.Map map;
trace = container.getTrace();
globalContainer = container.getGlobalContainer();
map = globalContainer.getTransformationParameters();
SystemAccessor rfcAccessor = null;
@viksingh
viksingh / DBLookupUDF.java
Created February 9, 2018 01:09 — forked from SriniBlog/DBLookupUDF.java
DB Lookup from Standard SAP PI UDF to execute select query and get the records. This UDF can be used to call JDBC channel and execute the select query to fetch the records from database.
public String getDBLookupUDF(Container container) throws StreamTransformationException{
GlobalContainer globalContainer;
MappingTrace trace;
java.util.Map map;
trace = container.getTrace();
globalContainer = container.getGlobalContainer();
map = globalContainer.getTransformationParameters();
//Variables Used
@viksingh
viksingh / getSeeburgerCounter.java
Created February 9, 2018 01:09 — forked from SriniBlog/getSeeburgerCounter.java
This is used to read the seeburger Counter value and auto increment the counter
//import com.seeburger.functions.permstore.*;
public String getSeeburgerCounter(String counterName, Container container) throws StreamTransformationException{
String counterValue = "";
try {
CounterBean be = CounterFactory.getCounterInstance();
counterValue = be.nextCounter( counterName );
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
return counterValue;