07-16-2014 9:57 AM
Hi Experts,
I am stuck with one problem regarding Purchase requisition material description. The scenario is as follows.
We have two types of PR creation. With or without material code.
Material description is set to display only. But if the user enters the material code and random description and then press Enter button then the system doesnt pick the description from MAKT and keep the random description and disabling it for input. As shown in below screen shot.
I want to restrict this, So I used the enhancement - MEREQ001 in CMOD and exit - EXIT_SAPLMEREQ_010 and INCLUDE ZXM02U12 , to compare the material description and change it to master data from table MAKT. But the problem here is the original PR data fetched in to the exit is not changing. I have written below code.
+++++++++++++++++++++++++++++++++++++++++++++
LOOP AT im_t_eban INTO l_s_eban.
IF l_s_eban-matnr <> ''.
SELECT SINGLE maktx FROM makt INTO mde
WHERE matnr = l_s_eban-matnr.
IF mde <> l_s_eban-txz01 .
MESSAGE w007(zm_msg) . " DISPLAY LIKE 'E'.
l_s_eban-txz01 = mde.
MODIFY im_t_eban FROM l_s_eban TRANSPORTING txz01. " THIS LINE IS GIVING SYNTAX ERROR THAT im_t_eban is not changeable
ENDIF.
ENDIF.
ENDLOOP.
++++++++++++++++++++++++++++++++++++++
So how to solve this problem??
Or is there any other way to restrict the user to change the material description ??
Thanks,
Vishal .
07-16-2014 12:37 PM
Hi Vishal -
Can you check the BADI - ME_PROCESS_REQ_CUST, Method- PROCESS_ITEM
Sample Code -
DATA: lw_req_item TYPE mereq_item,
lv_maktx TYPE maktx.
CLEAR: lw_req_item ,lv_maktx,lv.
IF im_item IS NOT INITIAL.
CALL METHOD im_item->get_data
RECEIVING
re_data = lw_req_item.
ENDIF.
IF lw_req_item IS NOT INITIAL.
CLEAR lv_maktx.
SELECT SINGLE maktx FROM makt
INTO lv_maktx
WHERE matnr = lw_req_item-matnr
AND spras = sy-langu.
IF ( lv_maktx IS NOT INITIAL AND lw_req_item-txz01 IS NOT INITIAL ).
TRANSLATE lv_maktx TO LOWER CASE.
TRANSLATE lw_req_item-txz01 TO LOWER CASE.
IF lw_req_item-txz01 NE lv_maktx.
* Error Handling if any
* OR you set the value here
lw_req_item-txz01 = lv_maktx
CALL METHOD im_item->set_data
EXPORTING
im_data = lw_req_item.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
07-16-2014 10:06 AM
Hello Vishal.
Did you try reading the screen field (Short Text) value using DYNP_VALUES_READ?
Regards.
07-16-2014 10:11 AM
Hi Arun,
Yes the field - l_s_eban-txz01 in my code above reads the short text entered by the user,
which is ' test' in above screenshot. I compared it with MAKT description and if not matched then giving warning it should over write by MAKT-MAKTX value.
But its not happening as im_t_eban is not modifiable.
Regards,
Vishal
07-16-2014 10:32 AM
Vishal,
No need to modify any internal table.
Just display the error message and EXIT.
That should be sufficient, right?
07-16-2014 10:37 AM
Hi Arun,
No the system should store the material description from MAKT and not the one that the user entered , after the warning message is displayed.
07-16-2014 10:59 AM
Hi Vishal,
If you couldn't found any suitable exits, you can do this using implicit enhancement.
So that you can directly access all variable available at the position where implementing.
Regards
Sreekanth
07-16-2014 11:51 AM
Hi Sreekanth,
Can you please explain some more on what you are suggesting ??
Thanks,
Vishal .
07-16-2014 12:22 PM
Hi,
Steps..
1.Press F1 on any field in table control, to get screen number
2.Press F9, double click on screen number
3.In PAI of this screen find out any suitable perform(inside any module,we can not do implicit enhancement in module,but can do inside a perform in a module).
now follow steps as shown below to implement your own logic.
edit->enhancement operations->show implicit enhancement options
Right click on any suitable ..
07-16-2014 12:36 PM
Hi Sreekanth,
The step-2 for screen number is not working for PR- ME51N.
Check below screen shot.
07-16-2014 12:46 PM
07-16-2014 12:51 PM
Sreekanth,
That is what I did and got the error
Click on the screen shot I posted and in status bar, you can see the error that the screen number 0014 does not exist.
07-16-2014 12:54 PM
07-16-2014 1:29 PM
07-16-2014 11:04 AM
hello abaper,
have a look on this
Hi Gaurav, try this:
http://scn.sap.com/thread/3297154
FIELD-SYMBOLS: <T_EBAN> type mereq_t_eban.
FIELD-SYMBOLS: <im_t_eban> type mereq_t_eban.
DATA: wa_eban LIKE eban.
ASSIGN ('(SAPLMEREQ)LT_EBAN[]') to <T_EBAN> . <-Uncommet this line
LOOP AT <im_t_eban> INTO wa_eban.
* => here you can change the value
SELECT SINGLE matnr maktx into (mcode,mdesc)
FROM makt
WHERE matnr = wa_eban-matnr.
if sy-subrc = 0 .
move mdesc to wa_eban-txz01.
MODIFY <T_EBAN> from wa_eban TRANSPORTING txz01. <-Change the field-symbol for the one that is referencing the standard table
ENDIF.
ENDLOOP.
07-16-2014 12:26 PM
hi swadhin,
I checked the thread, and as the last reply said its gives error.
So please suggest any other solution.
Regards,
Vishal
07-16-2014 12:37 PM
Hi Vishal -
Can you check the BADI - ME_PROCESS_REQ_CUST, Method- PROCESS_ITEM
Sample Code -
DATA: lw_req_item TYPE mereq_item,
lv_maktx TYPE maktx.
CLEAR: lw_req_item ,lv_maktx,lv.
IF im_item IS NOT INITIAL.
CALL METHOD im_item->get_data
RECEIVING
re_data = lw_req_item.
ENDIF.
IF lw_req_item IS NOT INITIAL.
CLEAR lv_maktx.
SELECT SINGLE maktx FROM makt
INTO lv_maktx
WHERE matnr = lw_req_item-matnr
AND spras = sy-langu.
IF ( lv_maktx IS NOT INITIAL AND lw_req_item-txz01 IS NOT INITIAL ).
TRANSLATE lv_maktx TO LOWER CASE.
TRANSLATE lw_req_item-txz01 TO LOWER CASE.
IF lw_req_item-txz01 NE lv_maktx.
* Error Handling if any
* OR you set the value here
lw_req_item-txz01 = lv_maktx
CALL METHOD im_item->set_data
EXPORTING
im_data = lw_req_item.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
07-21-2014 7:46 AM
Thanks alot Atul,
Your solution works fine for me...
Regards,
vishal .