Skip to Content
0

After enhancing 0FI_GL_10 via BAdi the enhanced column is not populated

Jan 17, 2017 at 11:09 AM

101

avatar image
Former Member

Hi Experts

After enhancing 0FI_GL_10 via BAdi the enhanced column(TimeStamp) is not populated.

Reference PDF:

BADI enhance datasources in ECC

Abap Code :


SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style: italic;
color: #808080;
}
.L0S32 {
color: #3399FF;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
.L0S70 {
color: #808080;
}

METHOD M_0FI_GL_10.



*declaring a field symbol with type of extract structure of 0FI_GL_10

FIELD-SYMBOLS: <L_S_DATA> TYPE FAGL_EXTSTRUCT_LEAD.



*declare a structure with field required from FAGLFLEXT table

TYPES : BEGIN OF IT_FAGLFLEXT,

V_TIMESTAMP TYPE TIMESTAMP,

END OF IT_FAGLFLEXT.



*Declare an internal table and work area with above type

DATA : ZBW_FAGLFLEXT TYPE STANDARD TABLE OF IT_FAGLFLEXT,

  L_T_DATA TYPE STANDARD TABLE OF FAGL_EXTSTRUCT_LEAD, "internal table same as C_T_DATA

  WA_FAGLFLEXT TYPE IT_FAGLFLEXT.



*move the entire content into another internal table

L_T_DATA[] = C_T_DATA[].

IF NOT L_T_DATA IS INITIAL.

*Read the fields from FAGLFLEXT table for all entries of L_T_DATA and put them in to IT_FAGLFLEXT

SELECT TIMESTAMP OBJNR00 OBJNR01 OBJNR02 OBJNR03 DRCRK

FROM  FAGLFLEXT INTO TABLE ZBW_FAGLFLEXT

FOR ALL ENTRIES IN L_T_DATA

WHERE RYEAR EQ L_T_DATA-RYEAR AND

OBJNR00 EQ L_T_DATA-ZZOBJNR00 AND

OBJNR01 EQ L_T_DATA-ZZOBJNR01 AND

OBJNR02 EQ L_T_DATA-ZZOBJNR02 AND

OBJNR03 EQ L_T_DATA-ZZOBJNR03 AND

DRCRK EQ L_T_DATA-ZZDRCRK.

SORT ZBW_FAGLFLEXT BY V_TIMESTAMP.

CLEAR WA_FAGLFLEXT.

LOOP AT L_T_DATA ASSIGNING <L_S_DATA>.

READ TABLE ZBW_FAGLFLEXT INTO WA_FAGLFLEXT WITH KEY V_TIMESTAMP = <L_S_DATA>-RYEAR BINARY SEARCH.

IF SY-SUBRC = 0.



*update the TimeStamp field from IT_FAGLFLEXT table

<L_S_DATA>-ZZTIMESTAMP = WA_FAGLFLEXT-V_TIMESTAMP.

ENDIF.

ENDLOOP.

ENDIF.

C_T_DATA[] = L_T_DATA[].

REFRESH : L_T_DATA,

ZBW_FAGLFLEXT.

ENDMETHOD.

Your help required

Thanks

Imran Shafiq

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Raymond Giuseppi
Jan 17, 2017 at 01:32 PM
0

Could you post your actual code, this one shouldn't allow activation? internal table and read table in it are not complient with the select statement, etc. Also you didn't check datasource name, did you activate class and implementation?

Regards,
Raymond

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi

Following are the rest of the code define for enhance 0FI_GL_10 data source:

Business Add-Ins Method for General Data Transfer

SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style: italic;
color: #808080;
}
.L0S32 {
color: #3399FF;
}
.L0S33 {
color: #4DA619;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
.L0S70 {
color: #808080;
}

METHOD IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM.
*Declare the variable which holds method (DataSource enhancement)
DATA : L_METHOD TYPE SEOCMPNAME.
*Add some letter to prefix, because method can't be started with number
CONCATENATE 'M_' I_DATASOURCE INTO L_METHOD.
*checks the internal table, if it has no data then it exits the method.
CHECK C_T_DATA[] IS NOT INITIAL.
*Read the component (method) from SEOCOMPO table: this table will get an
*entry when a customized method is created in the class. This customized
*method will Contain the source code logic to fill the enhanced field of the DataSource
SELECT SINGLE CMPNAME FROM SEOCOMPO INTO L_METHOD WHERE
CLSNAME = 'ZCL_IM_C_RSU5_SAPI_BADI' AND
CMPNAME = L_METHOD.
*Check the sy-subrc, if it is not equal to 0, then exits the method
CHECK SY-SUBRC EQ 0.
*if method is found in the SEOCOMPO table, that particular method will be called so automatically
*enhancement logic written in that method will get executed and Modified to C_T_DATA
CALL METHOD (L_METHOD)
EXPORTING
I_UPDMODE  = I_UPDMODE
I_T_SELECT = I_T_SELECT
I_T_FIELDS = I_T_FIELDS
CHANGING
C_T_DATA     = C_T_DATA
C_T_MESSAGES = C_T_MESSAGES.
ENDMETHOD.

Code define in private section of method M_0FI_GL_10

SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style: italic;
color: #808080;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
.L0S70 {
color: #808080;
}

*"* private components of class ZCL_BW_FI_GL_10
*"* do not include other source files here!!!
private section.
  type-pools SBIWA.
  class-methods M_0FI_GL_10
  importing
    value(I_UPDMODE) type SBIWA_S_INTERFACE-UPDMODE
    value(I_T_SELECT) type SBIWA_T_SELECT
    value(I_T_FIELDS) type SBIWA_T_FIELDS
    changing
    !C_T_DATA type ANY TABLE
    !C_T_MESSAGES type RSU5_T_MESSAGES optional.
0

So your first code what the code of the M_<datasource> method. You should/must redefine your internal table type and adapt the READ TABLE statement, to be complient with the SELECT statement result and where clause.

0
Former Member
Raymond Giuseppi

Kindly show me how?

0