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: 

Plz tell me how this method is populating a field???

Former Member
0 Kudos

&----


*& Include ZP_CL_BBP_DOGUID_ASSIGN

&----


CLEAR: lr_typede, lr_elemde, lv_cl_attr.

lr_typede = cl_abap_typede=>describe_by_data( RESULT ).

lr_elemde ?= lr_typede.

lv_result = lr_elemde->help_id.

REPLACE FIRST OCCURRENCE OF '/BIC/OI' IN lv_result WITH '/BIC/'.

REPLACE FIRST OCCURRENCE OF '/BI0/OI' IN lv_result WITH ''.

ASSIGN lo_bbp_doguid->(lv_result) to <RESULT>.

IF sy-subrc = 0.

  • result value of the routine

RESULT = <RESULT>.

ELSE.

CLEAR RESULT.

ENDIF.

method DESCRIBE_BY_DATA .

data:

CRC type F.

  • get administration information

system-call describe administration

mode 'F' of P_DATA into ADMIN_TAB_LINE-XTYPE

CRC

ADMIN_TAB_LINE-KIND.

  • look at hash tabel wether descr object already exists

read table ADMIN_TAB from ADMIN_TAB_LINE into ADMIN_TAB_LINE.

if SY-SUBRC = 0.

P_DESCR_REF ?= ADMIN_TAB_LINE-REF->GET( ).

if P_DESCR_REF is bound.

return.

endif.

delete table ADMIN_TAB from ADMIN_TAB_LINE.

endif.

  • create new descr object

case ADMIN_TAB_LINE-KIND.

when KIND_ELEM.

raise event CREATE_ELEMDESCR

exporting XTYPE = ADMIN_TAB_LINE-XTYPE.

when KIND_REF.

raise event CREATE_REFDESCR

exporting XTYPE = ADMIN_TAB_LINE-XTYPE.

when KIND_STRUCT.

raise event CREATE_STRUCTDESCR

exporting XTYPE = ADMIN_TAB_LINE-XTYPE.

when KIND_TABLE.

raise event CREATE_TABLEDESCR

exporting XTYPE = ADMIN_TAB_LINE-XTYPE.

endcase.

create object ADMIN_TAB_LINE-REF exporting OREF = RETURNING_REF.

insert ADMIN_TAB_LINE into table ADMIN_TAB.

P_DESCR_REF = RETURNING_REF.

clear RETURNING_REF.

endmethod.

I hardly understood ..from where the data is coming ???from which table....as this include is populating 1 field of my internal table .

Can anybody tell..from which table the data is being fetched???

1 REPLY 1

uwe_schieferstein
Active Contributor
0 Kudos

Hello Ahmed

Assuming that RESULT corresponds to a single field then the following sample report ZUS_SDN_BBP_DOGUID_ASSIGN may explain the logic behind the coding:


*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_BBP_DOGUID_ASSIGN
*&
*&---------------------------------------------------------------------*
*& Thread: Plz tell me how this method is populating a field???
*& https:||<a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="763924"></a>
*&---------------------------------------------------------------------*

REPORT  zus_sdn_bbp_doguid_assign.


DATA: gs_result  TYPE /bic/c5ta0funct_loc_hier-hienm. " simulate /BIC/ structure

DATA: go_typedescr  TYPE REF TO cl_abap_typedescr,
      go_elemdescr  TYPE REF TO cl_abap_elemdescr.

DATA: gd_result     TYPE abap_helpid.

START-OF-SELECTION.

  go_typedescr ?= cl_abap_typedescr=>describe_by_data( gs_result ).
  go_elemdescr ?= go_typedescr.
  gd_result = go_elemdescr->help_id.

  WRITE: / gd_result.

  REPLACE FIRST OCCURRENCE OF '/BIC/C5TA0FUNCT_LOC_HIER-' IN gd_result
                                                          WITH ''.
  WRITE: / gd_result.
  " Result: HIENUM

  ASSIGN lo_bbp_doguid->(gd_result) to <result>.  " Equal to:
" ASSIGN lo_bbp_doguid->hienum      to <result>.

  " Assign succesful, i.e. component exists
  IF ( syst-subrc = 0 ).
    result = <result>. " = lo_bbp_doguid->hienum
  ELSE.
    CLEAR: result.
  ENDIF.


END-OF-SELECTION.

Regards

Uwe