Skip to Content
-1
Oct 23, 2019 at 09:06 AM

Convert from JAVA to ABAP

249 Views

Hello,

can somebody help me to Translate the JAVA Code into ABAP?

I am very new in ABAP and need this for our Company.


URI uri = URI.create("http://api.labelary.com/v1/printers/8dpmm/labels/4x6/0/%5Exa%5Ecfa%2C50%5Efo100%2C100%5EfdHello%20World%5Efs%5Exz");
		
HttpRequest request = HttpRequest.newBuilder(uri)
.header("Accept", "application/pdf") // omit this line to get PNG images back
.build();
HttpClient client = HttpClient.newHttpClient();
HttpResponse< byte[] > response = client.send(request, BodyHandlers.ofByteArray()); 
byte[] body = response.body();
		


if (response.statusCode() == 200) 
{
      File file = new File("C://Users//t.cayli//Desktop//Label//Label.pdf"); 
      Files.write(file.toPath(), body);
      System.out.println("OK");
}
		
else 
{
      String errorMessage = new String(body, StandardCharsets.UTF_8);
      System.out.println(errorMessage);
}
	

I would be happy for every help and hint.