2006 Nov 30 4:59 PM
I am trying to use FM K_COSTELEM_SELECT and I see it doens't have any exports but it has a talbe. How can i get at the data in the talbe if it doens't export anything out of the FM.
Ignore last line in my previous reply. Forgot to delete it.
2006 Nov 30 5:03 PM
may be u have to pass some data into the table and it will return the final data within the table.
2006 Nov 30 5:08 PM
Yes i pass data in but is that data going to be avaible to me in code if it doesn't export back out
2006 Nov 30 5:12 PM
Hi,
It will return you the populated internal table back.
Check the code in the FM K_COSTELEM_BAPI_GETLIST.
This function module is calling this function module.
Thanks
Ramakrishna
Message was edited by:
Ramakrishna Ramisetti
2006 Nov 30 5:21 PM
2006 Nov 30 5:22 PM
The output returned by the function module is an internal table of generic type. Its structure would be based on what it returns; which again would be dependent upon how it is called.
For example you can have a program that returns back vendor or customer master records (LFA1 or KNA1) based on how it is called. The program can have just one output parameter, i.e. internal table of type generic, which would contain internal table of LFA1 if it was called to get vendor master record; or would contain internal table of type KNA1 if it is called to get customer master record.
This is same scenario with the function module that you are trying to call. You can store its results in an internal table, say MY_TEMP_TBL, which should be defined in your program as:
DATA: MY_TEMP_TBL OCCURS 0.
Use this as parameter to receive IT_RESULT parameter of your function module.
Regards,
Chetan Singh
You can store its results in variable L_RESULT, which should be defined as
2006 Nov 30 5:23 PM
2006 Nov 30 5:24 PM
2006 Nov 30 5:35 PM
Use the same function module that you are using.
Get the export parameter in the temporary field defined in your program (as described in my previous note).
2006 Nov 30 5:37 PM
Use same function module K_COSTELEM_SELECT. No need to change your code.
2006 Nov 30 6:42 PM
thanks. SO do I just you a read or append statment to load into the table?
2006 Nov 30 6:51 PM
1. First, execute/debug your program to see whether the table is really getting populated after the function call.
2. Then you can read the table in your program by simple internal-table READ statement or loop through it to get the records. You may have to first assign the received parameter to a FIELD-SYMBOL variable before you read it. Field-symbol documentation is available at:
http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm
Hope it helped to resolve your problem.
Regards,
Chetan
2006 Nov 30 7:22 PM
I did what you said and when I debug it has data whne it is in the function module but when it comes back to the program the table,lt_cskb_ex, is empty. here is the code, pretty easy but it is empty
----
----
Work areas *
----
DATA : WA_TPI3K TYPE TPIK3,
WA_TPIR2T TYPE TPIR2T.
DATA: MY_TEMP_TBL TYPE cskb_ex OCCURS 0 WITH HEADER LINE,
lt_cskb_ex TYPE cskb_ex OCCURS 0 WITH HEADER LINE.
----
START-OF-SELECTION
----
START-OF-SELECTION.
PERFORM GET_PM_COST_CAT.
read table lt_cskb_ex into MY_TEMP_TBL.
************************************************************************
END-OF-SELECTION.
************************************************************************
FORM GET_PM_COST_CAT.
CALL FUNCTION 'K_COSTELEM_SELECT'
EXPORTING
kokrs = '1000'
ce_group = 'PMSERVICES'
date_from = date
date_to = dateto
TABLES
it_result = lt_cskb_ex
EXCEPTIONS
no_record_found = 1
group_not_found = 2.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |