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: 

retrieval of MECDGRID structure in an infoset

0 Kudos

Hi Gurus,

I would like to get the history of changes of a set of POs.

I have tried to do that by creating an infoset via SQ02, getting the data from the structure MECDGRID.

I have chosen the option of using the integrated program.

I have tried to write few lines of code but i got lost and now i'm stuck.

Basucally I've been able to create a selection screen with the PO number and PO line as selection screen parameters but I'm not able to get the data from the structure.

I would like to retrieve all the data present in the structure filtering only witht these two parameters

I am not a programmer, I only need this for a very specific, one time task and I ask your help since our IT is currently overwhelmed with other critical tasks.

Could you help by editing or posting some sample code?

Thanks in advance

Here is what I have now in the coding section (honestly not so much)

REPORT RSAQDVP_TEMPLATE .
*
*---------------------------------------------------------------------*
* declarations
* (insert your declarations in this section)
*---------------------------------------------------------------------*
data:
MECDGRID type MECDGRID ,
it_data type standard table of MECDGRID .


field-symbols: <struc> type MECDGRID .

*-------------------------------------------------------------------*
* selection screen statements
*-------------------------------------------------------------------*
* (define your selection-screen here)
select-options: num_oda for MECDGRID-EBELN,
pos_oda for MECDGRID-EBELP.


* !! the following comment MUST NOT BE CHANGED !!
*<QUERY_HEAD>



*-------------------------------------------------------------------*
* read data into IT_DATA
*-------------------------------------------------------------------*
* (select your data here into internal table IT_DATA)
select *
from MECDGRID
into table IT_DATA.





*------------------------------------------------------------*
* output of the data
* (this section can be left unchanged)
*------------------------------------------------------------*
loop at it_data assigning <struc>.
move-corresponding <struc> to MECDGRID .
* !! the following comment MUST NOT BE CHANGED !!
*<QUERY_BODY>

endloop.

3 REPLIES 3

Former Member
0 Kudos

Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with: https://community.sap.com/resources/questions-and-answers, as it provides tips for preparing questions that draw responses from our members.

For example, you can:

- outline what steps you took to find answers (and why they weren't helpful)

- share screenshots of what you've seen/done

- make sure you've applied the appropriate tags

- use a more descriptive subject line

The more details you provide, the more likely it is that members will be able to respond. Feel free to also take our Q&A tutorial at: https://developers.sap.com/tutorials/community-qa.html

Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your profile you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html

Jeansy
Active Contributor
0 Kudos

Hi,

select *
from MECDGRID
into table IT_DATA.

That will not work as MECDGRID is just a structure, not a database table.

The selection of the PO changes can be done using the change documents and their related tables CDHDR and CDPOS. Keep in mind that this will be slow as there is a lot of data included in this tables (change logs for all SAP-objects).

Please check this posting for more details, anonther member described here the relation between the mentioned tables:

https://answers.sap.com/questions/4774128/purchase-order-change-log.html

In general, I suggest to ask a developer to create a report for you to implement your requirements. I guess that this is easier than writing a data selection report for an infoset (SQ02) - but that's just my impression 🙂

Kind regards
Jens

raymond_giuseppi
Active Contributor
0 Kudos

As already written, MECDGRID is a structure, there is no permanent data stored in the database under this name, it is filled dynamically by an Abap code, so either

  • Ask an abapper to provide you with the tables to read, the code or even the dataset to get this data.
  • Use a standard FM such as ME_CHANGEDOC_SELECT to build this data. (e.g. select from database EKPO and call the FM in a LOOP)