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: 

Add custom field to header level in me51n

Former Member
0 Kudos

Hello Expert,

hi all of you!!

I want to add a customer detail tab at header level and i tried using user exit mereq001 using tcode cmod.

but not achieving target. can any body provide me step by step flow to achieve the target.

thanks and regard

bipin

6 REPLIES 6

former_member193464
Contributor
0 Kudos

hi,
I dont think any standard is available to implement header . Best way is to implement in item level just make the values independent of the item level or repeat for every item.

0 Kudos

Hi Maverick

Thanks for reply.

i also tried on item lavel but my tab is comming over there but when i m clicking on that tab it is giving abap error regarding screen.

pls provide me some doc how to achieve that.

thanks and regard

bipin

0 Kudos

hi,
     I think you have to do a little bit of analysis and it would be done. I found these steps may be they will be helpful to you

Here is the step by step instruction:

1) Using SE11 activate ci_ebandb structure, add both header and item related fields.

2) Create a project in CMOD for enhancement MEREQ001.

3) The include for EXIT_SAPLMEREQ_001 :

*&---------------------------------------------------------------------*

*&  Include           ZXM02U01

*&---------------------------------------------------------------------*

TABLES : ci_ebandb.

DATA : lv_mereq_item TYPE mereq_item.

CALL METHOD im_req_item->get_activity

  RECEIVING re_aktvt = cur_activity.

CASE cur_activity.

  WHEN 'A'.

  flag_input = SPACE.

  WHEN 'V'.

  flag_input = 'X'.     "Modify

ENDCASE.

IF im_req_item IS INITIAL.

  CLEAR: ci_ebandb.

ELSE.

  lv_mereq_item = im_req_item->get_data( ).

  MOVE-CORRESPONDING lv_mereq_item TO ci_ebandb.

endif.

4) The include for EXIT_SAPLMEREQ_003 :

*&---------------------------------------------------------------------*

*&  Include           ZXM02U03

*&---------------------------------------------------------------------*

DATA : l_mereq_item TYPE mereq_item.

DATA : o_mereq_item TYPE mereq_item.

DATA : rootPR TYPE REF TO IF_PURCHASE_REQUISITION.

DATA : om_req_item TYPE REF TO IF_PURCHASE_REQUISITION_ITEM.

DATA : PRcont TYPE MMPUR_REQUISITION_ITEMS.

DATA : PRline TYPE MMPUR_REQUISITION_ITEM.

IF NOT im_req_item IS INITIAL.

  l_mereq_item = im_req_item->get_data( ).

  HEADER_CHANGED = 'N'.

  IF ci_ebandb-zzssj NE l_mereq_item-zzssj or ci_ebandb-zzdepartment NE l_mereq_item-zzdepartment.

    SSJ = ci_ebandb-zzssj.

    DEPARTMENT = ci_ebandb-zzdepartment.

    HEADER_CHANGED = 'Y'.

  ENDIF.

" The below block distributes the values to all PR items

  IF HEADER_CHANGED = 'Y'.

    rootPR = im_req_item->get_requisition( ).

    PRcont = rootPR->get_items( ).

    LOOP AT PRcont INTO PRLine.

      om_req_item = PRLine-item.

      o_mereq_item = om_req_item->get_data( ).

      o_mereq_item-zzssj = SSJ.

      o_mereq_item-zzdepartment = DEPARTMENT.

      CALL METHOD om_req_item->set_data( o_mereq_item ).

    ENDLOOP.

  ENDIF.

" The below is done because I have additional item level fields as well.

  MOVE-CORRESPONDING  ci_ebandb TO l_mereq_item .

  CALL METHOD im_req_item->set_data( l_mereq_item ).

  ex_changed = 'X'.

ENDIF.

5) I've defined few variables in ZXM02TOP through SE80 (Functional module XM02). But probably we can define them somewhere else....

*&---------------------------------------------------------------------*

*&  Include           ZXM02TOP

*&---------------------------------------------------------------------*

data : cur_activity type aktvt.

DATA : flag_input TYPE FLAG.

DATA : SSJ(1) TYPE C.

DATA : DEPARTMENT(20) TYPE C.

DATA : HEADER_CHANGED(1) TYPE C.

6) Draw the subscreen 111 in the Project. Place the fields using F6 button. Type ci_ebanbd (because we defined it in ZXM02U01

) and click "Get from Dictionary".

7) Add the PBO module to the screen. It will control the ability to edit fields.

MODULE LOOP_SCREEN OUTPUT.

"   CHECK flag_input IS INITIAL.

    LOOP AT SCREEN.

"      if  sy-tcode = 'ME51N' or sy-tcode = 'ME52N' or ( sy-tcode = 'ME53N' and flag_input = 'X' ).

      if flag_input = 'X'.

      screen-input = 1.

      else.

      screen-input = 0.

      endif.

      modify screen.

    endloop.

ENDMODULE.

That's it.

I found it over net just check it and customise it as per your requirement .

0 Kudos

thanks Maverick

I am trying these steps

0 Kudos

Hi Maverick

I tried step given by you and my tab is coming on Item level but when i m clicking on it i m getting abap run time error with dump.

Dear Maverick first- i activate CI_EBANDB st. in EBAN table and added AAISM01 field ( data element  CHAR4, data type CHAR) on the same structure

second- i create a screen double clicking on bellow option.

SAPLMEGUI                  0014 SUB0 SAPLXM02                   0111

  and call the same table field on it and then save check and activate.

but now i am not sure that what code should added on the Function EXIT to transfer data to the sub screen and to read the data from the subscreen .

1/EXIT_SAPLMEREQ_001

2/  EXIT_SAPLMEREQ_003

and on PBO and PAI of the screen

Please help me

thanks and regard

bipin

0 Kudos

what does the dump say ?

in the exit03 you have to make sure that every line item gets the same value you can check in the example above it uses a loop and assigns it. ,

in exit01 you set data to the screen.

lv_mereq_item = im_req_item->get_data( ).

  MOVE-CORRESPONDING lv_mereq_item TO ci_ebandb.

you are setting data back to the screen.

in the above example you can see he sets the data in PBO you will set screen enable and disable as per the tcode being executed...