‎2014 Dec 15 6:22 AM
Hi all,
I have a requirement, i have to change existing data element (prodh) used in list of programs . i.e 3192 programs. I have to develop a tool, by running which it should find the programs in which (Prodh) data element is used, and replace it with custom data element( one we have created ).
I have wirtten some logic, by which i am able to find out in which all program we are using this (prodh) data element, and further written BDC program to go to t code se38, in change mode, but now i dont understand how to change the data element .
This report should run in background.
Thanks in Advance
‎2014 Dec 15 12:47 PM
Hi,
Please find the below basic program to update complete your requirement.
In the below code is replacing the STRING with CHAR10.
Regrads.
Praveer.
‎2014 Dec 15 6:29 AM
Hi Koushik,
Follow the below link to read the report from the existing SAP system,
and the same can be update through the internal table of information of the report.
http://help.sap.com/abapdocu_702/en/abenabap_generic_program.htm
After reading the program, the information will store into an internal table and then you have to write a
code to replace the data element with the new one and the later you have to update the same.
Regars.
Praveer.
‎2014 Dec 15 8:56 AM
Thanks very much for your prompt help, i found the editor-call keyword the best suitable, but the thing is after this statement, how can i change the data element, as the program has to run in background, and in debugging mode, when this statement is executed, i have no control over program, once the statement is executed there is no effect of writing the replace statement.
How can i change the string in runtime, is the matter of concern right now.
Thanking you again very much, you really proved tircky for me, but still your help is expected and needed.
‎2014 Dec 15 9:08 AM
Hi Kaushik,
By the use of editor Call, you have to change the code manually, so again you have to find the existing Data element.
Try to write a logic, to replace the Existing Data Element with the newly one.
You can use the REPLACE command.
And if any changes happen, then only you have to update the existing Report information with the New one.
Note: As Matthew has Commented do not try to apply this logic to change the Standard Codes, it could be dangerous for other programs.
Regards.
Praveer.
‎2014 Dec 15 9:23 AM
Hi Kaushik,
I don't think it is possible to change the programs like this in background. It is not possible to achieve through BDC. You will have to do it manually.
‎2014 Dec 15 10:47 AM
Thanks Bro, but whats happeing in here is :
editor-CALL FOR REPORT wa_trdir-name .
When this statement is executed, I have no control over the program flow, it directly displays the program in display mode (foreground), when i press back button, then only this line comes :
REPLACE ALL OCCURRENCES OF 'PRODH' in wa_trdir-name WITH 'ZZPRODH'.
Now this line has no effect. Can you please provide some help.
‎2014 Dec 15 11:41 AM
Hi,
obviously, this is not a trivial request and should only be performed, if you know EXACTLY what you're doing, which, from your posts is not the case. So i would strongly discourage you from doing so.
It is like giving advice to mess with break-parts on a racing car.
If you don't know how these things work - don't do it. You'll end up with horrible things in your system.
Sorry, but in this case, i will not help and i hope, that no one else will.
BR - Jörg
‎2014 Dec 15 12:25 PM
Thanks very much for discouraging me. But still can you please come out with some alternative to that. All that i have in my mind is in front of you, which you think is not the way, how it should be performed.
‎2014 Dec 15 6:46 AM
Once again we are presented with a solution to a requirement, not the requirement itself.
Changing the data element is one possible way of meeting the requirement. Whatever the requirement is, it's probably the worst way of achieving it.
Now. What is the business requirement, and are you planning on changing standard SAP code?
‎2014 Dec 15 6:55 AM
This is not an easy way to change Data elements in all programs using BDC!!
Try some alternatives to meet the business requirement. anyway, PRODH is a structure in ECC 6.0 not Data element..
‎2014 Dec 15 9:44 AM
I'd go further. Forget it. You can't do it via BDC. It can be done via READ REPORT and INSERT REPORT; but if you were to do it, the chances of rendering your system unusable would be extremely high.
Again. What is the business requirement?
If you do not answer this question, I will lock this thread.
‎2014 Dec 15 10:04 AM
Kindly refer the question once more, try going through it twice, you'll be comfartable enough to understand it. Even if you are not able to understand, i'll try to explain in another manner.
‎2014 Dec 15 10:17 AM
Hi,
We all understand what you want to do, the question is "Why". Please explain why PRODH needs to be changed..
Once you do that, I'm sure that better alternatives will immediately become apparent.
cheers
Paul
‎2014 Dec 15 10:41 AM
We have nothing to do with it, we are doing what our higher management has said our manager has told us that now we'll be having only one PH, that is what our requirement for the entire project is.
We have already identified all the programs in which we've to change the data element. But now we've been asked to developed a tool which can do this changing part in background. So first i thought of writing a bdc, to change the data element, but by looking into the answers i thought that there will be a better option of doing that.
Now I think that i have answered all the questions, so can anyone help me with the answer..
Thanks again in Advance , Developers.
‎2014 Dec 15 11:41 AM
You haven't really explained the business requirement.
Two more questions.
1) Are you changing only custom programs?
2) What are you actually attempting to change within the programs? DATA: myprod TYPE prodh. to DATA: myprof TYPE zprodh. or something similar?
‎2014 Dec 15 11:45 AM
kaushik bisht wrote:
Kindly refer the question once more, try going through it twice, you'll be comfartable enough to understand it. Even if you are not able to understand, i'll try to explain in another manner.
That kind of patronising way of addressing people who are actually trying to help you will do you no favours.
As it stands you are attempting to do something which the experienced among us consider extremely dangerous.The reason for all the questions is that there is probably a better way of addressing the business requirement than automatically changing thousands of programs and hoping that you've not forgotten something critical.
‎2014 Dec 15 12:22 PM
Customs Programs.
DATA : myprodh TYPE prodh.
Here we've to change prodh(data element), it can also be like table name-field name.
Now, we've to write a program, that can search for prodh and change the data element automatically, though we've to take some measures into consideration before changing, but that logic can be written.
As stated earlier, i tried writing a BDC, to change the ABAP editor and make changes into it, but as replies started to come, i have decided that, it's not the better way.
Can you please help me with a clue, as how to go forward with it.
This requirement is in high priority.
Thanks again, appreciate your help. Those answers by me is just a part of my frustration, as it's getting difficult for me to continue with the development of the program.
‎2014 Dec 15 12:30 PM
As I already said
It can be done via READ REPORT and INSERT REPORT;
The fact that you're only covering custom programs is somewhat a relief, but I maintain, as others do, that this project is fundamentally dangerous.
‎2014 Dec 15 10:43 PM
"We have nothing to do with it, we are doing what our higher management has said our manager has told us"
I take it this means you don't know the reason 'why'?
You could have just said so...
It can indeed be done (as described above). I recommend running it in test mode first to make sure nothing gets wrecked. Even then, you will probably have to follow up with a LOT of manual fixing.
cheers
Paul
PS Make sure you have this request from your manager in writing.
‎2014 Dec 15 12:47 PM
Hi,
Please find the below basic program to update complete your requirement.
In the below code is replacing the STRING with CHAR10.
Regrads.
Praveer.
‎2014 Dec 15 12:51 PM
‎2014 Dec 15 1:10 PM
Like Matthew (now twice) pointed out, read- and insert report are your only options. The problem however, is to maintain controll. Just finding and replacing a string is easy enough.
The problem starts with countless "what if"s
What if your search-key-word is included as part of another name (like gt_prodh) or something along the line.
What if there are indirect references
What if there are parameters, that require the type of prodh
Again, if i were in your place i wouldn't dare to bite off more than i could probably chew.
No disrespect, but some of your posts show, that you're not too experienced.
I consider myself to be - and still i would do anything to avoid this scenario.
I keep to my disencouragement.
And the question remains - what is your initial objective? Why take the pains, to alter over 3k Programs?
BR - Jörg
‎2014 Dec 15 1:28 PM
Sometimes, even very senior management have to learn how to deal with disappointment. But it's good for them. Character building.
‎2014 Dec 16 5:48 AM
Yeah ! Thanks dude, It worked, i have no words to thank you. God bless You.
‎2014 Dec 16 8:39 AM
You did read my observation that with the sample code a type such as Z_STRING_OF_NUMBERS will be changed to Z_CHAR10_OF_NUMBERS?
If you have anything containing PRODH, it will be changed to your new data element - so if you have:
DATA prod_hierarchy_handler TYPE REF TO Z_PRODHIERARCHY, that will change to something that is no long syntactically correct. I.e. the solution you've been given is only the very basic formulation - to be absolutely safe, you've got a lot of parsing to do, and need to consider all possibilities.
Another example. Let's say you call a standard function module that expects a parameter of type PRODH. So you have
DATA myparam TYPE prodh.
...
CALL FUNCTION 'SOME_STANDARD_SAP_FM' exporting i_param = myparam.
After your program runs, if you write it naively, you'll get a dump, due to a type mismatch.
Your project will fail if you do not correctly handle all possibilities.
‎2014 Dec 16 9:44 AM
Since you seem to be determined to proceed, please read Matts reply again.
And then:
Good luck - Jörg