07-25-2014 2:02 PM
hello friends,
my requirement is, for tcode ME51N the CMP Remarks long text field should be mandatory. please check the picture.
best regards,
santanu nayek
07-27-2014 12:31 PM
Hi Santanu -
In the screen shot you provided, the CMP remarks is disabled. Do you want to enable the long text OR issue an error method when blank. Please let us know. In the earlier post, I have mentioned
Check the BADI - ME_PROCESS_REQ_CUST
Two methods (a) PROCESS_ITEM (when something get changed in line item it get triggerd for that particular item when SAVE or Enter (b) CHECK triggers when 'SAVE' or CHECK
PROCESS_ITEM
DATA : lt_textlines TYPE mmpur_t_textlines.
REFRESH : lt_textlines.
CALL METHOD im_item->if_longtexts_mm~get_text
EXPORTING
im_tdid = < You need to check this from the table STXH, Pass TDNAME as PR+Item no
IMPORTING
ex_textlines = lt_textlines.
* You can validate here
PROCESS_CHECK
IF im_header IS NOT INITIAL.
CALL METHOD im_header->get_items
RECEIVING
re_items = li_items.
IF li_items IS NOT INITIAL.
CLEAR: lw_items,lw_req_item.
LOOP AT li_items INTO lw_items.
lif_item = lw_items-item.
IF lif_item IS NOT INITIAL.
CALL METHOD lif_item->if_longtexts_mm~get_text
EXPORTING
im_tdid = < You need to check this from the table STXH, Pass TDNAME as PR+Item no
IMPORTING
ex_textlines = lt_textlines
* You can validate here
ENDIF.
CLEAR lw_req_item.
ENDLOOP.
ENDIF.
ENDIF.
If you see above, I have mentioned * You can validate here.
If you want raise error message.
1. Include the macro mm_messages_mac to your code,
Code - INCLUDE mm_messages_mac
2. Create a meesage class in SE91 and create message in it and use that in next step
3. To raise error, write the folwoing code
If lt_textlines[] is initial.
mmpur_message 'E'
<ZmessageClass>
<Message Number > '
' ' ' ' ' ' ' ' .
ENDIF.
07-25-2014 2:14 PM
Title : how to make long text disabled
Content : long text field should be mandator
I understand that you got in trouble...
Whatever you are required, look for BAdI ME ME_PROCESS_REQ_CUST and in the PROCESS* or CHECK methods for usage of interface IF_LONGTEXTS_MM. (Use search tool also)
Regards,
Raymond
07-25-2014 4:16 PM
This looks like its actually a long text. The simplest way to verify that a longtext exists is to select with the long text key against STXH. If the key exists, then there is a long text. A person could put in a single space and the long text would still be there. But unless you mandate a fixed format to the text so that you can parse it, then that's the best you can do.
If you don't know what your longtext key is, put a break in FM Read_Text. Then go into a the text that you know exists. Your debugger will stop in the FM Read_Text. Looking at the parameter values of Read_text will then give you the key.
Neal
07-25-2014 5:56 PM
Hi Neal,
But since the requirement is that the long text must be mandatory during creation of the PReq ME51N, can't go read the database STXH because the text does not exist in the table until after checks are completed and save is done.
You need to implement badi ME_PROCESS_REQ_CUST as suggested by Raymond, and do your check in the CHECK method. You can access the long texts by going from IM_HEADER->GET_ITEMS method to get the items, then loop over each item and use its IF_LONGTEXTS_MM methods to see if you have the desired long text or not.
Jim
07-27-2014 12:31 PM
Hi Santanu -
In the screen shot you provided, the CMP remarks is disabled. Do you want to enable the long text OR issue an error method when blank. Please let us know. In the earlier post, I have mentioned
Check the BADI - ME_PROCESS_REQ_CUST
Two methods (a) PROCESS_ITEM (when something get changed in line item it get triggerd for that particular item when SAVE or Enter (b) CHECK triggers when 'SAVE' or CHECK
PROCESS_ITEM
DATA : lt_textlines TYPE mmpur_t_textlines.
REFRESH : lt_textlines.
CALL METHOD im_item->if_longtexts_mm~get_text
EXPORTING
im_tdid = < You need to check this from the table STXH, Pass TDNAME as PR+Item no
IMPORTING
ex_textlines = lt_textlines.
* You can validate here
PROCESS_CHECK
IF im_header IS NOT INITIAL.
CALL METHOD im_header->get_items
RECEIVING
re_items = li_items.
IF li_items IS NOT INITIAL.
CLEAR: lw_items,lw_req_item.
LOOP AT li_items INTO lw_items.
lif_item = lw_items-item.
IF lif_item IS NOT INITIAL.
CALL METHOD lif_item->if_longtexts_mm~get_text
EXPORTING
im_tdid = < You need to check this from the table STXH, Pass TDNAME as PR+Item no
IMPORTING
ex_textlines = lt_textlines
* You can validate here
ENDIF.
CLEAR lw_req_item.
ENDLOOP.
ENDIF.
ENDIF.
If you see above, I have mentioned * You can validate here.
If you want raise error message.
1. Include the macro mm_messages_mac to your code,
Code - INCLUDE mm_messages_mac
2. Create a meesage class in SE91 and create message in it and use that in next step
3. To raise error, write the folwoing code
If lt_textlines[] is initial.
mmpur_message 'E'
<ZmessageClass>
<Message Number > '
' ' ' ' ' ' ' ' .
ENDIF.
07-27-2014 6:29 PM
yes sir, actually i want to enable the long text (screen-input = 1) for some specific user. I have found, may be the method "FIELDSELECTION_ITEM' would be helpfull. but i dont know the "metafield" for long text.
07-28-2014 11:08 AM
Hi
I am not sure if you can able achieve the long text in the method FIELDSELECTION_ITEM. In case you want to check the meta field, please check the type group MMMFD (transaction - SE11).
An alternate solution to this is go to SE51, program - SAPLMMTE, screen - 201
In PBO , you have MODULE MODIFY_SCREEN.
Inside it there is subroutine MODULE MODIFY_SCREEN.
In this subroutine you can put a implict enhancement at the begining of the form.
Try to modify the table control value GT_CONTROL. This is again deep structure.
GT_CONTROL[]-TEXTTYPES[]-DISPLAYMODE . You need to check the TDID = the TDID of CMP as in your case and modify it to GT_CONTROL-TEXTTYPES-DISPLAYMODE = ' '
Please put all your relevant check like user ID. transaction code etc to restrict the enhacement is called only the case you want execute otherwise the same screen might be called from other places also.
.
07-31-2014 6:26 AM
Sir, I don't know whether my codes are correct. but it is not working. my code is as follows.
________________________________
ENHANCEMENT 3 ZPO_SHORTTEXT. "active version
BREAK-POINT.
IF SY-TCODE EQ 'ME52N'.
READ TABLE GT_CONTROL-TEXTTYPES INTO L_TEXTTYPE WITH KEY TDID = L_TDID.
CHECK SY-SUBRC EQ 0.
CASE L_TDID.
WHEN 'B05'. << TDID for CMP Remarks
IF L_TEXTTYPE-DISPLAYMODE EQ 'X'
SCREEN-ACTIVE = '0'.
MODIFY SCREEN.
ENDIF.
ENDCASE.
ENDIF.
ENDENHANCEMENT.
07-31-2014 6:40 AM
Can try this, let me know if it works
IF SY-TCODE EQ 'ME52N'.
clear L_TEXTTYPE.
loop at GT_CONTROL-TEXTTYPES INTO L_TEXTTYPE .
if L_TEXTTYPE -TDID = 'B05'
L_TEXTTYPE-DISPLAYMODE = ' '.
modify GT_CONTROL-TEXTTYPES from L_TEXTTYPE transporting DISPLAYMODE.
ENDIF.
ENDIF.
clear L_TEXTTYPE.
endloop.
07-31-2014 8:33 AM
no sir, it's not working.
sir, i want to add one thing,-- when i am using ME_PROCESS_REQ_CUST~CHECK to check if CMP Remarks field is empty or not, i am checking for SY-TCODE EQ 'ME51N' OR 'ME52N' like that. now i have to check for PLANT also. So how can i get the Plant Code at this method.
Thanks & Regards
07-31-2014 9:51 AM
Hi
Can you please share the code between FORM and ENDFORM of the subroutine MODIFY_SCREEN
including the implicit enhancement .
Regarding getting the plant in Method - CHECK here is how u can get it.
IF im_header IS NOT INITIAL.
CALL METHOD im_header->get_items
RECEIVING
re_items = li_items.
IF li_items IS NOT INITIAL.
CLEAR: lw_items,lw_req_item.
LOOP AT li_items INTO lw_items.
lif_item = lw_items-item.
IF lif_item IS NOT INITIAL.
CALL METHOD lif_item->get_data
RECEIVING
re_data = lw_req_item.
* You have the plant here - LW_REQ_ITEM-WERKS
ENDIF.
CLEAR lw_req_item.
ENDLOOP.
ENDIF.
ENDIF.
07-31-2014 10:53 AM
thank you sir -- plant code is solved.
____________________________________________________________________
FORM MODIFY_SCREEN.
DATA: L_TDID LIKE TTXID-TDID,
L_TEXTTYPE LIKE MMPUR_TEXTTYPES.
READ TABLE GT_CONTROL WITH KEY OBJECT = G_TEXTOBJECT.
CHECK SY-SUBRC EQ 0.
L_TDID = GT_CONTROL-CURRENT_NODE(4).
READ TABLE GT_CONTROL-TEXTTYPES INTO L_TEXTTYPE
WITH KEY TDID = L_TDID.
CHECK SY-SUBRC EQ 0.
LOOP AT SCREEN.
CASE SCREEN-GROUP1.
WHEN 'DEL'.
IF L_TEXTTYPE-TEXTFLAG IS INITIAL OR
L_TEXTTYPE-FIXIE EQ '*' OR
L_TEXTTYPE-FIXIE EQ 'N' OR
L_TEXTTYPE-DISPLAYMODE EQ 'X'.
SCREEN-ACTIVE = '0'.
MODIFY SCREEN.
ENDIF.
WHEN 'COP'.
IF L_TEXTTYPE-TEXTFLAG IS INITIAL OR
L_TEXTTYPE-FIXIE NE '*' OR
L_TEXTTYPE-DISPLAYMODE EQ 'X'.
SCREEN-ACTIVE = '0'.
MODIFY SCREEN.
ENDIF.
WHEN 'TC'.
IF L_TEXTTYPE-DISPLAYMODE EQ 'X'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDIF.
ENDCASE.
ENDLOOP.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Form MODIFY_SCREEN, End A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 3 ZPO_SHORTTEXT. "active version
BREAK-POINT.
IF SY-TCODE EQ 'ME52N'.
CLEAR L_TEXTTYPE.
LOOP AT GT_CONTROL-TEXTTYPES INTO L_TEXTTYPE .
IF L_TEXTTYPE-TDID = 'B05'.
L_TEXTTYPE-DISPLAYMODE = 'X'.
MODIFY GT_CONTROL-TEXTTYPES FROM L_TEXTTYPE TRANSPORTING DISPLAYMODE.
ENDIF.
CLEAR L_TEXTTYPE.
ENDLOOP.
ENDIF.
ENDENHANCEMENT.
*$*$-End: (1)---------------------------------------------------------------------------------$*$*
ENDFORM. " MODIFY_SCREEN
07-31-2014 11:02 AM
Hi
If you want to enable the long text.
clear the value of displaymode
(1) Make L_TEXTTYPE-DISPLAYMODE = ' '
(2) Can you put the enhancement, at the beigining of form (not at the end of form).
07-31-2014 1:15 PM
no sir not working
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Form MODIFY_SCREEN, Start A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 2 ZPO_SHORTTEXT. "active version
BREAK-POINT.
DATA: L_TEXTTYPE1 LIKE MMPUR_TEXTTYPES.
IF SY-TCODE EQ 'ME52N'.
CLEAR L_TEXTTYPE1.
LOOP AT GT_CONTROL-TEXTTYPES INTO L_TEXTTYPE1 .
IF L_TEXTTYPE1-TDID = 'B05'.
L_TEXTTYPE1-DISPLAYMODE = ''.
MODIFY GT_CONTROL-TEXTTYPES FROM L_TEXTTYPE1 TRANSPORTING DISPLAYMODE.
ENDIF.
CLEAR L_TEXTTYPE1.
ENDLOOP.
ENDIF.
ENDENHANCEMENT.
*$*$-End: (1)---------------------------------------------------------------------------------$*$*
DATA: L_TDID LIKE TTXID-TDID,
L_TEXTTYPE LIKE MMPUR_TEXTTYPES.
READ TABLE GT_CONTROL WITH KEY OBJECT = G_TEXTOBJECT.
CHECK SY-SUBRC EQ 0.
L_TDID = GT_CONTROL-CURRENT_NODE(4).
READ TABLE GT_CONTROL-TEXTTYPES INTO L_TEXTTYPE
WITH KEY TDID = L_TDID.
CHECK SY-SUBRC EQ 0.
LOOP AT SCREEN.
CASE SCREEN-GROUP1.
WHEN 'DEL'.
IF L_TEXTTYPE-TEXTFLAG IS INITIAL OR
L_TEXTTYPE-FIXIE EQ '*' OR
L_TEXTTYPE-FIXIE EQ 'N' OR
L_TEXTTYPE-DISPLAYMODE EQ 'X'.
SCREEN-ACTIVE = '0'.
MODIFY SCREEN.
ENDIF.
WHEN 'COP'.
IF L_TEXTTYPE-TEXTFLAG IS INITIAL OR
L_TEXTTYPE-FIXIE NE '*' OR
L_TEXTTYPE-DISPLAYMODE EQ 'X'.
SCREEN-ACTIVE = '0'.
MODIFY SCREEN.
ENDIF.
WHEN 'TC'.
IF L_TEXTTYPE-DISPLAYMODE EQ 'X'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDIF.
ENDCASE.
ENDLOOP.
ENDFORM. " MODIFY_SCREEN
08-01-2014 2:28 PM
Hi -
In my system, its working. Not sure why it is not working for u.
Please debug around it or take some help from your seniors in your organization on further this issue .
08-02-2014 2:21 PM
08-06-2014 5:27 AM
sir how did you find out the program and screen no.
SAPLMMTE, screen - 201
08-07-2014 7:41 AM
Hi
Goto ME52N, put your cursor on the text editor field (below the long text and besides the delete button) and then press F1. You will get the pop up . On this pop up, click technical settings and then in the next pop up u will get the details.
08-08-2014 11:26 AM
08-08-2014 1:34 PM
Sir, i want to ask another thing, i have created some custom field in me51n, and those fields are need to be filled when creating a PR. now when i am creating a second line item for a PR in me51n, then the previous values of those custom fields are getting captured, But those fields should be blank.
please help.
08-11-2014 9:49 AM
Hi -
There seems some issues in clering the values. Can you please share your code EXIT_SAPLMEREQ_001 and EXIT_SAPLMEREQ_003 if you have implemented thse exits. Also possible create a new thread as the title of the thread is different.