SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Using a program variable without passing it in parameters



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dynamic Programming | Динамическое программирование
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Nov 25, 2007 11:07 pm    Post subject: Using a program variable without passing it in parameters Reply with quote

Using a variable from a calling program without passing it in parameters.

Did you ever try to use a variable from another program without passing this variable as a parameter. This is very useful when you CANNOT add the field as a standard parameter. For example, when you want to use a variable in a BADI which is not already passed as a parameter. Another good example is when you create a correction in a function and you want to keep the installation of the OSS note automatic (if you add parameters in a note, the user will have to install the note manually).
Here is a short example on how to do this :

Code:
REPORT zdany_test_var_from_fm.
TABLES: spfli.
DATA dbcnt TYPE sy-dbcnt.
DATA: itab TYPE spfli_tab.
SELECT * FROM spfli INTO TABLE itab UP TO 2 ROWS.
dbcnt = sy-dbcnt.
CALL FUNCTION 'ZFUNCTION'.

FUNCTION zfunction.
* We want to use the DBCNT from the program ZDANY_TEST_VAR_FROM_FM
DATA: field(50).
FIELD-SYMBOLS: <dbcnt>.
field = '(ZDANY_TEST_VAR_FROM_FM)dbcnt'.
ASSIGN (field) TO <dbcnt>.
WRITE <dbcnt>.

* We want to use the internal table from the program ZDANY_TEST_VAR_FROM_FM
DATA: itab TYPE spfli.
FIELD-SYMBOLS: <itab> TYPE spfli_tab.
field = '(ZDANY_TEST_VAR_FROM_FM)ITAB[]'.
ASSIGN (field) TO <itab>.
LOOP AT <itab> INTO itab.
WRITE: / itab-carrid, itab-connid.
ENDLOOP.
ENDFUNCTION.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dynamic Programming | Динамическое программирование All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.