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: 

change mode when saving purchase order

former_member445510
Active Participant
0 Kudos

Hi,

I added a new field in my custom data screen at purchase order, when  i save data, it's saved perfect in EKPO, but mode status stay always in change mode. I want to make it as display mode WHEN  I SAVE my purchase order:

Any suggestions ?

Thank u.

13 REPLIES 13

Former Member
0 Kudos

Hi,

Check BADI " ME_PROCESS_PO_CUST" and the method "CHECK".

Try to implement this BADI, hopefully it would help.

Regards,

Sumit

0 Kudos

Thank u .

Do you know how to implement it ? or code example ?

Former Member
0 Kudos

Since you have to change the attribute, you need to use methods based on requirement.

First identify , is your custom field at header level or item level??

If it is at header level, then use method  "FIELDSELECTION_HEADER_REFKEYS" and if it is item level then use method FIELDSELECTION_ITEM_REFKEYS.

These methods will pass either header object or item object, from which you can read your field and change the attribute.

Thanks,

Sumit

0 Kudos

Hi,

this is for the Item level.

i tried a several codes but it doesn't work yet.

Do you have example code.

My added field is ZZTRANSPORT.

0 Kudos

I tried this code :

TYPE-POOLS: mmmfd.
   DATA : po_item TYPE mepoitem.

   FIELD-SYMBOLS: <fs> LIKE LINE OF ch_fieldselection.
   po_item = im_item->get_data( ).

   IF po_item IS NOT INITIAL.
     IF po_item-zztransport IS NOT INITIAL.
       READ TABLE ch_fieldselection ASSIGNING <fs> WITH TABLE KEY metafield = mmmfd_out_netpr.
       IF sy-subrc IS INITIAL.
         <fs>-fieldstatus = '*'. " Display
       ENDIF.
  ENDIF.

But i receive that error:

Field "CH_FIELDSELECTION" is unknown. It is neither in one of the  
specified tables nor defined by a "DATA" statement . . . . . . . . . .  

** When i do break-point in this method, and i test in me22n, the program did not call the method FIELDSELECTION_ITEM_REFKEYS   !!!!!!!

Any suggestion ?


0 Kudos

I tried also this abap code :

MODULE user_command_0111 INPUT.

   if sy-ucomm = 'MESAVE' and   sy-tcode = 'ME22N'.

     loop at screen.
       "if screen-name CS 'EKPO_CI-ZZTRANSPORT'.
         screen-input = 0.
         modify screen.
       "endif.
     endloop.
   endif.
ENDMODULE.  

But it doesn't work..... !!

0 Kudos

Hi,

After PBO of your screen

process before output.

module event_pbo.


module event_pbo output.


  if sy-ucomm = 'MESAVE' and   sy-tcode = 'ME23N'.

loop at screen.
       if screen-name eq '
EKPO_CI-ZZTRANSPORT'.
           SCREEN-ACTIVE = 0. " diable
         endif.
         modify screen.
         exit.
       endif.
     endloop.

endif.

Thanks,

Kiran.


endmodule. 

0 Kudos

this    if sy-ucomm = 'MESAVE' and   sy-tcode = 'ME23N'.

well be never works in PBO, because in PBO i can't get the value of sy-ucomm, it's always empty. !!!

Former Member
0 Kudos

Hi,

Never code for field-attrbutes in PAI. Instead use your code in PBO.

In PAI, just have a flag variable to be populated.

IF FLAG = 'X'.

Your Code for disabling the input.

endif.

0 Kudos

What is Flag ? it's unknown .

i did like that:

MODULE event_pbo OUTPUT.
BREAK-POINT.
   IF flag = 'X'.

     LOOP AT SCREEN.
       IF screen-name EQ 'EKPO_CI-ZZTRANSPORT'.
         screen-active = 0. " diable
       ENDIF.
       MODIFY SCREEN.
       EXIT.

   ENDLOOP.

ENDIF.
ENDMODULE.

it 's not working yet 

Former Member
0 Kudos

My dear FLAG should be declared first as global variable and to be set to' X' in PAI module.

Leave that FLAG, just without FLAG try to use your code in PBO.

LOOP AT SCREEN.

       IF screen-name EQ 'EKPO_CI-ZZTRANSPORT'.

          screen-input = 0. 

         screen-active = 0. " diable

       ENDIF.

       MODIFY SCREEN.

       EXIT.


   ENDLOOP.

After that you will be ale to understand what conditions have to be in place.


0 Kudos

ok.

I write this code now:

data aktyp  type c.


IF aktyp = 'V'.
     LOOP AT SCREEN.
       IF screen-name EQ 'EKPO_CI-ZZTRANSPORT'.
         screen-input = 0. " diable
       ENDIF.
       MODIFY SCREEN.
       EXIT.

     ENDLOOP.
   ENDIF.

but when i debug, i find aktyp always = V, and deed not make any change yet !!!!!!

in my PBO i use already:

module status_0111 output.

   IF sy-tcode EQ 'ME23' OR sy-tcode EQ 'ME23N'.

     LOOP AT SCREEN.
       IF screen-group1 EQ 'A1'.
         screen-input = 0.
         MODIFY SCREEN.
       ENDIF.
     ENDLOOP.
   ENDIF.
endmodule.

And *************************************************

module field_mode output.
  loop at screen.

     if screen-name cs 'EKPO_CI-ZZTRANSPORT'.

       if ( sy-tcode = 'ME21' or sy-tcode = 'ME22' or
            sy-tcode = 'ME21N' or sy-tcode = 'ME22N').

           " screen-input = 1.

       ELSEIF sy-tcode = 'ME23' or sy-tcode = 'ME23N'.

         screen-input = 0.

       endif.

       modify screen.

     endif.

   endloop.
endmodule.                 " field_mode  OUTPUT

0 Kudos

ok, it's works

Thank u.