Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Use of EXIT_SAPLMRMP_004 to change MIRO item text

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

former_member188827
Active Contributor

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

19 REPLIES 19

Former Member
0 Kudos

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


0 Kudos

Hi Mohammad,

I am not able to understand the above solution.

Request you to explain in detail.

Thanks & Regards

Akshay

0 Kudos

BADI invoice_update is not letting me to change the value.

0 Kudos

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 ).

0 Kudos

Hi Sijin ,

Can you pls tell where to enhance code ?

0 Kudos

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.

former_member188827
Active Contributor

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

0 Kudos

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.

0 Kudos

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.

0 Kudos

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

0 Kudos

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

0 Kudos

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

0 Kudos

Thanks a lot for your reply. got the concept.

0 Kudos

Wowww Thanks a lot for your answer... it solved one of my problem...!!

Thanks a lot for your answer...!!

0 Kudos

Thank you for the solution.

0 Kudos

Thank you very much. It's work. Good solution.

Have a nice day!

former_member946717
Contributor
0 Kudos

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.

eduardo_hinojosa
Active Contributor

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