Text field in FI Document automatically from MIRO line item

When a purchase order is created to a cost centre, G/L account and cost centre are entered manually. Often Purchase Order only uses short text field as reference, i.e., Material is not mandatory.

 

MIRO process is then done for PO after GR, and the PO text (short text) is copied into MIRO.

 

G/L account line items can be displayed in FBL3N, detailing the document numbers related to the invoice/PO once posted.

 

The field "Text" is defaulted as blank, even if created with reference to a PO, which contains text. Does anybody know of a way to automate process so that the text field is populated with the text from MIRO?

 

 

You can transfer what ever the data from the MIRO to accounting document-using BTE.

 

Go to SE37 - SAMPLE_PROCESS_00001120 (this is the standard BTE for account document posting). Copy this with ZSAMPLE_PROCESS_00001120.

 

In this you cannot modify the tables t_bkpf and t_bseg. you can use t_bkpfsub and t_bsegsub.

 

For this a little bit config is required.

 

1) Go to t-code FIBF-> settings->Products->... of a customer.

Click new entries -> product name- ZPRODUCT, text - any text, RFC dest - ZSAMPLE_PROCESS_00001120, A - enable check box -> save.

2) Go back -> settings -> P/S Modules -> ... of a customer.

Click new entries -> event - 00001120, Product - ZPRODUCT, Ctr - Country key, Appl - FI-FI, Function module - ZSAMPLE_PROCESS_00001120 -> save.

3) Go back -> settings -> Process Modules -> ... of a customer.

Click new entries ->Process - 00001120, Ctr - Country key, Appl - FI-FI, Function module - ZSAMPLE_PROCESS_00001120, Product - ZPRODUCT -> save.

 

Now go to SE37->ZSAMPLE_PROCESS_00001120 logic.

 

loop at t_bkpf.

loop at t_bkpfsub.

move 'your value' to t_bkpfsub-value.

modify t_bkpfsub index sy-tabix.

endloop.

endloop.

 

loop at t_bseg.

loop at t_bsegsub.

move 'your value' to t_bsegsub-value.

modify t_bsegsub index sy-tabix.

endloop.

endloop.

 

''Your value' is imported value.

 

No need to worry about modified values. After execution of BTE it will go to standard program and copy the values of t_bkpfsub] and t_bsegsub to SAP tables. So please be perfect with code. SAP wouldn't allow change the values in t_bkpf and t_bseg values. you can add your own fields in bkpf_subst and bseg_subst.

 

But make sure that; please write the code in FM with conditions like company code doc type etc. because this BTE is very important. It will execute before acc doc is posted. If you do not specify any conditions it will execute for all co codes in acc doc. it will affect business. You can debug this BTE. Put a break point in FM and see the values while post the MIRO.

 

Once import the values free memory id and clear the variables whatever you used in BTE.

1 comment:

  1. I have done the same but it's not stopping at the breakpoint in Z function module

    ReplyDelete