Application Development and Automation 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: 
Read only

badi implementaion very urgent please help on coding

Former Member
0 Likes
745

1.Business Logic

In PO creation stage to purchase Asset, users should put “A” in Account Assignment Category field (EKPO - KNTTP) then system will prompt them to put Asset Number in Item Account Assignment filed (MEACCT1000 – ANLN1). After completing all required data, users will do data checking/ENTER, or perform PO posting. In order to avoid duplication system must provide alert mechanism to remain users that the Asset Number keyed in has been purchased. Performing that procedure system should able to compare Asset Number (MEACCT1000 – ANLN1) keyed in against Asset Master where already purchased (ANEK – EBELN).

If Asset Number capitalized, system responses pop up warning with message “Asset has been Purchased, Do you want to continue?” Then Button Yes or Cancel should be provided.(function module popup-to-confirm).

I followed the logic in method as:

Method IF_EX_ME_PROCESS_PO_CUST~PROCESS_ACCOUNT.

DATA:S_DATA TYPE MEPOACCOUNTING,

S_ITEM TYPE REF TO IF_PURCHASE_ORDER_ITEM_MM,

S_HDR TYPE REF TO IF_PURCHASE_ORDER_MM,

S_HDATA TYPE MEPOHEADER,

S_IDATA TYPE MEPOITEM.

s_data = im_account->get_data( ).

s_item = im_account->get_item( ).

s_idata = s_item->get_data( ).

s_hdr = s_item->get_header( ).

s_hdata = s_hdr->get_data( )

      • for futher can u please help in coding.

endmethod.

Thanks&Regards,

sree.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
652

Hi,

Instead of using Process_account method beter use process_item method. it will trigger in all line item of PO.

U can check as given below exp code...

DATA:

ls_header TYPE mepoheader,

lv_pur_ord TYPE REF TO if_purchase_order_mm,

lv_gl_ac TYPE mepoitem,

lv_sakto TYPE sakto.

lv_pur_ord = im_item->get_header( ).

ls_header = lv_pur_ord->get_data( ).

lv_gl_ac = im_item->get_data( ). " Item data

IF lv_gl_ac-knttp NE 'Y'.

MESSAGE e002(zmm_msg).

ENDIF.

for duplicate asset check u have to follow bellow code.

select single ALNL1 from ANEk where ALNL1 = lv_gl_ac-alnl1 .

if sy-subrc = 0.

call function pop_pu_to_confirm FM.

if not FM return value is ' YES'

popup error message........

endif.

endif.

By

Gupta

1.Business Logic

In PO creation stage to purchase Asset, users should put “A” in Account Assignment Category field (EKPO - KNTTP) then system will prompt them to put Asset Number in Item Account Assignment filed (MEACCT1000 – ANLN1). After completing all required data, users will do data checking/ENTER, or perform PO posting. In order to avoid duplication system must provide alert mechanism to remain users that the Asset Number keyed in has been purchased. Performing that procedure system should able to compare Asset Number (MEACCT1000 – ANLN1) keyed in against Asset Master where already purchased (ANEK – EBELN).

If Asset Number capitalized, system responses pop up warning with message “Asset has been Purchased, Do you want to continue?” Then Button Yes or Cancel should be provided.(function module popup-to-confirm).

I followed the logic in method as:

Method IF_EX_ME_PROCESS_PO_CUST~PROCESS_ACCOUNT.

DATA:S_DATA TYPE MEPOACCOUNTING,

S_ITEM TYPE REF TO IF_PURCHASE_ORDER_ITEM_MM,

S_HDR TYPE REF TO IF_PURCHASE_ORDER_MM,

S_HDATA TYPE MEPOHEADER,

S_IDATA TYPE MEPOITEM.

s_data = im_account->get_data( ).

s_item = im_account->get_item( ).

s_idata = s_item->get_data( ).

s_hdr = s_item->get_header( ).

s_hdata = s_hdr->get_data( )

      • for futher can u please help in coding.

endmethod.

Thanks&Regards,

sree.

3 REPLIES 3
Read only

Former Member
0 Likes
653

Hi,

Instead of using Process_account method beter use process_item method. it will trigger in all line item of PO.

U can check as given below exp code...

DATA:

ls_header TYPE mepoheader,

lv_pur_ord TYPE REF TO if_purchase_order_mm,

lv_gl_ac TYPE mepoitem,

lv_sakto TYPE sakto.

lv_pur_ord = im_item->get_header( ).

ls_header = lv_pur_ord->get_data( ).

lv_gl_ac = im_item->get_data( ). " Item data

IF lv_gl_ac-knttp NE 'Y'.

MESSAGE e002(zmm_msg).

ENDIF.

for duplicate asset check u have to follow bellow code.

select single ALNL1 from ANEk where ALNL1 = lv_gl_ac-alnl1 .

if sy-subrc = 0.

call function pop_pu_to_confirm FM.

if not FM return value is ' YES'

popup error message........

endif.

endif.

By

Gupta

Read only

0 Likes
652

really thanks a lot for u r help.

thanks,

sri...

Read only

0 Likes
652

Hi,

Your problem get solved please close this thread. reward.

By

Gupta