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: 

PO item data - text check

Former Member
0 Kudos

Hi Friends,

Can any body help me I have this scenario..

In PO when user open for change in ME22n i have to copy the Item Text and after user changes don i have to re-check the Item text whether user changed the text or not. If he did any changes in the text i need to raise error meesage.

Thanks

Kumar.

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

Hello Kumar

Assuming that BAdI ME_PROCESS_REQ_CUST is available on your system then you can use the following logic in your BAdI implementing class:

Method IF_EX_ME_PROCESS_REQ_CUST~OPEN has an IMPORTING parameter IM_TRTYP ( Transaction type ).

When a PO is changed IM_TRTYP has probably either of the following values (needs to be verified):

'B' = Edit
'V' = Change

If you have verified that the BAdI implementing class is called while the user changes the PO you can use IMPORTING parameter IM_HEADER (still in method ~OPEN) to retrieve the current PO items incuding their texts:

lt_items = im_header->get_items( ).

This itab contains a list of item references. Using its method (IF_PURCHASE_REQUISITION_ITEM~)GET_DATA you can retrieve the item details (in structure MEREQ_ITEM).

Field MEREQ_ITEM-TXZ01 contains the short text of the PO item.

Store this data when the OPEN method is called and check for changes in method IF_EX_ME_PROCESS_REQ_CUST~CHECK. If the conditions are not met then CH_FAILED = 'X'.

Regards

Uwe

10 REPLIES 10

Former Member
0 Kudos

Hi,

Following user-exits are available for ME23n....

Exit Name Description

LMEDR001 Enhancements to print program

LMELA002 Adopt batch no. from shipping notification when posting a GR

LMELA010 Inbound shipping notification: Transfer item data from IDOC

LMEQR001 User exit for source determination

LMEXF001 Conditions in Purchasing Documents Without Invoice Receipt

LWSUS001 Customer-Specific Source Determination in Retail

M06B0001 Role determination for purchase requisition release

M06B0002 Changes to comm. structure for purchase requisition release

M06B0003 Number range and document number

M06B0004 Number range and document number

M06B0005 Changes to comm. structure for overall release of requisn.

M06E0004 Changes to communication structure for release purch. doc.

M06E0005 Role determination for release of purchasing documents

ME590001 Grouping of requsitions for PO split in ME59

MEETA001 Define schedule line type (backlog, immed. req., preview)

MEFLD004 Determine earliest delivery date f. check w. GR (only PO)

MELAB001 Gen. forecast delivery schedules: Transfer schedule implem.

MEQUERY1 Enhancement to Document Overview ME21N/ME51N

MEVME001 WE default quantity calc. and over/ underdelivery tolerance

MM06E001 User exits for EDI inbound and outbound purchasing documents

MM06E003 Number range and document number

MM06E004 Control import data screens in purchase order

MM06E005 Customer fields in purchasing document

MM06E007 Change document for requisitions upon conversion into PO

MM06E008 Monitoring of contr. target value in case of release orders

MM06E009 Relevant texts for "Texts exist" indicator

MM06E010 Field selection for vendor address

MMAL0001 ALE source list distribution: Outbound processing

MMAL0002 ALE source list distribution: Inbound processing

MMAL0003 ALE purcasing info record distribution: Outbound processing

MMAL0004 ALE purchasing info record distribution: Inbound processing

MMDA0001 Default delivery addresses

MMFAB001 User exit for generation of release order

MRFLB001 Control Items for Contract Release Order

AMPL0001 User subscreen for additional data on AMPL

AWARD IF USEFUL

0 Kudos

Hi Shree,

I know badi & user exits.

How can i store Item-text when user open the PO. If i store some where i can check item-text when user save the PO .

Regards,

Kumar.

0 Kudos

Use the FM READ_TEXT first to read the item text with the following parameters.

Text name as PO Number + Item Number

Language as SY-LANGU

Text ID as F01

Text object as EKPO

Now the item text is in the internal table LINES.

Again before saving use the same FM to to get the item text into a diff internal table LINES1.

Now check if LINES ne LINES1.

then in such case throw an error message.

In order to see the Item texts, select the item number and clk on the texts tab, there double clk on text editor and takes u to text editor then follow path Goto --> Header , there u can see the text header details which can be passed to the READ_TEXT function module.

Also check on FM's SAVE_TEXT

Regards

Gopi

Edited by: Gopi Narendra on Apr 8, 2008 3:52 PM

uwe_schieferstein
Active Contributor
0 Kudos

Hello Kumar

Assuming that BAdI ME_PROCESS_REQ_CUST is available on your system then you can use the following logic in your BAdI implementing class:

Method IF_EX_ME_PROCESS_REQ_CUST~OPEN has an IMPORTING parameter IM_TRTYP ( Transaction type ).

When a PO is changed IM_TRTYP has probably either of the following values (needs to be verified):

'B' = Edit
'V' = Change

If you have verified that the BAdI implementing class is called while the user changes the PO you can use IMPORTING parameter IM_HEADER (still in method ~OPEN) to retrieve the current PO items incuding their texts:

lt_items = im_header->get_items( ).

This itab contains a list of item references. Using its method (IF_PURCHASE_REQUISITION_ITEM~)GET_DATA you can retrieve the item details (in structure MEREQ_ITEM).

Field MEREQ_ITEM-TXZ01 contains the short text of the PO item.

Store this data when the OPEN method is called and check for changes in method IF_EX_ME_PROCESS_REQ_CUST~CHECK. If the conditions are not met then CH_FAILED = 'X'.

Regards

Uwe

0 Kudos

Hi Uwe,

Thanks for reply,

I am little bit confusing plz clarify,

Yes I have Badi. But i need to check "only Item-Text" Immediatly opening of PO and when saving time. If text is not equal i have raise error.

And also the BADI : ME_PROCESS_REQ_CUST is not getting trigger. I took the break point and tested

I hope u r logic will help. Plz clarify so that i do process.

Regards,

Kumar

Edited by: Kumar P on Apr 8, 2008 2:05 PM

0 Kudos

Hi,

Use BADI ME_PROCESS_PO_CUST to meet your requirement.

And in this use method 'CHECK' to check whether the item text has been changed or not and if changed raise an error over here.

{ METHOD if_ex_me_process_po_cust~check.

DATA: p_im_tdid TYPE tdid.

DATA: p_im_textlines TYPE mmpur_t_textlines,

wa_textline LIKE LINE OF p_im_textlines.

DATA: g_it_tdline TYPE STANDARD TABLE OF tline,

wa_tdline LIKE LINE OF g_it_tdline.

DATA lv_name TYPE thead-tdname.

DATA im_data TYPE mepoitem.

DATA: it_items TYPE purchase_order_items,

wa_items LIKE LINE OF it_items.

CALL METHOD im_header->get_items

RECEIVING

re_items = it_items.

LOOP AT it_items INTO wa_items.

CALL METHOD wa_items-item->get_data

RECEIVING

re_data = im_data.

CONCATENATE im_data-ebeln im_data-ebelp INTO lv_name.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'F01'

language = 'E'

name = lv_name

object = 'EKPO'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

lines = g_it_tdline

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8

.

  • CALL METHOD im_item->if_longtexts_mm~set_text

  • EXPORTING

  • im_tdid = p_im_tdid

  • im_textlines = p_im_textlines.

CALL METHOD wa_items-item->if_longtexts_mm~get_text

EXPORTING

im_tdid = 'F01'

IMPORTING

ex_textlines = p_im_textlines

  • EX_TEXT_FORMATTED =

.

ENDLOOP.

LOOP AT g_it_tdline INTO wa_tdline.

READ TABLE p_im_textlines INTO wa_textline INDEX sy-tabix.

IF wa_tdline-tdline <> wa_textline-tdline.

MESSAGE e000(00) WITH 'error'.

EXIT.

ENDIF.

ENDLOOP.

ENDMETHOD. }

This code may help some what for you. but not sure of it.

Reward points if you find it helpful.

Regards,

Prasanna

Edited by: prasanna j on Apr 8, 2008 5:25 PM

0 Kudos

Hi Prasanna,

Thanks for help..

I tried u r code. Both " READ_TEXT and CALL METHOD wa_items-item->if_longtexts_mm~get_text " are giving same text . That text is after changed text. how can i get before changed the PO text. If i get it i will compare and i can raise error.

Thanks & Regards,

Kumar.

Edited by: Kumar P on Apr 9, 2008 7:36 AM

0 Kudos

Hi Use this code.

Reward points

{METHOD if_ex_me_process_po_cust~open.

DATA: p_im_tdid TYPE tdid.

DATA: p_im_textlines TYPE mmpur_t_textlines,

wa_textline LIKE LINE OF p_im_textlines.

DATA: g_it_tdline TYPE STANDARD TABLE OF tline,

wa_tdline LIKE LINE OF g_it_tdline.

DATA lv_name TYPE thead-tdname.

DATA im_data TYPE mepoitem.

DATA: it_items TYPE purchase_order_items,

wa_items LIKE LINE OF it_items.

DATA: l_it_longtext TYPE STANDARD TABLE OF ty_longtext.

DATA: l_wa_longtext TYPE ty_longtext.

CALL METHOD im_header->get_items

RECEIVING

re_items = it_items.

LOOP AT it_items INTO wa_items.

CALL METHOD wa_items-item->get_data

RECEIVING

re_data = im_data.

CONCATENATE im_data-ebeln im_data-ebelp INTO lv_name.

CALL METHOD wa_items-item->if_longtexts_mm~get_text

EXPORTING

im_tdid = 'F01'

IMPORTING

ex_textlines = p_im_textlines

  • EX_TEXT_FORMATTED =

.

LOOP AT p_im_textlines INTO wa_textline.

MOVE wa_textline-tdline TO l_wa_longtext-tdline.

MOVE lv_name TO l_wa_longtext-name.

APPEND l_wa_longtext TO g_it_longtext.

CLEAR l_wa_longtext.

ENDLOOP.

ENDLOOP.

ENDMETHOD.}

{METHOD if_ex_me_process_po_cust~check.

DATA: p_im_tdid TYPE tdid.

DATA: p_im_textlines TYPE mmpur_t_textlines,

wa_textline LIKE LINE OF p_im_textlines.

DATA: g_it_tdline TYPE STANDARD TABLE OF tline,

wa_tdline LIKE LINE OF g_it_tdline.

DATA lv_name TYPE thead-tdname.

DATA im_data TYPE mepoitem.

DATA: it_items TYPE purchase_order_items,

wa_items LIKE LINE OF it_items.

DATA: line1 TYPE i,

line2 TYPE i.

DATA: l_wa_longtext TYPE ty_longtext.

CALL METHOD im_header->get_items

RECEIVING

re_items = it_items.

LOOP AT it_items INTO wa_items.

CALL METHOD wa_items-item->get_data

RECEIVING

re_data = im_data.

CONCATENATE im_data-ebeln im_data-ebelp INTO lv_name.

CALL METHOD wa_items-item->if_longtexts_mm~get_text

EXPORTING

im_tdid = 'F01'

IMPORTING

ex_textlines = p_im_textlines

  • EX_TEXT_FORMATTED =

.

LOOP AT g_it_longtext INTO l_wa_longtext WHERE name = lv_name.

line1 = sy-tabix.

READ TABLE p_im_textlines INTO wa_textline INDEX sy-tabix.

IF wa_tdline-tdline <> wa_textline-tdline.

MESSAGE e000(00) WITH 'error'.

EXIT.

ENDIF.

ENDLOOP.

DESCRIBE TABLE p_im_textlines LINES line2.

IF line2 <> line1.

MESSAGE e000(00) WITH 'error'.

EXIT.

ENDIF.

ENDLOOP.

ENDMETHOD.}

Regards,

Prasanna

Former Member
0 Kudos

Hi Prassanna,

thanks for help.

I tried u r code.

now i am able to through the error. But if i remove total text from line item text OR if i change PO (quantity) which dont have the item text , the function module (Read_text) giving the error like 'Text 110100038000001 ID F02 language EN not found'. If i am not changed anything in the PO the error coming. I think if no data in item text the function module giving the error. In my scenario it is possible some times PO-items without text also. how can i avoid Function module error.

Regards,

Kumar

Former Member
0 Kudos

thanks all.