2

I have currently install sap_netweaver_as_abap_751_sp02_ase_dev_edition and all works fine.

My final goal is to create some tables in SAP (I have SAP ASE installed as DB) and to be able to access them using java (of course with sapidoc3.jar and sapjco3.jar).

Until this moment I manage to create a connection to SAP and I get this output:

executing
Attributes:
DEST:                   mySAPSystem
OWN_HOST:               HS-SW-05
PARTNER_HOST:           vhcalnplci
SYSTNR:                 00
SYSID:                  NPL
CLIENT:                 001
USER:                   DEVELOPER   
LANGUAGE:               E
ISO_LANGUAGE:           EN
OWN_CODEPAGE:           4102
OWN_CHARSET:            UTF16
OWN_ENCODING:           utf-16
OWN_BYTES_PER_CHAR:     2
PARTNER_CODEPAGE:       4103
PARTNER_CHARSET:        UTF16
PARTNER_ENCODING:       utf-16
PARTNER_BYTES_PER_CHAR: 2
OWN_REL:                721
PARTNER_REL:            751 
PARTNER_TYPE:           3
KERNEL_REL:             749 
TRACE:                   
RFC_ROLE:               C
OWN_TYPE:               E
CPIC_CONVID:            00000000

STFC_CONNECTION finished:
Echo: Hello SAP
Response: SAP R/3 Rel. 751   Sysid: NPL      Date: 20180905   Time: 132841   
Logon_Data: 001/DEVELOPER/E

I also manage to create a simple table in SAP, but right now I don't understand how can I receive info from that table using java and my jars(is not possible to make any selects or things like this).

From what I found on the internet I have understood that these tables are stored in an IDOC file and I should get somehow this IDOC.

If someone has done this before maybe can give me some clues about how can I get some date from a SAP database.

Thank you.

Sandra Rossi
  • 9,036
  • 2
  • 18
  • 39

1 Answers1

6

For now, I can only give a general answer, because I feel you'll have to search detailed guides through other posts, how IDOC works.

An IDOC is neither a table, nor a file. It's a format for exchanging data with SAP (SAP also stores them in IDOC tables, for logging and recovery purposes).

You can either send an IDOC to SAP, or get one from SAP. For instance, one IDOC could contain the data of a purchasing order.

To get data from SAP, you must push it from SAP, by defining:

  • some data in SAP (purchase order, customer, etc.),
  • when to send it (immediately or scheduled),
  • how to send the data via IDOCs to your "java program", by configuring partners and ports (file, HTTP, RFC...)

There are transaction codes like WE20, WE21, BD64.

On a trial system, there is almost no real application except the flight demo database. You may try filling it with the program SAPBC_DATA_GENERATOR, then use the program SAPBC_FILL_FLCUST_IDOC to send IDocs of type FLCUSTOMER_CREATEFROMDATA01.

Sandra Rossi
  • 9,036
  • 2
  • 18
  • 39
  • I understand that Idoc is a format made by SAP but still, I don't understand how can I create a query and send the result back to my Java up. Do you know any tutorials that fallow your steps mention above? (the doc on the web regarding this topic is not so good) –  Sep 05 '18 at 16:47
  • 1
    No. One question: why do you want IDOCs? Don't you just want to read SAP tables from your java app? (then it's a different topic, not related to IDOCs) – Sandra Rossi Sep 05 '18 at 17:34
  • I was thinking the only way to communicate to an SAP system is throw IDOC. Can you give me some links about what you mention above? –  Sep 06 '18 at 05:20
  • 3
    JCO is for RFC communication, you can use it. One generic RFC function to read database tables is RFC_READ_TABLE. You can play with it (probably you'll find JCO snippets in the WWW). Usually its use is forbidden in real systems for security concerns of course. By the way, you may also play directly with the database connected to SAP, no need to pass through SAP. – Sandra Rossi Sep 06 '18 at 07:25
  • Ok, I will try it :) Thanks –  Sep 06 '18 at 07:50