2013 Jul 22 2:26 AM
Dear All,
I want to change the MIRO item text using EXIT_SAPLMRMP_004 i.e. Material Document header text should be copied to MIRO item text.
Request you to let me know how can I use the exit.
Thanks & Regards
Akshay
2013 Jul 23 5:35 AM
In BADI "MRM_HEADER_CHECK",method HEADERDATA_CHECK, please proceed as follows:
LOOP AT ti_drseg INTO ls_drseg.
lv_index = sy-tabix.
ls_drseg-sgtxt = i_rbkpv-bktxt.
MODIFY ti_drseg FROM ls_drseg INDEX lv_index.
ENDLOOP.
FIELD-SYMBOLS: <drseg> TYPE mmcr_tdrseg.
ASSIGN ('(SAPLMR1M)ydrseg[]') TO <drseg>.
<drseg> = ti_drseg[].
Regards
2013 Jul 22 3:46 AM
Hi Akshay,
This EXIT will not save the text in database.
Here is the solution it is a 2 STEP.
Use BADI : INVOICE_UPDATE,
Method : CHANGE_BEFORE_UPDATE
EXPORT RBKP-BKTXT TO MEMORY ID 'HEAD_TEXT'.
With the help of a function write a substitution for SGTXT of type exit.
Details
http://wiki.sdn.sap.com/wiki/display/ERPFI/Creating+user+exits+for+substitutions
http://wiki.sdn.sap.com/wiki/display/ERPFI/How+to+define+a++substitution+in+FI+with+an+example.
In the EXIT
IMPORT bseg-sgtxt FROM MEMORY ID 'HEAD_TEXT'.
Don't forget to mention the SY-TCODE validation for the same.
Regards
2013 Jul 23 5:02 AM
Hi Mohammad,
I am not able to understand the above solution.
Request you to explain in detail.
Thanks & Regards
Akshay
2013 Jul 23 5:04 AM
2013 Jul 23 6:20 AM
Hello Akshay ,
The Customer Exit you have opted i.e LMR1M004 for changing MIRO documents line item's texts is 100% correct , the only issue is that you wouldn't be able to get RBKP-BKTXT inside this EXIT.
So for that you can Implement an Implicit Enhancement in the MIRO's source code ( for EXPORTING RBKP-BKTXT value ).
2013 Jul 23 7:41 AM
2013 Jul 23 10:15 AM
Hello ,
Include LMR1MF6P ( of MIRO source code )
Implicitly enhance at this point to export RBKP-BKTXT
eg :
DATA VAR_BKTXT TYPE RBKP-BKTXT.
IF i_rbkpv-BKTXT IS NOT INITIAL.
VAR_BKTXT = i_rbkpv-BKTXT.
EXPORT VAR_BKTXT TO MEMORY ID 'ZMM_MIRO'.
ENDIF.
Now this can be IMPORTED in the Customer Exit LMR1M004 ( EXIT_SAPLMRMP_004 )
Write ,
IF E_SGTXT is initial. " VERY IMPORTANT SO THAT USER CAN STILL MANTAIN IT MANUALLY WHEREVER NEEDED
IMPORT VAR_BKTXT FROM MEMORY ID 'ZMM_MIRO'
E_SGTXT = VAR_BKTXT .
ENDIF.
2013 Jul 23 5:35 AM
In BADI "MRM_HEADER_CHECK",method HEADERDATA_CHECK, please proceed as follows:
LOOP AT ti_drseg INTO ls_drseg.
lv_index = sy-tabix.
ls_drseg-sgtxt = i_rbkpv-bktxt.
MODIFY ti_drseg FROM ls_drseg INDEX lv_index.
ENDLOOP.
FIELD-SYMBOLS: <drseg> TYPE mmcr_tdrseg.
ASSIGN ('(SAPLMR1M)ydrseg[]') TO <drseg>.
<drseg> = ti_drseg[].
Regards
2013 Jul 23 6:25 AM
Hi,
It is giving me syntax error for line MODIFY ti_drseg FROM ls_drseg INDEX lv_index.
as ti_drseg is Importing parameter and not exporting one.
2013 Jul 23 6:48 AM
I have tried the code and its not giving me any syntax error.However, try something as follows:
FIELD-SYMBOLS: <drseg> TYPE mmcr_tdrseg.
ASSIGN ('(SAPLMR1M)ydrseg[]') TO <drseg>.
<drseg> = ti_drseg[].
FIELD-SYMBOLS: <drseg> TYPE mmcr_tdrseg.
ASSIGN ('(SAPLMR1M)ydrseg[]') TO <drseg>.
<drseg> = ti_drseg[].
LOOP AT <drseg> into ls_drseg.
lv_index = sy-tabix.
ls_drseg-sgtxt = i_rbkpv-bktxt.
MODIFY <drseg> FROM ls_drseg INDEX lv_index.
ENDLOOP.
2013 Jul 24 3:15 AM
Hi,
Thanks a lot for your reply. It helped me in solving my problem.
Just one question, what does following syntax assign.
ASSIGN ('(SAPLMR1M)ydrseg[]') TO <drseg>.
Best regards,
Akshay
2013 Jul 24 5:38 AM
BADI "MRM_HEADER_CHECK" has import paramter "ti_drseg" so its values cannot be changed.In program SAPLMR1M (Function Group MR1M) internal table ydrseg contains MIRO line items. The statement
ASSIGN ('(SAPLMR1M)ydrseg[]') TO <drseg>.
allows to assign memory area of ydrseg of SAPLMR1M to field-symbol <drseg>. Hence any changes to drseg are reflected directly in program.
Regards
2013 Jul 24 5:39 AM
BADI "MRM_HEADER_CHECK" has import paramter "ti_drseg" so its values cannot be changed.In program SAPLMR1M (Function Group MR1M) internal table ydrseg contains MIRO line items. The statement
ASSIGN ('(SAPLMR1M)ydrseg[]') TO <drseg>.
allows to assign memory area of ydrseg of SAPLMR1M to field-symbol <drseg>. Hence any changes to drseg are reflected directly in program.
Regards
2013 Jul 24 5:53 AM
2020 Jun 16 3:22 PM
Wowww Thanks a lot for your answer... it solved one of my problem...!!
2020 Jun 16 3:25 PM
2020 Oct 19 9:22 AM
2021 Aug 11 1:25 PM
Thank you very much. It's work. Good solution.
Have a nice day!
2013 Jul 23 8:20 AM
Hi Akshay,
You need to first created a Z project in CMOD. Then assign this exit to that project. Only then it will let you edit the include in this exit. You might find some already implemented projects in CMOD and can follow the same to create yours. Let me know if you need any more information.
2013 Jul 23 11:18 AM
Hi
This exit gives the chance to populate the field SGTXT in RSEG table and how it flows to FI (in table BSEG) but it doesn't populate fields SGTXT for automatic items (for instance, taxes).
As other colleagues suggest you, there other most powerful tools, as BADI's (see Note 1156325 - BAdIs in the Logistics Invoice Verification environment) or BTE as BTE 00001120 (see for instance SAP Note 878340 - Substitution user-defined fields (CI_COBL) with BTE 00001120)
If you want to use this enhancement, look for the enhancement with the help of table MODSAP (tcode SE16), and with tcode CMOD create a project with enhancement LMR1M004. Double clic on ZX* include (it's in your range name objects) and write your coding (populate SGTXT with up to 50 characters). Activate all objects.
Regards
Eduardo