Simply,we can use field symbol to identify a specify memory area. Below is the example.
There is a requirement about the enhancement of account document that generated after saving MIRO.The user want to write invice party(Vendor) to the account document item text. Which item-buzid equal 'T' which indicate taxing.
I found the BADI:AC_DOCUMENT to implement this requirement.The method is CHANGE_INITIAL.The exporting parameter of this method is EX_DOCUMENT ,data type is ACC_DOCUMENT_SUBST.So i must use importing parameter IM_DOCUMENT to construct EX_DOCUMENT.But very unluckily,the field PRZNR of ex_document-item-prznr is RAW. And the value will always be '0000'. After executing this BADI ,the field value of prznr of internal table t_accit[] of calling program is also set to '0000'.The MIRO throw an error message about the definition of BUSSINESS PROCESS.After several hours study i found that the field symbol can achieve my requirement by pass the exporting parameter EX_DOCUMENT.
The method CHANGE_INITIAL OF BADI AC_DOCUMENT is called in FM:AC_DOCMENT_CREATE.
The FM: AC_DOCUMENT_CREATE is called in FM:MRM_INVOICE_POST.
AND the FM: MRM_INVOICE_POST is called in MIRO when SAVING.
The TABLES parameter T_ACCIT of FM:AC_DOCUMENT_CREATE contain the line items of account document. And this table is transfered from MRM_INVOICE_POST. The correspond global data is XACCIT in program SAPLMRMP.So we can use field symbol to access data XACCIT in program SAPLMRMP.Below is the code.
DATA: l_v_lifnr TYPE LIFNR.
CHECK SY - TCODE EQ ' MIRO ' .
FIELD - SYMBOLS < ft > TYPE ACCIT_T.
FIELD - SYMBOLS < fs > TYPE ACCIT.
DATA: field TYPE CHAR18 VALUE ' (SAPLMRMP)xaccit[] ' .
ASSIGN (field) TO < ft > .
CHECK SY - SUBRC EQ 0 .
LOOP AT < fT > ASSIGNING < fs > .
IF SY - TABIX EQ 1 .
l_v_lifnr = < fs >- lifnr.
ENDIF.
CHECK < fs >- buzid EQ ' T ' .
< fs >- sgtxt = l_v_lifnr.
ENDLOOP.
endmethod.
I think this usage of field-symbol is very useful in enhancement.But before using this way to change data , we must check the consistency of the data.