Skip to Content

SAP Script: Passing internal table to subroutine - Difference between Head value and Table contents

Oct 13, 2017 at 11:57 AM


avatar image

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.






It didn't work good. So I debugged it.

When i was debuggin it, I found very interested thing.


FORM saldo_evaluate

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 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Jelena Perfiljeva
Oct 13, 2017 at 06: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).

Show 2 Share
10 |10000 characters needed characters left characters exceeded

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 :


Thank you for your answers. As you said, it is right to use 'Read Table'.