As an example of a segment that does not contains a field with language information, the implementation of long texts for materials (MATMAS) is described here.
Long texts are stored in segment E1MTXLM. However, the language information is in the superordinate segment E1MTXHM, in field TDSPRAS. You therefore need to create an implementation of BAdI IDOC_DATA_SPRAS_MDMP (transaction SE19). Assign the segments E1MTXHM and E1MTXLM as filters.
Create the following attribute for your class interface:
Attribute |
G_SPRAS Type: Static Attribute |
Visibility |
Protected |
Reference Type |
EDI_DD40_MDMP-SLANGU |
Insert the following coding for the method of your class to be implemented:
method IF_EX_IDOC_DATA_SPRAS_MDMP~READ_SPRAS . if mdmp_segment-segnam = 'E1MTXHM'. have_to_change = ' '. "save used language global g_spras = mdmp_segment-sdata+87(1). "value of field TDSPRAS elseif mdmp_segment-segnam = 'E1MTXLM'. have_to_change = 'X'. used_spras = g_spras."use last saved language endif. endmethod.
The implementation will run based on the filters for the segments E1MTXHM and E1MTXLM. The language used from segment E1MTXHM is globally noted using the attribute G_SPRAS. In this way, the language can be used in the subsequent call in segment E1MTXLM.