Application Development 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: 

Acces via null object is not possible in Badi FTR_CUSTOMER Extent

Former Member
0 Kudos

Hi,

I've create implementation for Badi FTR_CUSTOMER extent to add extra tab in order to insert additional input parameter. The input parameter that i need to add is PO number. Below is the step that i've done.

1. Append customised structure to table VTBFHA that consist of PO Number and activate the structure.

2. Create program and sub screen for input parameter and attach that parameter in Badi FTR_CUSTOMER_EXTENT.

3. In PBO of sucscreen, i've add coding as below

  • try to get append data from VTBFHA

CALL METHOD g_proxy_cust_data->get_cust_data

IMPORTING pe_tab_fha_appends = g_tab_fha_appends

exceptions others = 4.

4. Activate the coding with no error

But when i run t-code FTR_EDIT and go to newly added tab, i've got short dump with Access via 'NULL' object reference not possible.

Kindly advice where is the step that i've missing.

PS : i've declare data as follows

  • References to TRTM objects

DATA:

g_proxy_transaction TYPE REF TO if_open_trtm_proxy_deal_data,

g_proxy_cust_data TYPE REF TO if_open_trtm_customer_data,

g_proxy_messages TYPE REF TO if_open_trtm_proxy_message,

g_proxy_fcode TYPE REF TO if_open_trtm_proxy_fcode,

g_proxy_fmod TYPE REF TO if_open_trtm_proxy_fmod.

7 REPLIES 7

Former Member
0 Kudos

Hello Noor,

Problem in your code is you are trying to call a method from a null object.

You need to create / instaniate a object using the "Create Object" statement by passing the variable " g_proxy_cust_data".

Eg : create object g_proxy_cust_data.

Then call your method.

Hope this will resolve your issue.

Thanks,

Greetson

uwe_schieferstein
Active Contributor
0 Kudos

Hello

I could not figure out where the BAdI is acutally triggered but I assume that interface method EVT_APPLICATION_START should be the first method being executed. If you look at the method signature you will find all the object instances (as IMPORTING parameters) you have defined yourself:


PI_PROXY_TRANSACTION	IF_OPEN_TRTM_PROXY_DEAL_DATA
PI_PROXY_MESSAGES	IF_OPEN_TRTM_PROXY_MESSAGE
PI_PROXY_FCODE	         IF_OPEN_TRTM_PROXY_FCODE
PI_PROXY_FMOD	       IF_OPEN_TRTM_PROXY_FMOD
PI_CUST_TRANSACTION	IF_OPEN_TRTM_CUSTOMER_DATA

Thus, if you need permanent access to these instances I would add them as attributes to your BAdI implementing class and store them in method EVT_APPLICATION_START:


method EVT_APPLICATION_START.
  me->mo_proxy_transaction = pi_proxy_transaction.
  me->mo_proxy_messages  = pi_proxy_messages.
...
endmethod.

Then you have access to these instances in every method of your BAdI.

Regards

Uwe

0 Kudos

Hello

I have the same problem: when i run t-code FTR_EDIT and go to newly added tab, i've got short dump with Access via 'NULL' object reference not possible.

I copied function module "FTR_CUSTOM_BADI_SAMPLE_START "into YFAM_FTR_CUSTOM_BADI_SMP_START.

What i did in SE19 for BADI FTR_CUSTOMER_EXTENT:

method IF_EX_FTR_CUSTOMER_EXTENT~EVT_APPLICATION_START.

CALL FUNCTION 'YFAM_FTR_CUSTOM_BADI_SMP_START'

EXPORTING

PI_PROXY_TRANSACTION = PI_PROXY_TRANSACTION

PI_PROXY_MESSAGES = PI_PROXY_MESSAGES

PI_PROXY_FCODE = PI_PROXY_FCODE

PI_PROXY_FMOD = PI_PROXY_FMOD

PI_CUST_TRANSACTION = PI_CUST_TRANSACTION

CHANGING

PC_TAB_BADI_TABS = PC_TAB_BADI_TABS

.

endmethod.

G_PROXY_TRANSACTION has no values any more. It still had when I was in the standard SAP tabpage, for example the tab page "structure".

Arjan

Former Member
0 Kudos

Hi Uwe,

I've facing issue when i tried to call below interface in my program that have subscreen(program A),

  • try to get append data from VTBFHA

CALL METHOD g_proxy_cust_data->get_cust_data

IMPORTING pe_tab_fha_appends = g_tab_fha_appends

exceptions others = 4.

the system doesn't recognize g_proxy_cust_data. When i declare the g_proxy_cust_data in program A, the system will initialize the value.

the value that was given earlier is missing.

Seem like program A is not included in BADI FTR_CUSTOMER_EXTENT.

Any idea on how to include the program?

Regards,

Biah

0 Kudos

Hi,

did u solve the problem?

I want to add an extra tab in tx code TS01 using the badi as u did. The tab is showing, but i dont know how to show a field, because in the subscreen i coudlnt add it.

how did u do it?

please, help me

thanks in advance.

0 Kudos

Hi Miguel Alvear ,

yes, i've solved the problem. I can add new fields and save the info into table.

The badi that you can used is FTR_CUSTOMER EXTENT. Please have a look at function group FTR_CUSTOM_BADI_SAMPLE.

Steps.

1. Copy FG FTR_CUSTOM_BADI_SAMPLE to z FG.

2. Modify screen or add your on code

3. in method if_ex_ftr_customer_extent~evt_application_start call FM FTR_CUSTOM_BADI_SAMPLE_START.

Please remember to add screen number & program no in FTR_CUSTOMER EXTENT.

if you have any inquiry, please revert.

regards,

Biah

0 Kudos

Hi

I have the same problem: when i run t-code FTR_EDIT and go to newly added tab, i've got short dump with Access via 'NULL' object reference not possible.

I copied function module "FTR_CUSTOM_BADI_SAMPLE_START "into YFAM_FTR_CUSTOM_BADI_SMP_START.

What i did in SE19 for BADI FTR_CUSTOMER_EXTENT:

method IF_EX_FTR_CUSTOMER_EXTENT~EVT_APPLICATION_START.

CALL FUNCTION 'YFAM_FTR_CUSTOM_BADI_SMP_START'

EXPORTING

PI_PROXY_TRANSACTION = PI_PROXY_TRANSACTION

PI_PROXY_MESSAGES = PI_PROXY_MESSAGES

PI_PROXY_FCODE = PI_PROXY_FCODE

PI_PROXY_FMOD = PI_PROXY_FMOD

PI_CUST_TRANSACTION = PI_CUST_TRANSACTION

CHANGING

PC_TAB_BADI_TABS = PC_TAB_BADI_TABS

.

endmethod.

G_PROXY_TRANSACTION has no values any more. It still had when I was in the standard SAP tabpage, for example the tab page "structure".

Arjan