Use BAdI to set text to Purchase Document’ header text field (Example for Vendor)
For some multinational companies, there is a scenario that is two different vendor text descriptions in the vendor master be maintained by two different languages for a single vendor.
Here we assume there is a vendor named as Vendor-S, and
a). the vendor text description-1 which is stored in the LFA1-NAME1 is language-A
b). the vendor text description-2 which is stored in the LFA1-NAME4 is language-B
Then when a Purchase Order be created for purchasing some materials from Vendor-S,
when use ME23N to check that PO, we found that just the text description-1 be displayed in the Purchase Order’s Vendor field.
For those users who using language-B, when she/he check that PO, it is really difficult to know which the vendor is.
For online confirmation, if it is required for a language-B user to check that PO, the user has to check the vendor master to know which the vendor really is.
And it is more difficult to know the which vendor is when the PO be outputted as a paper document.
Here is a simple solution to solve this problem, that is use a BAdI to do an Enhancement to let the language-B can be outputted automatically in the PO’s ‘Text’ Tab’ s Header text field when there user logon SAP R/3 by language-B.
Here we use BAdI Interface IF_EX_ME_PROCESS_PO_CUST to realize it.
In the method IF_EX_ME_PROCESS_PO_CUST~PROCESS-HEADER, add the below ABAP source codes.
DATA: LT_TEXTLINES TYPE MMPUR_T_TEXTLINES,
LS_TEXTLINES TYPE MMPUR_T_TEXTLINES,
LS_SUPERFIELD TYPE STRING,
LW_NAME4 TYPE LFA1-NAME4,
HEADER_DATA TYPE MEPOHEADER.
HEADER_DATA = IM_HEADER->GET_DATA( ).
* When Logon SAP R/3 with language-B (Here assume the language-B is Japanese)
IF SY-LANGU = ‘J’.
SELECT SINGLE NAME4
WHERE LIFNR = HEADER_DATA-LIFNR.
INTO L_SUPERFIELD SEPARATED BY SPACE.
MOVE ‘EBANH’ TO LS_TEXTLINES-TDOBJECT.
MOVE ‘F01’ TO LS_TEXTLINES-TDID.
MOVE ‘*’ TO LS_TEXTLINES-TDFORMAT.
MOVE L_SUPERFIELD TO LS_TEXTLINES-TDFORMAT.
APPEND LS_TEXTLINES TO LT_TEXTLINES.
* Set Venor’s language-B(Japanese) description text into Purchase Order ‘Texts’ —> ‘Header Texts
CALL METHOD IM_HEADER->IF_LONGTEXTS_MM~SET_TEXT(
IM_TDID = ‘F01’
IM_TEXTLINES = LT_TEXTLINES ).
By these solution, there is more easier and friendly to confirm which the vendor is for language-B users when they logon SAP R/3 by language-B.