Dear All ,
According to my requirement , I need to use some predefined SAP FORM present inside some SAP Programs ,
but the Form that I want to invoke from my REPORT uses some GLOBAL SAP predefined variables , I need to over write the
value of those variables.The Global Variable is used inside the SAP FORM.
I have locally defined the same variable in my REPORT , but it is not working.
If I am not clear with the question please post , I will try to present my self more clearly.
Thanking You All.
Thanks a lot Clemens Li and satbirminhas.
I am using a Sub routine "check_processor" in my Report ,
Internally , this Sub-Routine is using the Global Variable GT_BP_DETAIL[ ] ,
The value of GT_BP_DETAIL[ ] is already set by some Standard Transaction, but I want to reset the value to some other value
, so that the new value can by used in the SubRoutine.
How to do this?
Thanks a lot.
I was not able to comprehend your question properly. According to what I understood, you are calling this subroutine in your print program. Now is the smartform being called within this subroutine? If no, then you can just copy the code from this subroutine check_processor, and create another subroutine in your report program (say my_check_processor). Modify the code where GT_BP_DETAIL[ ] is getting populated and I think you are good to go.
I can not modify the code where GT_BP_DETAIL[ ] is being populated ,
thou I can repopulate GT_BP_DETAIL[ ] in my report but the variable GT_BP_DETAIL[ ] is used some where inside the subroutine "check_processor".
I can not create "my_check_processor".
Are you sure it's not possible to copy the subroutine in your report program? If this is the case, may be you could try looking for a user-exit, enhancement in the standard program. If an enhancement option is available, you could modify the contents of GT_BP_DETAIL[ ] based on the program name(sy-repid). I'm not sure if this is an appropriate solution.
Let me give a try.
Suppose check_processor is defined in ZTEST1 program. This program has global table gt_bp_detail . Now before calling check_processor you need to modify this table in order this subroutine can process already altered data.
Normally we expect the below should get this done
"ZTEST1 DATA gt_bp_detail TYPE TABLE OF i WITH HEADER LINE. "this form modifies table and displays its data FORM check_processor. APPEND 1 TO gt_bp_detail. ULINE. LOOP AT gt_bp_detail. WRITE gt_bp_detail. ENDLOOP. ENDFORM. "now calling program i.e. ZTEST FIELD-SYMBOLS <tab> TYPE INDEX TABLE. "assign this global table of ZTEST1 program and change "its content before passing to subroutine ASSIGN ('(ZTEST1)GT_BP_DETAIL') TO <tab>. APPEND 2 TO <tab>. PERFORM check_processor(ztest1).
This will fail due to one reason. We are trying to access ZTEST1 data before it is ever loaded to the memory. So to make this work we need somehow load it there. Simple call of any ZTEST1 subroutine will do the job i.e.
FIELD-SYMBOLS <tab> TYPE INDEX TABLE. "program loads to memory PERFORM check_processor(ztest1). "now check its table content ASSIGN ('(ZTEST1)GT_BP_DETAIL') TO <tab>. APPEND 2 TO <tab>. "now subroutine works with changed data PERFORM check_processor(ztest1).
This will work.
I hope you are talking about SAP Smart forms and not SAP Scripts. There are 2 ways to display data in a smartform.
1. You retrieve the data in your print program (Report) and then pass this data to the form via the exporting and tables sections. So if you have retrieved the data in your report program, just call the smartform and pass the internal table as a parameter to this call.
2.) Sometimes data is retrieved within the form itself. Under Globae Definition -> Initialisation, or using program lines within windows. If this is the case, just replace those select queries with your own logic and display the newly fetched data.
Now there could be another thing that might be causing this problem. If you are trying to execute this form using a standard SAP transaction like ME23n etc, you would have to configure your print program and smart form to the required output type. By default the standard SAP print program and smartform would have been configured for that output type. That's why the form is displaying data from the standard SAP variables.You would need to change this using NACE transaction. This is usually done by the BASIS team.
Put a breakpoint in your print program and see if it gets triggered when you try to pront the form. If the breakpoint doesn't get triggered, it's definitely a configuration issue. Ask the functional guy to configure your print program and smartform to the required output type.
Hope this helps. Please let me know if you need any further clarifications. :):)