Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Convert from JAVA to ABAP

Former Member
0 Likes
1,221
  • SAP Managed Tags

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.

0 REPLIES 0