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

RFC to read CACL Data Problem

Former Member
0 Likes
807

Hello Experts,

last week I wrote a ABAP report to read all the classification data from ausp and mara. It is working well now.

The next step is to have a RFC doing the same. But copy&paste won't fit here. My Problem is:

Let's say I have a fix number of attributes defined via cacl (e.g. 3 attributes). Then I want the RFC to get data like:

Materialdata1; Materialdata2; Attribute1;Attribute2;Attribute3;

The Problem is that in AUSP each Attribute of each material is saved in a new Dataset. Like this:

Objectnumber; Attribute1

Objectnumber; Attribute2

Objectnumber; Attribute3

So my idea was to write in the sourcecode part of se37 something like read from ausp and mara and then update 3 attribute fields I defined in IMPORT as a global Datatype (String 40 chars). The problem is that I am not allowed to use generic datatypes like c. I don't have privileges tocreate my own Datatypes in se11 either. So I want to ask if you know another idea to solve the problem.

To get the cacl data is not the problem. I have a programm here that is working. The Question here is how to define a datatype in IMPORT (SE37) to update the fields via the source code part?

thank you.

edit: I think I found a solution myself. I just gave ATWRT the fitting types from the tables. The in the code I made a counter saying when counter=0 change the value of Attribut1 I hope this will work.

Edited by: Daniel Gerne on Apr 28, 2008 11:15 AM

6 REPLIES 6
Read only

Former Member
0 Likes
759

Hi,

it would be nice if you could verify my code. It shall write the first, 2nd and 3rd Dataset in the corresponding values from the IMPORT Part.

*"  IMPORTING
*"     VALUE(ATWRT0) TYPE  AUSP-ATWRT OPTIONAL
*"     VALUE(ATWRT1) TYPE  AUSP-ATWRT OPTIONAL
*"     VALUE(ATWRT2) TYPE  AUSP-ATWRT OPTIONAL
*"     VALUE(ATINN0) TYPE  AUSP-ATINN OPTIONAL
*"     VALUE(ATINN1) TYPE  AUSP-ATINN OPTIONAL
*"     VALUE(ATINN2) TYPE  AUSP-ATINN OPTIONAL
*"  EXPORTING
*"     VALUE(RC) TYPE  SY-SUBRC
*"     VALUE(ERRTXT) TYPE  SYNTA-LINE

integer = 0.
* Write to screen and update IMPORT values
LOOP AT itab INTO line.
IF integer = 0.
  WRITE: / line-ATINN, line-atwrt.
  ATWRT0  = line-atwrt.
  ATINN0  = line-ATINN.
ENDIF.
IF integer = 1.
  WRITE: / line-ATINN, line-atwrt.
  ATWRT1  = line-atwrt.
  ATINN1  = line-ATINN.
ENDIF.
IF integer = 2.
  WRITE: / line-ATINN, line-atwrt.
  ATWRT2  = line-atwrt.
  ATINN2  = line-ATINN.
ENDIF.
integer = integer + 1.
ENDLOOP.

edit: Another Question: I am using this rfc with Exchange Infrastructure, which means the values in IMPORT will be sent to the Integration Server. My Question is: Will the data in IMPORT be sent after the sourcecode was working or before that?

Edited by: Daniel Gerne on Apr 28, 2008 11:33 AM

Read only

0 Likes
759

instead of using integer .. use sy-tabix ...

  • Write to screen and update IMPORT values

LOOP AT itab INTO line.

IF sy-tabix = 1.

WRITE: / line-ATINN, line-atwrt.

ATWRT0 = line-atwrt.

ATINN0 = line-ATINN.

ENDIF.

IF sy-tabix = 2.

WRITE: / line-ATINN, line-atwrt.

ATWRT1 = line-atwrt.

ATINN1 = line-ATINN.

ENDIF.

IF sy-tabix = 3.

WRITE: / line-ATINN, line-atwrt.

ATWRT2 = line-atwrt.

ATINN2 = line-ATINN.

ENDIF.

ENDLOOP.

Read only

0 Likes
759

Hi Srinivas,

thanks for the hint.

Do you know if my knowledge about processing the rfc is correct?

Meaning: First the Source Code is being executed and THEN the IMPORT will give the values to the RFC-Destination.

Is that correct?

Read only

Former Member
0 Likes
759

Hi I just found out that I forgot to limit my temporary table to the CACL Attributes of the specific material. So I wanted to add a WHERE clause:

SELECT
ausp~atwrt
ausp~ATINN
into corresponding fields of table itab
FROM ausp
WHERE MATNR = ausp~OBJCT.

MATNR is defined in IMPORT.

ausp is defined in tables:

The problem now is that abap thinks MATNR is a field in the given tables (which is ausp). But I mean the field from IMPORT. How do I say that I mean a field outside of the SELECT statement?

Read only

0 Likes
759

Declare V_MATNR LIKE MARA-MATNR in the IMPORT parameters ..

and use V_MATNR in the FM.

Read only

0 Likes
759

Hello,

thats not possible. It says you can't use references in RFCs. The only options I have about like is type OR type of ref.

When I insert it in the source code. It won't find it either. And when I manually Insert it into IMPORT. It will delete it after checking syntax.