Skip to Content
0
Former Member
Jan 16, 2008 at 03:58 AM

PASSING GLOBAL VARIABLES TO BAPI'S

79 Views

Hi all,

I want to pass global variables to many bapi's

I have created a node with 3 attributes of type(structure) BAPI_BCA_STR_CN_ACCT_EXT.

now i am using a service call to call the required bapi,inside this method i am writing this code...

  • declarations for context navigation

DATA lo_bapi_bca_paymitem_ge TYPE REF TO if_wd_context_node.

DATA lo_changing TYPE REF TO if_wd_context_node.

DATA lo_paymentitemdetail TYPE REF TO if_wd_context_node.

  • DATA lo_importing_1 TYPE REF TO if_wd_context_node.

  • DATA lo_accountident TYPE REF TO if_wd_context_node.

DATA lo_account_details TYPE REF TO if_wd_context_node .

DATA lo_element TYPE REF TO if_wd_context_element.

DATA lt_elements TYPE wdr_context_element_set.

  • declarations for parameters

  • DATA ls_c_accountident TYPE if_componentcontroller=>element_accountident.

DATA ls_account_details TYPE if_componentcontroller=>element_account_details.

DATA lt_c_paymentitemdetail TYPE if_componentcontroller=>elements_paymentitemdetail.

DATA ls_c_paymentitemdetail LIKE LINE OF lt_c_paymentitemdetail.

DATA lt_c_paymentitemdetail_cp TYPE if_componentcontroller=>elements_paymentitemdetail.

  • get all involved child nodes

lo_bapi_bca_paymitem_ge = wd_context->get_child_node( wd_this->wdctx_bapi_bca_paymitem_ge ).

lo_changing = lo_bapi_bca_paymitem_ge->get_child_node( wd_this->wdctx_changing ).

lo_paymentitemdetail = lo_changing->get_child_node( wd_this->wdctx_paymentitemdetail ).

  • lo_importing_1 = lo_bapi_bca_paymitem_ge->get_child_node( wd_this->wdctx_importing_1 ).

  • lo_accountident = lo_importing_1->get_child_node( wd_this->wdctx_accountident ).

lo_account_details = wd_context->get_child_node( wd_this->wdctx_ACCOUNT_DETAILS ).

  • get input from context

  • lo_element = lo_accountident->get_element( ).

  • lo_element->get_static_attributes(

  • IMPORTING static_attributes = ls_c_accountident ).

  • lt_elements = lo_paymentitemdetail->get_elements( ).

  • LOOP AT lt_elements[] INTO lo_element.

  • lo_element->get_static_attributes( IMPORTING static_attributes = ls_c_paymentitemdetail ).

  • INSERT ls_c_paymentitemdetail INTO TABLE lt_c_paymentitemdetail[].

  • ENDLOOP.

*

  • lt_c_paymentitemdetail_cp = lt_c_paymentitemdetail[].

*

  • get input from context

lo_element = lo_account_details->get_element( ).

lo_element->get_static_attributes(

IMPORTING static_attributes = ls_account_details ).

lt_elements = lo_paymentitemdetail->get_elements( ).

LOOP AT lt_elements[] INTO lo_element.

lo_element->get_static_attributes( IMPORTING static_attributes = ls_c_paymentitemdetail ).

INSERT ls_c_paymentitemdetail INTO TABLE lt_c_paymentitemdetail[].

ENDLOOP.

lt_c_paymentitemdetail_cp = lt_c_paymentitemdetail[].

  • the invocation - errors are always fatal !!!accountident = lo_accountident

CALL FUNCTION 'BAPI_BCA_PAYMITEM_GET_LIST'

EXPORTING

account_details = lo_account_details

" datefrom = wd_this->datefrom

" dateto = wd_this->dateto

" maxrows = wd_this->maxrows

" processextension = wd_this->processextension

" openlog = wd_this->openlog

" withnotes = wd_this->withnotes

" valuedatefrom = wd_this->valuedatefrom

" valuedateto = wd_this->valuedateto

" IMPORTING

" morerows = wd_this->morerows

" archpostdate = wd_this->archpostdate

TABLES

" extensionin =

paymentitemdetail = lt_c_paymentitemdetail

" itemstatus =

" itemtype =

" return =

" extensionout =

" paymentitemnotes =

.

  • store output to context

IF lt_c_paymentitemdetail[] NE lt_c_paymentitemdetail_cp[].

lo_paymentitemdetail->bind_table( lt_c_paymentitemdetail[] ).

ENDIF.

CLEAR lt_c_paymentitemdetail_cp[].

CLEAR lt_c_paymentitemdetail[].

ENDMETHOD.

BUT IT IS SHOWING A RUN-TIME ERROR....PLZ HELP ME SOLVE IT,

Thanks n regards,

Urvashi