2016 Jul 27 6:13 PM
Hi Guru,
I would like to write Generic READ statement .which should accept different keys.
I am passing dynamic table , and according to that populating data.
so each time the key fields perhaps change in the READ statement .
Exmple; First I will pass MARA table: and get the data into internal table.
Then I use Read statement with key MATNR .
next time will pass MAKT table and read the data from internal table .
I want use same READ statement for both INTERNAL TABLES dynamically.
First Time(mara) MANTR is the key field
Second time (MAKT) MATNR ,SPRAS are key fields.
So I would like to use same READ STATEMENT for all the Tables.
I have searched in SCN but no proper solution.
Please suggest me How to write GENERIC READ STATEMENT (Means each time Key fields will be changed but I WANT TO use Single Read statement )
Thank you .
Regards,
Shivaji.
Hi Guru,
I would like to write Generic READ statement .which should accept different keys.
I am passing dynamic table , and according to that populating data.
so each time the key fields perhaps change in the READ statement .
Exmple; First I will pass MARA table: and get the data into internal table.
Then I use Read statement with key MATNR .
next time will pass MAKT table and read the data from internal table .
I want use same READ statement for both INTERNAL TABLES dynamically.
First Time(mara) MANTR is the key field
Second time (MAKT) MATNR ,SPRAS are key fields.
So I would like to use same READ STATEMENT for all the Tables.
I have searched in SCN but no proper solution.
Please suggest me How to write GENERIC READ STATEMENT (Means each time Key fields will be changed but I WANT TO use Single Read statement )
Thank you .
Regards,
Shivaji.
2016 Jul 27 8:28 PM
Hi Shivaji,
I would suggest looking at the FROM wa addition in the READ TABLE statement. That addition allows you to read an entry in a table by referring to a structure with the same line type as the table. In that case you would simply need to fill all the appropriate key fields with data and then execute your READ.
Regards,
Ryan Crosby
2016 Jul 27 9:12 PM
But what purpose would this serve? Read don't know what from don't know where? Usually when we use READ we are searching for a specific record.
And does READ TABLE syntax even allow any dynamic values? Does READ TABLE (table_name) actually pass syntax check in someone's system?
You might want to clarify where this question is coming from.
2016 Jul 27 9:14 PM
Although I have suggested a possible option I would agree 100% with the questions that Jelena has posed with wanting to understand what kind of purpose a dynamic READ would serve.
2016 Jul 28 5:04 AM
Hi Ryan, Jelena.
Thanks for your prompt reply.
My requirement is I want to download the table entries to excel and change or add new entries to excel then upload to table. But Table name dynamic,user can pass any table name ,download and upload .
I) If user trying o upload excel with duplicate entries , those entries I want to show the user saying like those are the duplicate entries.
For this I need Read statement to check weather entry exit or not ,but if change table name download and upload ,this time key values may change since each table having different key fields.
That is why I would like to write READ statement dynamically .
Thank you.
Regards,
Shivaji.
2016 Jul 28 5:27 AM
Hi Shivaji
Sure sounds like you want to make something pretty straight forward as technically complicated as possible.
My recommendation in line with my esteemed community members above would be: Take a step back and give it a KISS.
Regards
Arden
2016 Jul 28 2:16 PM
Hi Shivaji,
That sounds like a dangerous proposition and a security nightmare all rolled into one. I would foresee a myriad of potential problems around access, conversions, encoding, field types, control characters getting inserted, and maybe others that I'm not thinking of off the top of my head. I would proceed with such an idea with extreme caution.
Regards,
Ryan Crosby
2016 Jul 28 2:34 PM
If I understand correctly you want give the user possibility to download and upload content of, let say, BSEG table, is that correct? If so I would suggest to rethink the whole idea.
2016 Jul 28 2:31 PM
2016 Jul 28 9:00 PM
Still, I don't see any connection between what you've described and a need for "dynamic READ". Of course, as others already noted:
How to twerk upload standard SAP table from a file
Step one: reconsider
Investing in Winshuttle would make more sense IMHO.
2016 Jul 29 5:58 AM
Hi Jelena ,
Sorry , I want to upload and download for ztables not for SAP tables.
For understanding purpose I have given examples like MATNR ,MAKT.
Thank you for your support.
Regards,
Shivaji.
2016 Aug 01 12:01 AM
SAP Tables or Z Tables
Still sound like an over complicated solution.
The time you've spent trying to find a 1 size fits all solution which would be difficult to maintain on an going basis, you could have developed a traditional structured program with a greater degree of robustness.
2016 Jul 28 9:14 PM
2016 Aug 01 5:59 PM
I agree with Arden - I thought about a generic Z table update tool to but then realized it was more hassle than it's worth. In most cases there are some relationships or business logic that also need to be checked and that are specific to the table or a set of tables. There is only that much we can generalize. (E.g. see comments on the blog Juwin mentioned above.)
In general, we try to avoid Z tables to begin with. If we use them, they are usually not maintained by the users but updated by the programs. Only for a few we use SM30 or have a custom transaction with editable ALV. We don't want to run ZSAP.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |