10-13-2017 12:57 PM
Hallo expert!
Status: just after DB Conversion from oracle to HANA
I am working on SAP script and I made a subroutine for that as following.
-------------------------------------------------------------------------------
PERFORM SALDO_EVALUATE IN PROGRAM ZIMWADR0
USING &RF140-SALDO&
CHANGING &LV_SALDO& ENDPERFORM
-----------------------------------------------------------------------------
It didn't work good. So I debugged it.
When i was debuggin it, I found very interested thing.
----------------------------------------------------------------------------
FORM saldo_evaluate
TABLES itab STRUCTURE itcsy
otab STRUCTURE itcsy.
-----------------------------------------------------------------------------
I used otab as output table. and its head value was filled with not LV_SALDO but lV_TEXT which is a different local variable in same SAP Script and was used for another subroutine just before. and its content was filled with LV_SALDO.
exactly to saying:
otab( head value): LV_TEXT Text 3
otab[] (Table contents): LV_SALDO
Therefore table otab has different value in head value and in contents.
I checked these values just after subroutine just called.
I didn't see such a thing ever. If you have any idea, could please help me to find out the reason of this situation and solution, please?
10-13-2017 7:56 PM
I'm guessing you need to clear the unwanted variable from the header then? Not sure what is the predicament exactly... There are very many posts online explaining how the SAPscript subroutines work, this blog is just from the top of the Google search.
But this day and age I'd really suggest to start replacing SAPScripts with PDF forms or at least Smartforms. SAPScript won't be supported in S/4HANA (thankfully).
10-13-2017 7:56 PM
I'm guessing you need to clear the unwanted variable from the header then? Not sure what is the predicament exactly... There are very many posts online explaining how the SAPscript subroutines work, this blog is just from the top of the Google search.
But this day and age I'd really suggest to start replacing SAPScripts with PDF forms or at least Smartforms. SAPScript won't be supported in S/4HANA (thankfully).
10-14-2017 9:50 AM
It seems that the OP is thinking that the header line of parameter otab should be initialized by SAP to be equal to the first line of otab.
But of course you should never rely on the header line but always use READ TABLE otab (and same thing for itab).
As Jelena suggests, the blog posts show the right way to access itab and otab (i.e. you must not take into account the header line transmitted), and it's also shown in the official documentation :
https://help.sap.com/saphelp_nw70/helpdata/en/d1/803279454211d189710000e8322d00/frameset.htm
10-17-2017 9:53 AM
Thank you for your answers. As you said, it is right to use 'Read Table'.