cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Data Source Enhancement Help - User Exit

Former Member
0 Likes
899

I need your help in trying to figure out what I'm doing wrong here when trying to write code in the user exit for a data source enhancement requirement. Its my first time writing any code so please bear with me and any help is greatly appreciated. The scenario/requirement and the code I've written is below.

Some points I want to make are:

  • I know that there is data but when I execute in rsa3 there is not data being populated in the table.
  • The structure I have defined for ZTERM is by using the data element name (DZTERM) and not the field name as I was getting errors when I used the field name.
  • I am thinking that the structure definition might be wrong but not sure (as its my first time writing any code).
  • I am not getting data for either field (ZTERM or BUKRS).

Again thank you for your help.

Enhance 0CUSTOMER_ATTR to bring in the following fields into the data source:

·        KNB1-BUKRS; KNB1-ZTERM

The code i have written is:

*Define Structure

TYPES: BEGIN OF TYP_KNB1,

         KUNNR TYPE KUNNR,

         BUKRS TYPE BUKRS,

         DZTERM TYPE DZTERM,

         END OF TYP_KNB1.

* Declare Internal Table

  DATA: GT_KNB1 TYPE STANDARD TABLE OF TYP_KNB1.

  FIELD-SYMBOLS: <fs_knb1> TYPE TYP_KNB1,

                 <fs_data1> TYPE BIW_KNA1_S.

* Select data from db table into the internal table

         IF NOT i_t_data[] is initial.

         SELECT KUNNR

                BUKRS

                ZTERM

         From KNB1

         INTO table GT_KNB1.

        IF SY-SUBRC = 0.

              SORT GT_KNB1 by KUNNR.

            ENDIF.

* Populate the enhanced fields.

         LOOP AT i_t_data ASSIGNING <fs_data1>.

         READ TABLE GT_KNB1 ASSIGNING <fs_knb1>

              WITH KEY KUNNR = <fs_data1>-kunnr

              BINARY SEARCH.

            IF SY-SUBRC = 0.

              <fs_data1>-ZBUKRS16 = <fs_knb1>-BUKRS.

              <fs_data1>-ZZTERM16 = <fs_knb1>-ZTERM.

            ENDIF.

          ENDLOOP

      ENDIF.

View Entire Topic
Former Member
0 Likes

Hi,

Have you removed the hide check box from the data soruce via RSO2 or RSA6 ?

Did you already put a break point in your code and checked in debug and see the data getting populated ?

Thanks.

Former Member
0 Likes

Hi Jugal,

I have done that already but it wasnt populating when I ran it it rsa3 (extractor checker) but it worked fine when I modified my code a bit like Karthik had suggested.

Thanks for the reply mate

Sandeep