Application Development 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: 

how to get data from specific structures ?

Former Member
0 Kudos

Hello Everybody,

I need your help, it's very very important.

So, my boss told me that I need to get certain data from structures located in the EXPORT PART of the function module "BAPI_MATERIAL_GETALL".

This structures like "BAPI_MARA_GA" have certain fields that I need like : "component, datatype, short text".

Firstivally, I need to get this data having also multi-language short text.

If I can't do this automatically, I'll have huge trouble.

After this, I need to go to the function module "BAPI_MATERIAL_savedata" and do the same thing except this time I need to find out the fields which gets updated and assign them to the above fields, which has been readen.

After all that think has done, now I need to find somehow the appropriate tables field of this.

PLANTDATA-PLANT string SAPFIELD MARC-WERKS

PLANTDATA-PLANT string READ_FIELD PLANTDATA-PLANT

PLANTDATA-PLANT string WRITE_FIELD ?

I don't really understood what he meant.

But before, I can reach that step, I need to automatically retrieve the structure data and parse them to EXCEL.

Thanks for Your Help.

I wish to myself good luck, how can I say that 0 / 0 is equal to whatever ?

ps. I need to learn to my exam, I don't have time to do this. Mamiiiiiiii %-|

Please Help.

Regards,

Kais

1 ACCEPTED SOLUTION

Sm1tje
Active Contributor
0 Kudos

I don't quite see the problem. Why would you need to know all these structures? Using these function modules (BAPI's), all the relevant data is retrieved automatically just by entering the correct material as import. Execute the BAPI, and all data is retrieved from database.

7 REPLIES 7

Sm1tje
Active Contributor
0 Kudos

I don't quite see the problem. Why would you need to know all these structures? Using these function modules (BAPI's), all the relevant data is retrieved automatically just by entering the correct material as import. Execute the BAPI, and all data is retrieved from database.

Former Member
0 Kudos

Hello Micky,

The problem that I don't need the data, I mean I need the definition of the structure not the data of the table.

So, what I need is something similar to RFC_READ_TABLE which return me only the "field data", so when I set the dataflag to 'X' no data is returned.

I only need the fields, to export them in excel file and them to map them to specific fields.

Like MARC-WERKS is mapped to PLANTDATA-PLANT

What I need is something like RFC_READ_STRUCTURE

just to retrieve all field of e.g. BAPI_MARC_GA

later I'll say that PLANTDATA => BAPI_MARC_GA => MARC

field from structure => will get mapped to the appropriate fields of MARC

No, consider that I need to do this for BAPI_MATERIAL_GETALL and BAPI_MATERIAL_SAVEDATA

and findout which field are getting updated and where and which aren't updated.

Like PLANT is not updated.

Best Regards,

Kais

Sm1tje
Active Contributor
0 Kudos

Still not sure what you mean, but I'll give it a shot anyway.

There is a table which stores all the parameters of function modules, something with PARA in it. After determining this table, you can use it to retrieve the structures of this function module. Using the name of the structure, you can retrieve all the fields of this structure with the RTTI classes.

These are all classes with:

CL_ABAP DESCR

In your case class CL_ABAP_STRUCDESCR should do.

Edited by: Micky Oestreich on Feb 26, 2009 9:10 PM

Former Member
0 Kudos

Hello Micky,

Thanks a lot for your help.

I finally get what I needed, except that this time I'm gone need to get the component type of the field of a structure.

I'm mean like :

Structure : BAPI_MARA

Field : DEL_FLAG

Component Type : LVOMA

Yesterday, I used the cl_abap_structdescr to get all the fields of some structure, having the name of the fields, data type, length, ... but today I discovered that I need to know the component type of a field.

So, because most of the case the component type is similar to that of the internal component type of MARA.

But, unfortunately I find that this is not always true.

So, for example :

The field DEL_FLAG has a component type LVOMA on the structure BAPI_MARA

But, its equal field in MARA has as a component type LVOMA but its field is called LVORM

So, now I need to reference the structure-field-component-type to the mara-field-component-type which then get me the actually need mara-fieldname

I know that this is not frequent. So, I'm gone do this manually.

What I need now, is something to get the component type of a field. Unfortunately I don't know how.

I looked to the tables of the cl_abap_*desc class but there's no such a thing as this data.

Ps. I also need to return back the short text of the structure in different languages.

Thanks a lot.

Regards,

Kais

Former Member
0 Kudos

Hi,

the class CL_ABAP_DATADESCR gives the data type of the single field. You can use this

Regards,

Siddarth

Former Member
0 Kudos

Hello Siddharth,

Thanks for replying.

I've used the functions and looked in the absolute_name (r_desct->absolute_name ), ... on the debugger

e.g. r_descr ?= cl_abap_datadescr=>describe_by_data( 'DEL_FLAG' ).

But there's nothing interesting, I just want to get the type of the Field DEL_FLAG of the structure BAPI_MARA which should be LVOMA

so, on the debugger is called \TYPE=%_T00006S00000000O0000000293

How do I know what this's about ?

Thanks A Lot.

Regards,

Kais

Former Member
0 Kudos

Hi,

use,

CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( 'BAPI_MARA-DEL_FLAG' )

this will return LVOME

Regards,

Siddarth