Category Archives: Function modules

K_BALANCE_GET

This function module is very useful, when you want to check current (or historical) ballance of costs and revenues of any cost object, not settled based on the settlement rule.

You need just determine OBJNR from tables AUFK (co orders), VBAP (SD orders) and PROJ(projects)  for particular co object.

I have used that in zreport which shows those ballances for SD orders or production orders after the closing operation are done on the end of the month. It should be in fact zero ballance, when overhead calculation, result analyse and the settlement is done.

'K_BALANCE_GET' "
  EXPORTING
    objnr =                     " onr00-objnr
*   wrttp = '04'                " cosp-wrttp
*   versn = '000'               " cosp-versn
*   bis_gjahr =                 " cosp-gjahr
*   bis_perio =                 " coep-perio
  IMPORTING
    saldo_k =                   " cosp-wkg001
    saldo_o =                   " cosp-wog001
    saldo_v_k =                 " cosp-wkg001
    saldo_v_o =                 " cosp-wog001
    .  "  K_BALANCE_GET

 

wrttp with value ’04’ means actual postings.

bis_gjahr and bis_perio are parameters used when You need to see that balance for different periods, even current ballance is zero .

 

How to read an idoc and how to understand what is wrong?

Work with IDOC is not fun on the user side. Incomming and outcomming idoc , few hundreds per day. Some of them are not correctly created and can not be processed without additional maitenance. User can use standard transaction as WE02 or WE05. But there is an requirement to understand to idoc technology and its structure.

We have connceted our sap system with another third party application. Since that day , number of questions why the idoc can not be processed was increased dramatically. If there is an error, system shows just the first one. You can correct the segment in idoc, or missing master data..but when processed again, new errors are comming again.

Then i made a decision to implement the function module IDOC_READ_COMPLETELY into new zreport.  It reads specified types of  idoc messages and shows all potencional problems in one shot. For example idoc message received from the customer. It contains data for new sales order to be created . number of items can be up to 100 or more.

The report called show_idoc_data can provide simple job. The program compares data from idoc segment with material and vendor master data. If there is an inconsistency (vendor does not exist for sales organisation, material master data ar not complete for plant..etc) users can see it immediatelly. Thne they can update master data and process the idoc again.

 

Believe me, this was real time saving development.