cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function module RSAU_READ_MASTER_DATA

Former Member
0 Likes
1,440

Hello All,

Am using a FM in the update rule to read master data. Am using the FM

RSAU_READ_MASTER_DATA.

Am xporting InfoObject name, attribute and importing a table. But it gives me this error...

You attempted to pass the field "G_ATTRNM" to the formal parameter "E_TABLE"

but the formal parameter "E_TABLE" can accept only fields of

type "h". The field "E_TABLE" has the type "C".

Kindly let me kno, why is this error coming.

Rgrds,

KK

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Likes

0SOLD_to is reference char to 0customer. You can directly read /BI0/MCUSTOMER to read attribute values.. for a particular sold to value..instead of using FM.

--S@A

Former Member
0 Likes

There are four ways to extract data from the FM,

1) Only one attribute value for a single InfoObject value

2) Complete attribute list of values for a single InfoObject value

3) An internal table output for several InfoObject values.

4) An internal table outpout for all InfoObject values of a master data.

Please specify which funtionality r u utilizing from this FM?

Former Member
0 Likes

Hello Vishesh,

Thanks for the reply. Actually I just want to retrieve one attribute value from this FM. Can you please provide me a sample code for this.

Regards,

KP

Former Member
0 Likes

You need to get the value of an attribute (e.g. 0SOLD_TO) corresponding to a characteristic value (e.g. 0SOLD_TO = 'CUST_CODE'). In this case you need to export to the function the name of the involved characteristic (parameter I_IOBJNM), its value (parameter I_CHAVL), and the name of the attribute (parameter I_ATTRNM). Notice that the parameter I_CHAVL expects a RSGENERAL-CHAVL data format. The function returns the attribute value in the parameter E_ATTRVAL.

-


DATA: CUST_CLASS,

SOLD_TO LIKE RSGENERAL-CHAVL.

SOLD_TO = DATA_PACKAGE-SOLD_TO. " in an update rule, for instance

CALL FUNCTION 'RSAU_READ_MASTER_DATA'

EXPORTING

I_IOBJNM = '0SOLD_TO'

I_CHAVL = SOLD_TO

  • I_T_CHAVL =

  • I_DATE =

  • I_FLG_WHOLE_TABLE =

I_ATTRNM = '0CUST_CLASS'

IMPORTING

  • E_STRUCTURE =

  • E_TABLE =

E_ATTRVAL = CUST_CLASS

EXCEPTIONS

READ_ERROR = 1

NO_SUCH_ATTRIBUTE = 2

WRONG_IMPORT_PARAMETERS = 3

CHAVL_NOT_FOUND = 4

OTHERS = 5

-


Notice that even for a custom attribute, the simple attribute name needs to be exported (e.g. ZATTR), and not the field name as it appears in the attribute table (e.g. /BIC/ZATTR). Remember also that the name of both the characteristic and the attribute must be upper case (i.e. is case sensitive). Lastly, the import parameter I_DATE may be used to specify the key date when a time-dependent characteristic is involved. The output attribute value will fulfil the temporal condition that the key date is in the validity time interval of the characteristic.

Former Member
0 Likes

Thnks for the detailed explanation. I am pasting my code here. Can you please

check whether its as per your explanation.

-


DATA:

g_iobjnm TYPE rsdiobj-iobjnm,

g_chavl TYPE rsd_chavl,

g_date TYPE dats,

g_attrnm TYPE rsd_attrinm,

g_rc TYPE sy-subrc.

DATA: v_result LIKE /BIC/MZHRPA9000-/BIC/ZK025000V.

g_iobjnm = '0EMPLOYEE'.

g_chavl = 'EMPLOYEE'.

g_attrnm = 'ZK025000V'.

CALL FUNCTION 'RSAU_READ_MASTER_DATA'

EXPORTING

I_IOBJNM = g_iobjnm

I_CHAVL = g_chavl

I_ATTRNM = g_attrnm

IMPORTING

e_attrval = v_result

EXCEPTIONS

READ_ERROR = 1

NO_SUCH_ATTRIBUTE = 2

WRONG_IMPORT_PARAMETERS = 3

CHAVL_NOT_FOUND = 4

OTHERS = 5.

-


My main concern is to get Monthly salary from a Salary Master InfoObject, for an EMPLOYEE. I am not sure about what should be assigned to

g_iobjnm = '0EMPLOYEE'.

g_chavl = 'EMPLOYEE'

these fields.

Regards,

KP

Former Member
0 Likes

In the Update Rule, within loop...

g_iobjnm = '0EMPLOYEE'. - Main InfoObject

g_chavl = DATA_PACKAGE-EMPLOYEE - Runtime value of Main InfoObject

g_attrnm = <Salary Master InfoObject> - Attribute of Main InfoObject

Former Member
0 Likes

KK PP,

How have u defined v_result? It needs to be of same type as 'g_chavl'.

Check if it is same and confirm.