Abap Code TO ENHANCE DATASOURCE with KEY FIELD OF SOURCE TABLE

Dear Friends, Please help me to resolve this important issue at my end.
<b>Requirement</b>:  enhance the STRUCTURAL data source which is
based on the table VISTSU , now this table has a <b>key INTERNO</b> (Data Element : SECAINTRENO) which i want to enhance in datasource 
SGONR = STRUCTURAL NUMBER present in extract structure of datasource
Solution: I am not able to see any records for zzinterno enhance field in datasource rsa3 (Extractor CHECKER). Can u help me correct the ABAP code or tell me the way to pull the records for ZZINTERNO from VISTSU table.
Thanks
Poonam Roy
ABAP Code
data: l_s_REIS_STRUCTURAL_ATTR like REIS_STRUCTURAL_ATTR.
case i_datasource.
WHEN '0STRUCTURAL_ATTR'.
loop at C_t_data into l_s_REIS_STRUCTURAL_ATTR.
l_tabix = sy-tabix.
clear  I_VISTSU .
select single * from VISTSU  into i_VISTSU  where SG0NR = l_s_REIS_STRUCTURAL_ATTR-SGONR.
if sy-subrc = 0.
l_s_REIS_STRUCTURAL_ATTR-ZZINTRENO = I_VISTSU -INTRENO.
modify C_t_data from l_s_REIS_STRUCTURAL_ATTR index l_tabix.
endif.
endloop.
endcase.

Try the below code.
data: l_s_REIS_STRUCTURAL_ATTR like REIS_STRUCTURAL_ATTR.
data: temp_interno like VISTSU -INTRENO.
data:  h_tabix LIKE sy-tabix.
case i_datasource.
WHEN '0STRUCTURAL_ATTR'.
loop at C_t_data into l_s_REIS_STRUCTURAL_ATTR.
MOVE SY-TABIX TO H_TABIX.
clear temp_interno.
select single INTERNO from VISTSU into temp_interno where SG0NR = l_s_REIS_STRUCTURAL_ATTR-SGONR.
if sy-subrc = 0.
l_s_REIS_STRUCTURAL_ATTR-ZZINTRENO = temp_interno.
endif.
modify C_t_data from l_s_REIS_STRUCTURAL_ATTR index H_TABIX.
ENDLOOP.
ENDCASE.
Regards, Siva

Similar Messages

  • ENHANCE DATASOURCE with key field of source table

    Dear Friends, Please help me to resolve this important issue at my end.
    <b>Requirement</b>:  enhance the STRUCTURAL data source which is
    based on the table VISTSU , now this table has a <b>key INTERNO</b> (Data Element : SECAINTRENO) which i want to enhance in datasource 
    SGONR = STRUCTURAL NUMBER present in extract structure of datasource
    Solution: I am not able to see any records for zzinterno enhance field in datasource rsa3 (Extractor CHECKER). Can u help me correct the ABAP code or tell me the way to pull the records for ZZINTERNO from VISTSU table.
    Thanks
    Poonam Roy
    ABAP Code
    data: l_s_REIS_STRUCTURAL_ATTR like REIS_STRUCTURAL_ATTR.
    case i_datasource.
    WHEN '0STRUCTURAL_ATTR'.
    loop at C_t_data into l_s_REIS_STRUCTURAL_ATTR.
    l_tabix = sy-tabix.
    clear  I_VISTSU .
    select single * from VISTSU  into i_VISTSU  where SG0NR = l_s_REIS_STRUCTURAL_ATTR-SGONR.
    if sy-subrc = 0.
    l_s_REIS_STRUCTURAL_ATTR-ZZINTRENO = I_VISTSU -INTRENO.
    modify C_t_data from l_s_REIS_STRUCTURAL_ATTR index l_tabix.
    endif.
    endloop.
    endcase.

    Try the below code.
    data: l_s_REIS_STRUCTURAL_ATTR like REIS_STRUCTURAL_ATTR.
    data: temp_interno like VISTSU -INTRENO.
    data:  h_tabix LIKE sy-tabix.
    case i_datasource.
    WHEN '0STRUCTURAL_ATTR'.
    loop at C_t_data into l_s_REIS_STRUCTURAL_ATTR.
    MOVE SY-TABIX TO H_TABIX.
    clear temp_interno.
    select single INTERNO from VISTSU into temp_interno where SG0NR = l_s_REIS_STRUCTURAL_ATTR-SGONR.
    if sy-subrc = 0.
    l_s_REIS_STRUCTURAL_ATTR-ZZINTRENO = temp_interno.
    endif.
    modify C_t_data from l_s_REIS_STRUCTURAL_ATTR index H_TABIX.
    ENDLOOP.
    ENDCASE.
    Regards, Siva

  • ABAP code to Enhance Master data

    Hi Friends,
    can  you send me a sample ABAP code to enhance the master data
    Regards
    Hari

    Dear Adluru Hari Varma ,
    Hereunder an example of code to enhance Master Data
    0ART_SALES_ATTR for 0MAT_SALES:
    EXIT_SAPLRSAP_002
    DATA: l_biw_mvke_s LIKE biw_mvke_s,
    l_tabix LIKE sy-tabix,
    v_satnr LIKE mara-satnr.
    CASE i_datasource.
    WHEN '0ART_SALES_ATTR'.
    LOOP AT i_t_data INTO l_biw_mvke_s.
    l_tabix = sy-tabix.
    clear v_satnr.
    SELECT SINGLE satnr FROM MARA INTO v_satnr
    where matnr = l_biw_mvke_s-matnr.
    IF sy-subrc = 0.
    l_biw_mvke_s-zzsatnr = v_satnr.
    ENDIF.
    MODIFY i_t_data FROM l_biw_mvke_s INDEX l_tabix.
    ENDLOOP.
    ENDCASE.
    Also
    the user exit code zxrsau02 to populate the new fields .say you add field zzfield1, user exit code zxrsau02 can be like
    data : l_s_custattr like BIW_KNA1_S,
    l_zzfield1 like tablexyz-fieldabc,
    l_tabix like sy-tabix.
    case i_datasource.
    when '0customer_attr'.
    loop at c_t_data into l_s_custattr.
    l_tabix = sy-tabix.
    fill the new field
    select single fieldabc into l_zzfield1
    where ....
    l_s_custattr-zzfield1 = l_zzfield1.
    modify c_t_data from l_s_custattr index l_tabix.
    endloop.
    take a look some links on enhancement
    Enhancement
    User exit
    and download pdf 'enhancements in sap bw'
    here you can find the steps ...
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/59069d90-0201-0010-fd81-d5e11994d8b5
    hope this helps.
    Re: enhancements
    Check in SDN you will find more programs
    Hope it helps.Revert back to me if you have any queries
    Regards
    Bala

  • Dispaly material with key field customer based on tax classification

    Hello all,
    Material is classified based on tax classification as products and goods.I need to dispaly these of either for some customers.
    Client is saying me to use the table MLAN(Tax Classification for material).
    Can anybody suggest me how can i pull the material part/service part(matnr)  from the table (MLAN) based on tax classification(TAXKM) with key field customer(KUNNR) when this table does not have customer has key field in it.
    Thank you,
    Sirisha

    Hello all/Brad,
    Requirement is , i need to add and dispaly material data in a column with heading as  tax classification  in ALV Report for the customer.
    Ex:  Customer 11094 brings material 336047-B21(Product)
          Customer 10973 brings material LDMSPMAP-M (Service)
    Material is classified as per the tax classification  as Product and Service. If tax classification is 1 then it is Product and if the tax classification is 2 then it is Service.
    So i'm trying to pull the material(Product/Service) based on tax classification with customer as key field.
    Customer is coming from customer master data.
    So i have used MARA table which has all three fields (Customer,Material,Tax classification) to get the required information but the table does not have test data for customer.So i told my client to update mara table with customer and tax classification data.
    But  my client told me to use MLAN table  because they have updated the data in this table.But unfortunately this table doesn't have customer field to pull the data.
    So that is the reason, i put the above question in the forum.
    PLease help me in solving this issue.
    Thank you,
    Sirisha

  • Key fields and non-key field of condition table

    Hello Gurus,
          what is key fields and non-key field of condition table?
    thanks very much!

    Key field
    Each condition table contains keys that can be used for creating dependent condition records.
    for example let take condition type PR00.
    PR00 uses access sequence PR02 .
    Access sequence PR02 has following tables associated with it namely 304, 305 & 306
    When you create a conditon record for PR00 with transaction VK11 or VK31, you have a button 'key combination' which is nothing but fields associated with tables 304, 305 & 306.
    In brief, Condition records are always created using specific keys. Condition tables are used to define the structure of the keys of a condition record.
    Non key field
    For example take condition table 144 - sales deal basic data.
    Table 144 is associated with access sequence PBUD.
    If you check the fields associated with this table (click technical view button), there are three fields at bottom which do not have 'key' check mark -KDATU, PLTYP, KSTAF
    So, when you create a condition record for PBUD, system does not propose these 3 fields in 'key combination' and hence are non key fields.
    Please reward points for good answers as this would help increase the total donation that SAP will make to the United Nations World Food Programme.

  • Implications of adding new key fields to existing table

    Hi All,
    I have searched forum regarding this. But didn't find exact answer.
    We are planning to add new key fields to existing Ztable. I want to know the implications of this.
    I have checked the where used list of table and found no impact. Only one point is making me to think again and again.
    If we add key fields to existing table then we have to adjust the table from SE14 to activate it. But this adjustment doesn't ask for TR.
    So if i release my TR, entries in other systems will also be adjusted accordingly??? Business is OK with the new fields values to be blank for existing entries.
    Thanks,
    Vinod.

    Yes the data in transported  systems will also be adjusted. If this table contains too much data make transport at late hours because it will take long and table can't be used while it's adjusted. In this adjustment process data is copied to a temporary table and moved back to original table using move-corresponding command after key added. There will data loss if you remove a key or key fields field length but in your case it shouldn't be a problem.
    Edited by: Gungor Ozcelebi on Jul 2, 2009 9:18 AM

  • Key fields in variant tables.

    Hi masters,
    i would like to know the use of "key field" in variant tables.
    according to definition:This indicator shows whether a characteristic is used as a key field for accessing tables. Key fields have the value "X". When the table is accessed, the values assigned to the key fields infer values for the other characteristics.
    please give an example of its usage,
    thanks regards
    Rahul

    Hello Rahul,
    Please view the following link with the explaination and an example.
    http://help.sap.com/saphelp_47x200/helpdata/EN/92/58c5cd417011d189ec0000e81ddfac/frameset.htm
    Thanks
    Amber

  • Updation of Primary Key field in HR Tables (PA2001 and PA2002) - Urgent

    Can anyone please tell me how to update a primary key field in HR Tables (PA2001 and PA2002).
    I need to update sprps field in both the tables. I used HR_Infotype_Operation function module, but still it is not updating the field.
    Pls find the following code snippet for the table PA2001 and let me know if any discrepancies :
    TABLES: pa2001.
    DATA: it_pa2001 TYPE TABLE OF pa2001,
    wa_pa2001 LIKE LINE OF it_pa2001,
    DATA: date TYPE d.
    date = sy-datum - 100.
    SELECT pernr sprps begda endda FROM PA2001 INTO CORRESPONDING FIELDS OF TABLE it_pa2001
    WHERE begda BETWEEN date and sy-datum.
    WRITE:/.
    WRITE:/ 'PA 2001 Records'.
    if sy-subrc <> 0.
    WRITE:/ 'No Data Exists'.
    else.
    LOOP AT it_pa2001 INTO wa_pa2001.
    WRITE:/ wa_pa2001-pernr, wa_pa2001-sprps, wa_pa2001-begda, wa_pa2001-endda.
    ENDLOOP.
    endif.
    LOOP AT it_pa2001 INTO wa_pa2001.
    wa_pa2001-sprps = 'X'.
    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
    EXPORTING
    infty = '2001'
    number = wa_pa2001-pernr
    SUBTYPE =
    OBJECTID =
    LOCKINDICATOR =
    VALIDITYEND =
    VALIDITYBEGIN =
    RECORDNUMBER =
    record = wa_pa2001
    operation = 'MOD'
    TCLAS = 'A'
    DIALOG_MODE = '0'
    NOCOMMIT =
    VIEW_IDENTIFIER =
    SECONDARY_RECORD =
    IMPORTING
    RETURN =
    KEY =
    ENDLOOP.
    if sy-subrc = 0.
    write:/ 'SY-subrc is zero'.
    write:/ ' Rows modified = ', sy-dbcnt.
    else.
    write:/ 'No Record(s) updated'.
    endif.
    commit work.
    WRITE: / 'Updated Records in the Internal Table IT_PA2001'.
    SELECT pernr sprps begda endda FROM PA2001 INTO CORRESPONDING FIELDS OF TABLE it_pa2001
    WHERE begda BETWEEN date AND sy-datum..
    LOOP AT it_pa2001 INTO wa_pa2001.
    WRITE:/ wa_pa2001-pernr, wa_pa2001-sprps, wa_pa2001-begda, wa_pa2001-endda.
    ENDLOOP.

    Thanks Kiran.
    But I need to change this field as we need to lock the records, as soon as the employee fills his/her time sheets which will be sent for HR Payroll, later on.
    When I am updating directly the field the database table PA2001, its not updating but for table PA2002, only few records are being updated.
    Is there any other alternative for this problem?
    Pls reply.
    Thanks,
    Harish

  • It is possible to assign value range to non key fields in the table?

    Hi,
    I want to give some range of values to the fields which are non key fields in the table.
    is it possible?
    can anybody tell me the procedure.
    Thanks in Advance,
    venkat

    HI,
    It is higjly possible in case of Z-table. but in standard table you can't make any modification.
    You assign the value range to the domain of field.
    go to SE11 and open the database table.
    Select the Data Element of the fieldto which  you want assign the range.
    Click on its domain .
    click on Value Range tab.
    Set the range.
    Regards,
    anirban

  • Need ABAP Code to enhance the 0PRODORDER_ATTR?

    I want to enhance the datasource 0PRODORDER_ATTR with the below JCDS Table fields like UDATE,STAT,OBJNR,INACT,CHGNR.
    Can anyone please let me know the ABAP Code need to be written in the CMOD to populate the data for the above fields in the 0PRODORDER_ATTR?

    Hi,
    You can use below code to enhancemnt .
    You need to change the table, structure and field names
    Below code you have to write in tocde CMOD if you are enhancing the master data. It applies for any master data, although, I have taken 0VENDOR_ATTR as the example. I assume that You have already added/appended  the fields in the extract structure of 0VENDOR_ATTR  i.e. to the structure BIW_LFA1_S. ( Check this link for how to enhance the DataSource : https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0af763b-066e-2910-a784-dc6731660f46 )
    We have enhanced the datasorce for the following two fields from table LFA1:
    ERDAT- Date on which the Record Was Created
    KRAUS - Credit information number.
    We have also enhaced the structure for the following fields from table LFB1.
    MINDK - Minority Indicators
    ZTERM - Terms of payment key
    CERDT - Certification date.
    Now we will poulate these two fields in the code written in CMOD tcode. Here is the code:
    Go to the tcode CMOD in R3 and select the component EXIT_SAPLRSAP_002. Write this code in INCLUDE ZXLOFU01.
    data : l_t_data like biw_lfa1_s.
    data : l_tabix like sy-tabix.
    CASE i_datasource.
    WHEN '0VENDOR_ATTR'.
        LOOP AT  i_t_data INTO l_t_data.
          l_tabix = sy-tabix.
          CLEAR:  l_t_data-yyerdat,
                 l_t_data-yykraus.
          SELECT SINGLE  erdat kraus FROM lfa1 INTO
              ( l_t_data-yyerdat, l_t_data-yykraus)
                WHERE lifnr EQ l_t_data-lifnr.
          SELECT SINGLE mindk zterm cerdt FROM lfb1 INTO
                  (l_t_data-yymindk, l_t_data-yyzterm, l_t_data-yycerdt)
                  WHERE lifnr = l_t_data-lifnr.
          MODIFY i_t_data FROM l_t_data INDEX l_tabix.
          CLEAR: l_t_data, l_tabix.
        ENDLOOP.
    ENDCASE.
    Labels parameters

  • Need help in ABAP code to Enhance the Extract Structure ?????

    Hi all,
        I want to enhance the extract structure to get KBETR & KBRUE fields of KONP table since it didn’t allow me to add those fields while creating the generic extractor because of currency key problems. I want to read all KONP records into internal table with KNUMH (Key). Next, I want to fill them into ZZKBETR & ZZKBRUE of Extract Structure ZOXUR40065 in loop.
    DATA:
      i_t_zrebate like ZOXUR40065 occurs 0 with header line,
      reb_tabix like sy-tabix.
    TABLES: KONP.
      Could you please help me in completing the ABAP code?
    Thanks,
    Venkat.

    Hello Manga,
        I have included the following code in ZXRSAU01:
    WHEN 'ZREBATE'.
    PERFORM ZREBATE_EXIT TABLES C_T_DATA.
    After Double click on ZREBATE_EXIT on perform statement, it created ZXRSAF01 include and the following code is added in it:
    FORM ZREBATE_EXIT TABLES FP_C_T_DATA STRUCTURE ZOXUR40065.
    DATA:
    i_t_zrebate like ZOXUR40065 occurs 0 with header line,
    reb_tabix like sy-tabix.
    FIELD-SYMBOLS: <l_c_t_data> TYPE ZOXUR40065.
    LOOP AT fp_c_t_data ASSIGNING <l_c_t_data>.
    reb_tabix = sy-tabix.
    select single KBETR KBRUE
    into (<l_c_t_data>-ZZKBETR,
    <l_c_t_data>-ZZKBRUE,
    from KONP
    where KNUMH eq <l_c_t_data>-KNUMH.
    if sy-subrc eq 0.
    MODIFY fp_c_t_data FROM <l_c_t_data> INDEX reb_tabix.
    endif.
    CLEAR:reb_tabix.
    ENDLOOP.
    ENDFORM.
    When I tried to Activate this ZXRSAF01 include, it fails with 'The FORM "ZREBATE_EXIT" does not exist'.
      Should it be FP_C_T  or P_C_T? I found P_C_T in ZXRSAF01 include.
      What is wrong with it, please ?
       Can't I add this whole code in main include ZXRSAU01itself?
      The Extractor ZREBATE is based on KONA, KONH & KONP tables. This Extractor and KONA table have the same 4000 records and KONP has 13000 records. I want to extract KBERT & KBRUE from KONP.
       Thanks in advance.
    Regards,
    Venkat

  • ABAP code to enhance a standard data source

    Hi BW experts,
    I am a novice in BW and I need to append a standard datasource <b>0DAT_SRC</b> with a field <b>FLD1</b> from table <b>TABL1</b>.Extract structure: <b>EX0001</b>.
    Can anybody please suggest how this can be done?I guess it requires some ABAP coding to be done in the conversion exits.
    <b><i>Many,many thanks in advance!!</i></b>

    Following are the steps to enhance Standard Data source.
    1. goto tc RSA6.
    2. Select the Data Source which you want to enhance.
    3. Select display Data Source (Ctr+f2)
    4. Double click on the Extract structure.
    5. click on the Append Structure.
    6. Add the required fieds starting with ZZ*.
    7. Avtivate the Append Structure.
    To populate the data into this field you must have a project created to access the FM 'EXIT_SAPLRSAP_001'.
    to Create Project code goto tcode: CMOD
    1. Enter the Project name and click on create
    2. go to components select the required function module.
    EXIT_SAPLRSAP_001 for Transactional DS (RSR000
    EXIT_SAPLRSAP_002 for Master DS
    Goto SE37 and enter the Respective Function module (ex . EXIT_SAPLRSAP_001) and click on the include zxxxxx. then write the code to populate the extra fields added to the DS.
    Sample code:
    CASE i_datasource.
    WHEN '2LIS_11_VAITM'.
    loop at c_t_data into work_ar.
    do some selections, some calculations ....
    append work_ar to c_t_data. " add a new record
    modify c_t_data from wa. " change the existing record
    endloop.
    endcase.

  • Enhance BOL with Z-fields for Web Service

    Hello,
    I need to create Web Service for quotation.
    I want to add some Z-fields to this WS. I think I need to enhance BTAdminH BOL.
    I already append structure with Z-fields to BTAdminH BOL, however I don't know where I should write ABAP code for filling those fields.
    How can I find class for BTAdminH BOL, and how can I convert it to Z-class?
    Is it risky to do in already alive system?
    Best Regards,
    Veronica

    Hello Robert,
    I have already read this blog and my colleague tried to do the same, however we can't transfer it to QA system because the development is in local package (as it is described in the blog).
    Do you know how to transfer it to QA system?
    Failure to transfer to QA leads us to search other solution like enhance BOL.
    Veronica

  • Sender File adapter File Conversion with key fields

    Please help me guys, I already spent way too much time on this!
    I checked a couple of BLOGs and I think I'm doing the right thing except I'm not getting the result I would expect.
    I'm trying to create an IDoc using the from a flat file.
    I get the following error:
    During the application mapping com/sap/xi/tf/_MM_TEST_ a com.sap.aii.utilxi.misc.api.BaseRuntimeException was thrown: RuntimeException in Message-Mapping transformatio~
    The Source file is this:
    H
    L0015
    The file adapter does create the XML below (looks fine):
      <ns:MT_SINGLE xmlns:ns="http://PPSC_TO_BO_INVOICE">
      <HEADER>
         <ID>H</ID>
      </HEADER>
      <LINE>
         <ID>L</ID>
         <SITE>0015</SITE>
      </LINE>
      </ns:MT_SINGLE>
    When I test the map in IR, with the XML that this file adapter created (above) it works fine!
    Also if I take away the HEADER from the source structure everything works fine and I can create the IDoc, therefore I think something must be wrong in the file conversion, the mapping is so simple there is nothing to fail there.
    The file conversion parameters that I have:
    Document Name: MT_SINGLE
    Document Namespace: http://PPSC_TO_BO_INVOICE
    Document Offset:
    Recordset Name: 
    Recordset Namespace:
    Recordset Structure: HEADER,1,LINE,*
    Recordset Sequence: Ascending
    Recordset per Message:
    Key Field name: ID
    Key Field Type: String (Case-Sensitive)
    LINE.fieldNames: ID,SITE
    LINE.fieldFixedLengths: 1,4
    LINE.keyFieldValue: L
    HEADER.fieldNames: ID
    HEADER.fieldFixedLengths: 1
    HEADER.keyFieldValue: H
    What am I doing wrong???
    Any help is much appreciated.
    Thanks,
    Viktor Varga

    Hi Viktor,
    Basic rules:
    1. Down load XML payload(output From Adapter) and test it in IR mapping program. If it is working there is no reason why it will fail in Runtime. Also Check Cache is up to date.
    Generally the problem lies with namespace.
    Hope this helps
    Regards,
    Satish

  • Problem with S001 - Key field Sequence in table

    Hi,
    We want to use the extractor 2LIS_01_S001 with Delta. But delta is not working with these extractor. When I checked LBW0, I am getting error "The LIS environment is setup incorrectly".
    According to note 115192, the key fields in tables S001, S001BIW1 and S001BIW2 have to be in the same sequence.
    But we are on 4.7 with following Support Packs:
    SAP_APPL 470 0025 SAPKH47025 Logistics and Accounting
    PI 2004_1_470 0007 SAPKIPZI57 R/3 Plug-In (PI) 2004.1 for
    R/3 Enterpri
    PI_BASIS 2004_1_620 0010 SAPKIPYI5A Basis Plug-In
    (PI_BASIS) 2004_1_620
    And according to this note, solution is delivered with this Support Packs.
    Can you please tell me that if this note is mandatory for all the releases..?
    Did any one encounter this issue before..?
    Thanks & Regards,
    Samay Mehta

    I changed my entity: unchecked the X column to be primary key added RowID as a primary key. Now it works.
    What's wrong with my CHAR(1) as a primary key ?
    I also tried to add a Refresh button:
      <af:commandButton text="Refresh" id="cb3"/>and in the table add a partialTarget to the button. Now when I add new row and press the Refresh button - then it works.
    So it seems that the problem is when I add new row and enter data, the table is not refreshed and the row is missing it's primary key.
    Any solutions?
    Edited by: a.gruev on Nov 26, 2009 4:18 PM

Maybe you are looking for