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

How to test a Function Module by passing in an internal table?

Former Member
0 Likes
4,028

Hi,

I am going to use this FM CRM_ORDER_READ_OW in my transformation routine in SAP BI to calculate the SLA Duration.

SLA Duration  = Time case confirmed/report generated - Case creation

I am referring to table SCAPPTSEG to get the time from (TST_FROM) and time to (TST_TO) of the APPT_TYPE = Z_DT_CREATED (case creation) & Z_DT_CONFIRM (case confirmed) by passing in the GUID value to the field APPL_GUID as shown below.

Before I use this FM, I would like to do a test run (test/execute F8) on the FM.

I want to pass the GUID/APPL_GUID = 00505605000903D0BBB625D2F08147D7 into the internal table IT_HEADER_GUID and pass the values Z_DT_CREATED & Z_DT_CONFIRM into the internal table IT_REQUESTED_OBJECTS so that the SLA Times will be exported into the parameter ET_APPOINTMENT.

Can someone guide me on how to do this test run? I am not sure on how to pass the values.

Please help. Let me know if you have any further questions.

Thank you very much!

Kind regards,

Rebekah

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,577

Hi Rebekah,

CRM_ORDER_READ is a function module which can be used to get the details of any business transaction based on the Header GUID, Item GUID or both.

You can use the report program CRM_ORDER_READ in SE38 to test along with Requested Objects to optimize performance.

Regards

Jagathshree

Hi,

I am going to use this FM CRM_ORDER_READ_OW in my transformation routine in SAP BI to calculate the SLA Duration.

SLA Duration  = Time case confirmed/report generated - Case creation

I am referring to table SCAPPTSEG to get the time from (TST_FROM) and time to (TST_TO) of the APPT_TYPE = Z_DT_CREATED (case creation) & Z_DT_CONFIRM (case confirmed) by passing in the GUID value to the field APPL_GUID as shown below.

Before I use this FM, I would like to do a test run (test/execute F8) on the FM.

I want to pass the GUID/APPL_GUID = 00505605000903D0BBB625D2F08147D7 into the internal table IT_HEADER_GUID and pass the values Z_DT_CREATED & Z_DT_CONFIRM into the internal table IT_REQUESTED_OBJECTS so that the SLA Times will be exported into the parameter ET_APPOINTMENT.

Can someone guide me on how to do this test run? I am not sure on how to pass the values.

Please help. Let me know if you have any further questions.

Thank you very much!

Kind regards,

Rebekah

16 REPLIES 16
Read only

Arun_Prabhu_K
Active Contributor
0 Likes
3,577

Hi Rebekah,

     Just click the icon adjacent to the internal table and you can enter the values for testing.

Regards.

Read only

0 Likes
3,577

Hi,

I am not able to enter any values. Pls see screen attached.

Thank you!

Rebekah

Read only

0 Likes
3,577

Rebekah,

     Seems like missing authorization.Contact your BASIS team.

Regards.

Read only

Former Member
0 Likes
3,577

Two things :

1. In IT_REQUESTED_OBJECTS pass APPOINTMENT, so that it reads only the dates in the transaction.

2. You can use the report CRM_ORDER_READ to test .

/Hasan

Read only

Former Member
0 Likes
3,578

Hi Rebekah,

CRM_ORDER_READ is a function module which can be used to get the details of any business transaction based on the Header GUID, Item GUID or both.

You can use the report program CRM_ORDER_READ in SE38 to test along with Requested Objects to optimize performance.

Regards

Jagathshree

Read only

0 Likes
3,577

Hi,

I know the input for Header GUID which is 00505605000903D0BBB625D2F08147D7 but what do I input for the Item GUID? Where do I state the Appointment Type which is Z_DT_CREATED & Z_DT_CONFIRM?

Please advice.

Thank you!

Rebekah

Read only

0 Likes
3,577

Hi sunil,

You just have to pass the header guid( transaction guid ) in IT_HEADER_GUID and APPOINTMENT in IT_REQUESTED_OBJECTS .

In return you will get the table IT_APPOINTMENT where you will get an entry for APPT_TYPE =  Z_DT_CREATED and Z_DT_CONFIRM .

Please check using the report CRM_ORDER_READ as I explained in my previous comment as well.

/Hasan

Read only

0 Likes
3,577

Hi Hasan,

I think I managed to figure it out. I ONLY passed in the

ITEM GUID = 00505605000903D0BBB625D2751A07D3 which I obtained from the table CRMD_ORDERADM_I into the report and below is the results that I got.

Therefore Z_DT_CREATED = 19.11.2012 18:09:33 CET and

              Z_DT_CONFIRM = 26.11.2012 18:09:33 CET.

Is this all that the FM does? Because my main aim is to calculate the duration in HOURS between these 2 timestamps.

Please advice how I can achieve this.

Thank you very much!

Rebekah

Read only

0 Likes
3,577

Hi Sunil,

Try using the FM : CCU_TIMESTAMP_DIFFERENCE. That should help .

/Hasan

Read only

0 Likes
3,577

you can use the report CRM_ORDER_READ but cannot use the fm for testing.. it wont work that way

Read only

Former Member
0 Likes
3,577

Hi Rebekah,

Copy this report and and run it with break points to test the function module

http://ptunkicrm.blogspot.ae/

If you want to get the document flow information only, you can use FM CRM_DOC_FLOW_READ_DB.

With FM CRM_DOC_FLOW_READ_DB, only the current document's GUID (IV_HEADER_GUID) is required to get its linked document's GUID.

Read only

Former Member
0 Likes
3,577

Hi Rebekah,

You can't populate Import Table with GUIDs...or better: with RAW (Hex) Fields

And  CRMT_OBJECT_GUID_TAB contains only RAW GUIDs. Only way to do this is to create a Dummy test Report.

Regards,

Adithi

Read only

0 Likes
3,577

Hi,

Strange but not a single word in your response is different  to what Former Member said(even the smiley matches ) in the below thread no wonder we are in the age of Copy-Paste and guess what problem is also similar...

http://scn.sap.com/thread/3395980

Cheers,

Arindam

Read only

0 Likes
3,577

LOL !!

Read only

0 Likes
3,577

Hello,

The question made me wonder how to test IMPORT parameters with TABLE TYPES and wanted to see if I am seeing it all wrong. And hence started the discussion.

My bad for pasting the same. 😛

Regards, 

Adithi

Read only

0 Likes
3,577

Hi,

i dont have CRM functions in our current system but

to test table types import parameters

you can use F8 to test and enter values but better to write it i think

saves you time if you do need to change many times.

The key here is to know the table type you are passing, check the subroutine test..

here is some code snippet:

FUNCTION Z_TEST.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     REFERENCE(IT_MARA) TYPE  MARA_TT

*"  EXPORTING

*"     REFERENCE(ET_MARC) TYPE  MARC_TT

*"  EXCEPTIONS

*"      NO_DATA_FOUND

*"----------------------------------------------------------------------

   BREAK-POINT.

   CHECK IT_MARA IS NOT INITIAL.

**do a

   SELECT

     * FROM MARC INTO TABLE ET_MARC

   FOR ALL ENTRIES IN

     IT_MARA

     WHERE

     MATNR = IT_MARA-MATNR.

   IF SY-SUBRC NE 0 .

     RAISE NO_DATA_FOUND.

   ENDIF.

ENDFUNCTION.

test with the code below

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

*&      Form  test

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

*       text

*----------------------------------------------------------------------*

FORM TEST.

   DATA: LT_MARA TYPE TABLE OF MARA,

         LT_MARC TYPE TABLE OF MARC

         .

FIELD-SYMBOLS: <lfs_mara> like LINE OF lt_mara.

   APPEND INITIAL LINE TO LT_MARA ASSIGNING <LFS_MARA>.

   <LFS_MARA>-MATNR = '10000000'.

   CALL FUNCTION 'Z_TEST'

     EXPORTING

       IT_MARA       = LT_MARA

     IMPORTING

       ET_MARC       = LT_MARC

     EXCEPTIONS

       NO_DATA_FOUND = 1.

ENDFORM.                    "test