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

Reading Master data from table

Former Member
0 Likes
991

I have added an attribute ZAC_DESC to my master data info object 0GL_ACCT. I dont have any objects in the source to map it with in the transfer rules but i have a table in which this data is maintained (ZACCOUNT table). I need to write a routine in my transfer rules to bring the data from the ZAC_DESC field in the table to my attribute. Can someone give me the complete routine. By the way that table does not contain 0GL_ACCT.

Thanks,

Priya.

11 REPLIES 11
Read only

Former Member
0 Likes
971

While creating Transfer rule for this info object.

You can code in this way. Start coding and if you face any problem, i will help you.

For the transfer routine of ZAC_DESC -

select single zac_desc

into <info object ZAC_DESC>

from zaccount

where gl_acct = <Transfer structure-gl_acct>.

Here you are extracting ZAC_DESC from table ZACCOUNT using condition GL_ACCT = transfer structure-Account no.

Hope this helps.

ashish

Read only

0 Likes
971

Thanks a lot for your reply. But can you also give me the exact syntax, what i have to declare for tables, data etc. Once i know what to put in that i will start coding and will let you know if any issues.

Thanks Again,

Priya.

Read only

0 Likes
971

I have given you exact code.

select single zac_desc

into <b><info object ZAC_DESC></b>

from zaccount

where gl_acct = <b><Transfer structure-gl_acct></b>.

You just need to replace text marked in bold with your transfer structure name, GL ACCount field name from your transfer structure as well as infoobject name.

ashish

Read only

0 Likes
971

This is the code i have put and i am getting the following error "E:Field "ZAC_DESC" is unknown. It is neither in one of the specified in tables nor defined by a "DATA" statement. "DATA" statement. "DATA" statement.

The code I have put is this, please correct it if any error exists.

<b>select single ZAC_DESC

into ZAC_DESC

from ZACCOUNT

where 0gl_acct = /BIC/M0GL_ACCT</b>

Thanks,

Priya.

Read only

0 Likes
971

Check my comments here -

select single ZAC_DESC <This should be the field name from table ZACCOUNT>

into ZAC_DESC <This should be your infoobject name>

from ZACCOUNT

where 0gl_acct = /BIC/M0GL_ACCT

You are extracting value of ZAC_DESC from ZACCOUNT into info object ZAC_DESC.

Is your info object name correct?

Can you please check and confirm.

Also your ZACCOUNT taqble should have field 0GL_ACCT. Otherwise whatever is the fieldname, that you need to place here.

ashish

Message was edited by:

Ashish Gundawar

Read only

0 Likes
971

I dont have the GL Account Number in the Look Up table and I have modified the code but i am still getting the same error,

Modified Code:

<b>select single /BIC/OIZAC_DESC.

into ZAC_DESC.

from ZACCOUNT

where gl_acct = /BIC/M0GL_ACCT</b>

Could you help,

Priya

Read only

0 Likes
971

If you do not have GL Account no in look up table then the WHERE condition will not work.

Check if field /BIC/OIZAC_DESC is present in table ZAC_DESC. Goto SE11, enter ZAC_DESC and search for /BIC/OIZAC_DESC. IT should be present in the table in order to use in SELECT.

Second point - when you use INTO ZAC_DESC, i believe ZAC_DESC is your info object / attribute name in which you want the value to be stored. So make sure the name is correct.

select single /BIC/OIZAC_DESC.

into ZAC_DESC.

from ZACCOUNT

where gl_acct = /BIC/M0GL_ACCT

In above command, i see '.' after SELECT and INTO line. Please remove those and put one '.' at the end after /BIC/M0GL_ACCT.

Will it help if i pass some information on SELECT statement?

ashish

Read only

0 Likes
971

Ashish, in the routine i have sent you

ZACCOUNT-name of the table

/BIC/OIZAC_DESC-name of the field in the table

ZAC_DESC is the info object into which the data from the above filed has to be read

and /BIC/M0GL_ACCT: is the communication structure.

I have no clue of ABAP so i dont think any information on statements would help.

Thanks,

Priya

Read only

0 Likes
971

Then this statement should work -

select single /BIC/OIZAC_DESC

into ZAC_DESC

from ZACCOUNT

where gl_acct = /BIC/M0GL_ACCT

Just one more clarification - ZAC_DESC has a field with name GL_ACCT, correct?

Are you still getting an error?

Where did you place this code? This needs to be placed in the place for transfer rules for ZAC_DESC.

ashish

Read only

0 Likes
971

0GL_ACCT is the info object to which ZAC_DESC is an attribute. And the communication structure in which 0GL_ACCT and ZAC_DESC are there is /BIC/M0GL_ACCT.

I am placing this is the transfer routine of ZAC_DESC but remember i does not have a source field to which it is mapped. The routine has to read the table.

does this change anything in the code. Also dont we need to do declaration in the beginning of the code for TABLES or DATA.

Thanks,

Priya.

Read only

0 Likes
971

First of all you do not need to declare data or tables as we are not using any variable or any table buffer.

select single /BIC/OIZAC_DESC

into ZAC_DESC

from ZACCOUNT

where gl_acct = /BIC/M0GL_ACCT

In above select, i understand that /BIC/M0GL_ACCT is from communication structure. So here you need to add communication structure name something like DATA_PACKAGE or so.

Rest all looks okay.