cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing SAP Data

Former Member
0 Kudos

Hi,

I need to access some data from SAP. I do not find a standard BAPI that can give me this data. Could anybody tell me what are the different methods of accessing data in SAP besides a BAPI call? Thanks.

Regards,

V M.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Venki,

you had in your Link a issue.

Target X Path: ProductionOrderConfirmation.Request{/RFC_READ_TABLE/INPUT/QUERY_TABLE}

Expression: "AFRU"

<Pedro> This is OK.

Target X Path: ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/FIELDS/item/FIELDNAME}

Expression: "WERKS EQ '1100'"

<Pedro> This is not OK. In the Fieldname you need to type in the Field that you will get back with data (like you posted before for example RUECK).

Target X Path: ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/FIELDS/item/OPTIONS}

Expression: "WERKS EQ '1100'"

Also, I am using Illuminator Doc and Row action blocks to get me the output I want. Does it sound right? Should I use a 'String List to XML Parser'...?

<Pedro> Yes, you are right.

Regards

Pedro

Former Member
0 Kudos

Thanks Pedro. I think the transaction is reading the table without errors now. Could you tell me the generic settings in the link editor of the 'Row' action block. In my XML output, I get the message 'TRANSACTION EXECUTED OK' but not the fields and the data I need. Thank you very much again.

Regards,

V M.

Former Member
0 Kudos

hi

You need to create one output Transaction property of XML type and assign the output of the IllumDoc.output to this XML property.

Hope this helps

Rupesh

Former Member
0 Kudos

Now, I get the message 'Field to be read not in table'. Can somebody explain whats going on here? Thanks.

Regards,

V M.

Former Member
0 Kudos

Venki,

sounds the same error as before. Please provide your JCO links.

Regards

Pedro

agentry_src
Active Contributor
0 Kudos

Venki,

It would help if you did the following:

Put a tracer action block right after the SAP_JCo_Interface.

Map the SAP_JCo_Interface.Request segment to the Message property of the Tracer.

Put the Message into a code segment in your next reply. (see the Markup Possibilities for directions)

You can also do the same with the Response segment, but the Request segment is most likely where your problems reside.

That will really help us analyze your troubles.

Thanks,

Mike

Former Member
0 Kudos

Mike, thanks for the suggestion. Well, there is good and bad news now. I executed the RFC in SE37 and it worked fine. I replicated it in xMII but I am getting an error message. The message says "Selected fields do not fit into structure DATA". I must be doing something wrong with the syntax somewhere. Do you know of any common mistakes one might make? Thanks.

Regards,

V M.

Former Member
0 Kudos

Venki,

Please provide your JCO links (Link-Editor).

Regards

Pedro

Former Member
0 Kudos

Pedro,

Here you go -

XPath Expression

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/INPUT/QUERY_TABLE} "AFRU"

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/INPUT/DELIMITER} ","

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/OPTIONS/item/TEXT} "RUECK EQ '2860901'"

I need to output more than 1 field, say 'AUFNR', 'VORNR' etc. Please tell me how to do that. I appreciate it.

Regards,

V M.

Former Member
0 Kudos

Venki,

you need to type in the full length (10 digits) for RUECK. Please try this RUECK EQ '0002860901'.

You need to append the FIELDS/item. That means in your scenario you will have two item entries

into the FIELDS.

Regards

Pedro

Edited by: Pedro Iglesias on Jul 8, 2008 7:32 PM

Former Member
0 Kudos

Could you please give me the syntax for the two 'Field' entries? Do they have to be 'Requests' or 'Responses'?

Regards,

V M.

Former Member
0 Kudos

Venki,

you need to define per column a item in the FIELDS node. So your JCO Request structure have multiple

items in the FIELDS (per Column one item).

Example:

Build a Local XML like this:

<?xml version="1.0" encoding="UTF-8"?>

<FIELDS>

<item>

<FIELDNAME>AUFNR</FIELDNAME>

<OFFSET/>

<LENGTH/>

<TYPE/>

<FIELDTEXT/>

</item>

<item>

<FIELDNAME>VORNR</FIELDNAME>

<OFFSET/>

<LENGTH/>

<TYPE/>

<FIELDTEXT/>

</item>

</FIELDS>

Links:

Assign XML SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/TABLES/FIELDS} = Local.RFC_FIELDS{/FIELDS}

Regards

Pedro

agentry_src
Active Contributor
0 Kudos

Venki,

Pedro mentioned using the full 10 digits for RUECK input. Just wanted to explain that in many cases, the BAPI or RFC will not expand the input with leading zeroes. However SAP will do it automatically with most of their input screens within the ERP system. So be aware that you will probably run into this again when interfacing to SAP. This is one of the more common problems using BAPIs or RFCs from outside SAP. Batch numbers (12 digits), Material Numbers (18 digits), and Order Numbers (10 digits) are just some of the common ones you can run into problems with.

Good luck,

Mike

Former Member
0 Kudos

Thanks for the solution Pedro. Apparently, its over my head. I am a just beginner in xMII. Did you mean to say, I create a Local Property (XML type) and then assign it to the Request in Link editor of JCo? I tried that. I didn't see multiple Fields in JCo.Request. Could you please be a little more specific in your instructions? Appreciate it.

Regards,

V M.

Former Member
0 Kudos

Yes, that is correct with the Local Property. The assign structure is not visible in design mode. The structure in the

Request you will only see, when you insert a Tracer after the JCO-Block in a own Sequence. Then on the Tracer Block

you need to link as Link-Type "AssignValue":

Tracer_0.Message = JCO.Request

Execute the Transaction. Now you need to copy (double click the line) the Info from the Transaction Execution Window.

Paste it in a XML Editor and delete the first 9 character. You will get the XML-Request structure. Please analyse the

entries in the node FIELDS.

Regards

Pedro

Former Member
0 Kudos

I keep getting the same error as before - Selected fields do not fit into structure DATA. This is how my JCo link editor looks now -

XPath Expression

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/INPUT/QUERY_TABLE} "AFRU"

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/INPUT/DELIMITER} ","

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/OPTIONS/item/TEXT} "RUECK EQ '2860901'"

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/FIELDS} Local.RFC_Fields{/RFC_READ_TABLE/TABLES/FIELDS}

Do you see anything wrong?

V M.

Former Member
0 Kudos

Yes,

you forgot to insert the leading zeroes. Please use this:

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/OPTIONS/item/TEXT} "RUECK EQ '0002860901'"

As Mike and I posted before,

Mike posted: ...RFC/BAPI will not expand the input with leading zeroes. However SAP will do it automatically

with most of their input screens within the ERP system. So be aware that you will probably run into this again when interfacing

to SAP. This is one of the more common problems using BAPIs or RFCs from outside SAP. Batch numbers (12 digits),

Material Numbers (18 digits), and Order Numbers (10 digits) are just some of the common ones you can run into problems with.

Regards

Pedro

Former Member
0 Kudos

I am sorry. I did have leading zeroes in front of the confirmation number. I just cut and pasted it from my previous post when I didn't have it. Anyway, the problem still exists. I am getting confused. If I just used 1 fieldname, its not giving that error.

XPath Expression

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/INPUT/QUERY_TABLE} "AFRU"

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/INPUT/DELIMITER} ","

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/OPTIONS/item/TEXT} "RUECK EQ '2860901'"

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/FIELDS/item/FIELDNAME} "AUFNR"

Also, you said I should see several fieldnames in my JCo.Request.RFC_Read_Table.Tables.Fields. I still see only one whereas the Local.RFC_Fields.RFC_Read_Table.Tables.Fields has all the fields I defined in the Local XML. Am I doing anything wrong?

V M.

Former Member
0 Kudos

Please copy the value of your Local Property and paste it in this thread, so I can check your Local Property.

Edited by: Pedro Iglesias on Jul 8, 2008 10:09 PM

Former Member
0 Kudos

Here you go -

<?xml version="1.0" encoding="UTF-8"?><RFC_READ_TABLE><INPUT><DELIMITER>,</DELIMITER><NO_DATA> </NO_DATA><QUERY_TABLE>AFRU</QUERY_TABLE><ROWCOUNT>0</ROWCOUNT><ROWSKIPS>0</ROWSKIPS></INPUT><TABLES><DATA><ProdOrd><WA/></ProdOrd></DATA><FIELDS><ProdOrd><FIELDNAME>AUFNR</FIELDNAME><OFFSET/><LENGTH/><TYPE/><FIELDTEXT/></ProdOrd></FIELDS><OPTIONS><ProdOrd><TEXT>RUECK EQ '2860901'</TEXT></ProdOrd></OPTIONS></TABLES></RFC_READ_TABLE>

Former Member
0 Kudos

Venki,

you misunderstood my points. I think the best will be to start from zero.

1. Create a new transaction.

2. Create a Local Property. Name = FIELDS | Data Type = XML | Value = <?xml version="1.0" encoding="UTF-8"?><FIELDS><item><FIELDNAME>AUFNR</FIELDNAME><OFFSET/><LENGTH/><TYPE/><FIELDTEXT/></item><item><FIELDNAME>VORNR</FIELDNAME><OFFSET/><LENGTH/><TYPE/><FIELDTEXT/></item></FIELDS>

3. Insert SAP JCO Interface. Name = ProductionOrderConfirmation. Configure the JCO with the RFC_READ_TABLE.

4. Open the Link Editor and assign the following as Link-Type 'Assign Value':

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/INPUT/QUERY_TABLE} = "AFRU"

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/INPUT/DELIMITER} = ","

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/OPTIONS/item/TEXT} = "RUECK EQ '0002860901'"

5. Assign the following as Link-Type 'Assign XML':

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/FIELDS} = Local.FIELDS{/FIELDS}

6. Add a new Sequence.

7. Insert in the new Sequence a Tracer.

8. Select the Tracer and open the Link-Editor.

9. Assign the ProductionOrderConfirmation.Response to the Tracer.Message

10. Execute the transaction.

What you will see in the Transaction Execution Window?

Regards

Pedro

Former Member
0 Kudos

I got a error message "Field to be read not in table".

Former Member
0 Kudos

Sorry, I take it back. There was a typo in the XML script. It worked fine now. Let me proceed further. I got some questions on outputting the fields. You are a genius. Thank you very much.

V M.

Former Member
0 Kudos

What is the Link-Type for Step 5? Which Version of ERP?

Former Member
0 Kudos

It worked fine. Do I have to do any modification for outputting more than 1 field?

Regards,

V M.

Former Member
0 Kudos

Venki,

please close the thread, if your question is answered.

Regards

Pedro

Former Member
0 Kudos

Yes, modify the Local Property FIELDS. At the moment the Local.FIELDS have the AUFNR and the VORNR.

You need to copy from <item> to </item>, paste it after the last </item> and modify the value in the node FIELDNAME.

Cheers

Pedro

Former Member
0 Kudos

Hurrah! Its working. You are the man! Couple more things before we close this out -

i) I need to seperate the output into different columns with respective column headings.

ii) I need to pass the 'Confirmation' as a variable; right now I am using a fixed value as you may recall it.

Thank you very much Pedro.

Regards,

V M.

Former Member
0 Kudos

Couple of observations -

i) Without leading zeroes works fine too - '2860901' & '0002860901' both work. The output though has leading zeroes. Wonder how to truncate these!

ii) The ordering of expressions in the JCo Link editor matter? For example, the following order works

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/INPUT/QUERY_TABLE} = "AFRU"

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/INPUT/DELIMITER} = ","

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/OPTIONS/item/TEXT} = "RUECK EQ '0002860901'"

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/FIELDS} = Local.FIELDS{/FIELDS}

but this doesn't work -

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/INPUT/QUERY_TABLE} = "AFRU"

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/INPUT/DELIMITER} = ","

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/FIELDS} = Local.FIELDS{/FIELDS}

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/OPTIONS/item/TEXT} = "RUECK EQ '0002860901'"

Ok, I tried the following in order to pass values to the field RUECK. Declared a transaction variable 'Confirmation' (Data Type - 'String') and modified the expression in JCo Link editor to look like this -

ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/OPTIONS/item/TEXT} = "RUECK EQ 'Confirmation'"

However when I pass a value from the Xacute query, it doesn't give any output. Is this not the right procedure?

Regards,

V M.

Former Member
0 Kudos

Ok, I am able to pass values to RUECK dynamically. Learning something everyday! Last but not least - I need to seperate my output into different columns. Right now, they all show in the same column with a delimiter ','. Could somebody please guide me through this? Thanks.

Regards,

V M.

Former Member
0 Kudos

If your original question was answered and you have a new one please close this thread and start a new thread for your new question.

Regards,

Christian

Former Member
0 Kudos

Venki,

what you exactly specify in the Field? Did you type in "'RUECK'" with single quote? If yes,

please do not use the single quote.

Regards

Pedro

Former Member
0 Kudos

Pedro,

This is how my link editor in JCo looks -

Target X Path: ProductionOrderConfirmation.Request{/RFC_READ_TABLE/INPUT/QUERY_TABLE}

Expression: "AFRU"

Target X Path: ProductionOrderConfirmation.Request{/RFC_READ_TABLE/TABLES/FIELDS/item/FIELDNAME}

Expression: "WERKS EQ '1100'"

Does it look ok?

Also, I am using Illuminator Doc and Row action blocks to get me the output I want. Does it sound right? Should I use a 'String List to XML Parser'...?

Thanks,

V M.

Former Member
0 Kudos

Hi,

I am getting the following error(s) in the execution of the RFC -

i) Field to be read not in table (I am using the field name, like 'RUECK')

ii) Selected fields do not fit into structure DATA

Can somebody explain whats going on here? Appreciate it.

Regards,

V M.

agentry_src
Active Contributor
0 Kudos

Venki,

There are more RFC functions than those listed in the BAPI explorer. If you have access to SAP, go to SE37 and there is a wealth of information there. There is a search function there, but I am not that familiar with it. Many RFCs begin with something other than BAPI_. I have found RFC_READ_TABLE very helpful, but you need to know which tables you need to pull information from. There are also a group of queries which can be used to access SAP Queries. That group begins with RSAQ_. Here is a link to a useful document Sam Castro put together for using the queries.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/390b889b-0e01-0010-e4af-c9a062b9...

You can also see what RFCs are there by using the Search Pattern in a SAP JCo Interface Action block. All it returns is lists of RFCs, but that can be useful as well.

What kind of SAP Data you are trying to access?

Mike

Edited by: Michael Appleby on Jul 3, 2008 9:48 PM

Former Member
0 Kudos

Thanks for the link Mike. Thats what I realized too after going thru some of the previous threads posted by others. I messed with the RFC_READ_TABLE thing a little bit this morning. Since I never used it before and don't have good learning material I am finding it difficult to get it to work. Anyway, I am looking for the 'Yield', 'Scrap' & 'Rework' quantities for a certain confirmation # (or) a certain operation of a production order. I need to display this info for the operator(s) who are going to confirm their operation(s) on a production order. Usually, we find this data in the AFRU table. I am gonna check the link you sent and see if I can get it to work. In the meantime, could you share with me any BLT that you have for reading an SAP table and extracting the data to xMII. Appreciate it much.

Regards,

V M.

Edited by: V M on Jul 3, 2008 10:54 PM

Former Member
0 Kudos

Hi,

You can find the some standard material at

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0a4be8f-4d6e-2910-9aaa-891499a4...

https://www.sdn.sap.com/irj/sdn/manufacturing-tools

For your purpose you can use BAPI_PRODORD_GET_DETAIL .... just pass the the data in request.

I have written a blog on how to call a BAPI in xMII

Hope that helps you

Regards,

Musarrat

agentry_src
Active Contributor
0 Kudos

Hi Venki,

I would start with the documents that Musarrat Husain listed. There are also templates available from SDN which have some standard transactions using these and other BAPIs. These sample transactions are built according to best practices and can provide starting templates for your transactions.

For using the RFC_READ_TABLE, there are a number of messages here in this forum (you may want to go back further than 90 days) which contain some good insights into the structure of the queries you need. For your purposes, I think you will be better off using the BAPI Musarrat mentioned rather than a direct table read from AFRU, but that is really up to you. I do not have a transaction that I can pass on to you, but will be happy to answer questions regarding any that you build. I think that you will find the documentation available in SAP transaction SE37 will help your development. You will definitely have to have some knowledge of the table structures in SAP to make best use of the RFC.

Good luck,

Mike