Need ABAP code to make unique hierarchy values - Request prompt help

hi
<removed>
I am new to SAP. Please help me in the following
I require an ABAP code for the following scenario
I have a simple hieraarchy. The hierarchy is
SEG -> fam -> clas -> comm
The values of the seg , fam, cla, com......all will be charecter values
But in some cases the values will be NOT_KNOWN
If the values are NOT_KNOWN i need to change them as NOT_KNOWN_1, NOT_KNOWN_2...like that unique charecter values
should be replaced for NOT_KNOWN
Example
SEG->FAM->CLA ->COM
Clothing -> Mens wear -> Designer garments -> NOT_KNOWN
Construction -> equipments -> machinery->NOT_KNOWN
Computers -> Laptops -> Imported -> NOT_KNOWN
                 -> desktops ->flat monitors -> Indian
                       -> imported                     -> NOT_KNOWN->
NOT_KNOWN -> baggages
This should be changed to
SEG->FAM->CLA ->COM
Clothing -> Mens wear -> Designer garments -> NOT_KNOWN_1
Construction -> equipments -> machinery->NOT_KNOWN_2
Computers -> Laptops -> Imported -> NOT_KNOWN_3
          -> desktops ->flat monitors -> Indian
                          -> imported                         
       -> NOT_KNOWN_4 ->
NOT_KNOWN_5 -> baggages
This is to make them unique nodes to upload them in hiereachy
Data is coming from database tables and i was not supposed to do anything in database and the incomin
data needs to finetuned like this to update them in cube
So I like to have some coding which will enable this to work in the start routine
If start routine is not the right option, where else we can do coding
<removed>
Regards
KC

data : w_suff_n(8) type n,
         w_suff_c(8).
loop at data_package.
if data_package-<fieldval> = 'NOT_KNOWN'.
  w_suff_n = w_suff_n + 1. w_suff_c = w_suff_n.
  shift w_suff_c left deleting leading '0'.
  concatenate data_package-<fieldval> w_suff_c into data_package-<fieldval>.
  modify data_package.
endif.
endloop.
*Change <fieldval> in the above to the actual field name.

Similar Messages

  • How to write abap code to create manual hierarchy

    Hi,
    This is urgent got to write abap code to create manual hierarchy.
    Thanks

    Hi Adam
    Thanks for replying.
    In my scenario i have one custom zinfoobject which have lots of attributes.
    So, i have to create hierarchy for this zinfoobject with three nodes. one node/charateristic is present in this zinfoobject as attribute. which will be the first node of hierarchy.
    Then second custom infoobject is external not present in attribute list. which will be the second node of hierarchy.
    Third node will be for which i am creating hierarchy.
    So basically need solution for this first.
    some one will load hierarchy info in some table and then will create view on top of that then i have to create datasource on top of that and write a program to load the data from that view in this hierarchy.
    Need solution for this abap program also.
    Thanks
    SAPBW

  • Need Abap Code Help

    Hi ,
    I am trying to activate an ODS but it is failing the activation process . When I look into the application log I see this error    "Value 'RAM???¿????????S RAM' (hex. '4D41524B3F3F3FBF3F3F3F3F3F3F3F3F5320574F524B') of characteristic ZEUID contains invalid characters "
    I am new to ABAP and I need an ABAP code to filter this value when loading data into ODS .
    Thanks a lot for your help

    HI,
      Write the code in the start routine.
      IN the start routine you have a table called SOURCE_PACKAGE.
      declare work area x_souce_package type source_package
    data : lv_string(100).
      loop at souce_package into x_source_package.
      lv_string =  x_source_package-value.
    TRANSLATE LV_STRING TO UPPER CASE
      if lv_string CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' .
      ELSE.
      DELETE SOURCE_PACKAGE INDEX SY-TABIX.
      ENDIF.
      endloop

  • Need ABAP code for the below Services requirement

    Hi,
    We have a requirement to show all the services for a particular Purchase order number.For this I built a view on 2 tables ESLL and EKPO.Now based on the below logic I need to bring the services for the Purchase order..
    1.Enter PO number,item no. and Doc category in EKPO and find the Pack no.
    2.Now take the Pack no. of EKPO and give in ESLL and find the Sub pack no.
    3.Now take this Subpack no. and Give this sub pack as Pack no. in ESLL
    4.This will be the Service entry record for that PO number.
    Can any one Please suggest me to how to write the ABAP code for the above logic.
    Thanks & Regards,
    Dinakar

    Hi Dinaker,
    Did you find any solution for this issue. I too have a similar requirement of pulling all the service orders for a specific Purchase Order in the BW report.
    Thanks,
    SAPBWI

  • 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

  • Abap code to replace the bank values of Date Field with 20990101

    Please correct my abap code I am just trying to replace the bank values of Dataefield to 20990101 but i am getting the error invalid dataformat '00000000 '. Please correct my IF statement so that I can get this resolved
    IF    SOURCE_FIELDS-DATETO = '00000000 '
          RESULT = '20990101'.
    ENDIF.
    Thanks'
    Soniya

    Hi Soniya,
    You can use one of the following:
    IF SOURCE_FIELDS-DATETO =  ' '.
    RESULT = '20990101'.
    ENDIF.
    or
    IF SOURCE_FIELDS-DATETO IS INITIAL.
    RESULT = '20990101'.
    ENDIF.
    or
    IF SOURCE_FIELDS-DATETO = '00000000'.
    " THERE WAS A SPACE IN YOUR CODE.
    RESULT = '20990101'.
    ENDIF.
    Regards,
    Satya

  • Need ABAP code for Datasource Enhancement

    Hi All,
    I need no Enhance the WBS Element(PS_PSP_PNR) to2 LIS_02_ITM Datasource
    the table EKKN Having WBS element
    From EKKN Table We have to take the filed Append to the2LIS_02_ITM datasource
    Please any one give me ABAP code which is write in CMOD
    Thanks........
    Regards!
    Malli

    Hi,
    See SAP Help
    http://help.sap.com/saphelp_nw04s/helpdata/en/6e/fe6e420f00d242e10000000a1550b0/content.htm
    See the simple example code, so follow the same.Take ABAPer help, don't use select and end select.
    CASE i_datasource.
      Data: l_s_data1 LIKE mc13vd0itm,
            l_tabix   LIKE sy-tabix,
      WHEN '2LIS_13_VDITM'.
        LOOP AT c_t_data INTO l_s_data1.
          l_tabix = sy-tabix.
          SELECT SINGLE auart INTO l_s_data1-zzprdtyp FROM vbak
                 WHERE  vbeln  = l_s_data1-aubel.
          IF sy-subrc = 0.
            MODIFY c_t_data FROM l_s_data1 INDEX l_tabix.
          ENDIF.
        ENDLOOP.
    ENDCASE.
    Data: l_s_data18 LIKE mc12vc0itm ,
          l_tabix   LIKE sy-tabix.
      WHEN '2LIS_12_VCITM' .
        LOOP AT c_t_data INTO l_s_data18.
          l_tabix = sy-tabix.
          SELECT SINGLE ernam FROM ekko
           INTO (l_s_data18-ernam)
           WHERE ebeln = l_s_data18-vgbel .
          IF sy-subrc = 0.
            MODIFY c_t_data FROM l_s_data18 INDEX l_tabix.
          ENDIF.
        ENDLOOP.
    See article on Step by Step Guide to Enhance a Data Source:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00c1f726-1dc2-2c10-f891-ddfbffdb1a46?quicklink=index&overridelayout=true
    Thanks
    Reddy

  • Need java code to make MySql Dump?

    Do anybody know how to write java code to make MySql Dump. I am badly need of this code very urgently!, do any body here to help me!
    Kindly help me out.

    Urgency means two things:
    - either your homework is late (do it yourself)
    - or you have a deadline on your job (ask a co-worker)
    Both isn't really making me want to answer your question. Your time isn't more valuable than that of the others.
    And the big question is probably not "how to write the Java code" but "how to make a MySQL dump", Java or not. RTFM for that, and then use either MySQL or Runtime.exec.

  • Need ABAP Code in BI routine

    Hi,
    I want to write a transfer routine, Can any one give me the ABAP Code...
    Here is what I want to do:
    1. Read by document Number at the Header level (identified by item = "#")
    2. Read the Status of the Header
    3. If the Status = deleted
    4. Read all the line items related to the Header
    5. Assign the Status of the line item = Status of the Header
    Thanks
    Edited by: tanu d on Aug 20, 2010 11:32 AM

    Hi,
    See the simple code.
    IF SOURCE_FIELDS-N_WBSEOM = ' '.
          RESULT = 'N'
        ELSE.
          RESULT = SOURCE_FIELDS-N_WBSEOM.
        ENDIF.
    OR
    IF SOURCE_FIELDS-N_WBSEOM IS INITIAL.
          RESULT = 'N'
        ELSE.
          RESULT = SOURCE_FIELDS-N_WBSEOM.
        ENDIF.
    Thanks
    Reddy
    Edited by: Surendra Reddy on Nov 25, 2009 5:38 AM

  • URGENT : Need java code snippet to retrieve uniquemember values OID 11g API

    Hi All,
    We have a requirement to retrieve the uniquemember attribute values using OID 11g API. We are using labeleduri approach for dynamic groups and thus all the uniquemember values are created using dynamic groups.
    When we are trying to retrieve the uniquemember values using Java code snippet, it is not returning the values. The strange thing is: The uniquemember values created using dynamic groups are not visible in ODSM OID console or JExplorer tool. However those values are visible in LDAP Browser v2.8.1 tool.
    So can somebody throw light on this? Any pointers or sample code snippet to retrieve uniquemember values would be grateful.
    Thanks
    Mahendra.

    Hi All,
    We have a requirement to retrieve the uniquemember attribute values using OID 11g API. We are using labeleduri approach for dynamic groups and thus all the uniquemember values are created using dynamic groups.
    When we are trying to retrieve the uniquemember values using Java code snippet, it is not returning the values. The strange thing is: The uniquemember values created using dynamic groups are not visible in ODSM OID console or JExplorer tool. However those values are visible in LDAP Browser v2.8.1 tool.
    So can somebody throw light on this? Any pointers or sample code snippet to retrieve uniquemember values would be grateful.
    Thanks
    Mahendra.

  • Need the code to make these to new objects in BW world, please help...

    I have two fields that I get from the source (to DSO):
    CREATE_DATE (YYYYMMDD)
    REPORT_MONTH (YYYYMM)
    First I want to make a infoobjects (called CREATE_MONTH) that takes the YYYYMM from the CREATE_DATE.
    The I also want to make an indicator (called MONTH_IND) that have a test on infoobjects called CREATE_MONTH and REPORT_MONTH.
    The logic should be something like this:
    If CREATE_MONTH is 3 month earlier than REPORT_MONTH the indicator should say ‘over 2 month
    If CREATE_MONTH is 4 month earlier than REPORT_MONTH the indicator should say ‘over 3 month
    Etc….
    Conclution:
    Need two new objects:
    1. CREATE_MONTH
    2. MONTH_IND
    Can someone give me some help on how to do this Please?

    Hi Elaine!
    First of all I´d like to thank your answer.
    I know what you mean; I had a gif animated file in my web site and I converted it in a swf file, that is the reason why I couldn´t do the correct to make the link. I thought that I could make the link with a simple code but thanks to this foro, now I know that it is a bit more complicated.
    Anyway, I think that it is better if I read the tutorial to know how this work.
    Thank you again and have a nice day!
    afp5trip

  • ABAP program to make a Hierarchy flatfile structure?

    Hi,
    Is there any ABAP program by which we can make a flat file structure in the conventional format ? ( Nodeid,Infoobject,Nodename etc---)
    Because here i just cannot make the flat file manually as the document i have is huge one, having somany nodes and levels that it is almost impossible to write down on a paper too!
    Any suggestions?
    Thanks,
    Ravi

    Hi,
    I have used the following function modules to breakdown the hierarchy. You can write a simple abap program and download the heirarchy breakdown.
    CLAF_CLASSIFICATION_OF_OBJECTS - this function module will return the class information for the hierarchy.
    Use the internal table i_class (filled by the above function module) and pass the relevant fields to the FM CC_LS_GET_CLASS_HIER_STRUCTURE.
    The entire hierarchy then becomes available in the table 'class_structure'. Use appropriate methods to download to the presentation ( FM WS_DOWNLOAD GUI_DOWNLOAD) / application servers (OPEN Dataset/Transfer Dataset/CLose dataset).

  • Need ABAP  Code

    Hi,
                             I want to write a small ABAP routine for a particular variable "ZS". The logic is ..
    I want to read a variable "ZV" , if the first char of the ZV is "A" then Assign a constant "Y" to ZS
    if not Assign "N" to ZS...
    Can any one help me in developing this code..

    Hello,
    You can code with below logic:
    if zv-low+0(1) = 'A'.
    zs-low = 'Y'.
    else.
    zs-low = 'N'.
    endif.
    This is the main logic....i hope u can write the other stuff as per the need.
    regards,
    shashank

  • Need ABAP code for Routine

    Hi Gurus My requirement goes like this.
                                  I need to write the routine in Transformation from DSO to DSO
    Source table
    Doc         Amt         Netduedate      Reference Doc
    1000      10000     01.01.2010        
    1500       5000      30.01.2010        1000
    1700       3000      02.02.2010        1000  
    In the Above table 1st document is Invoice Document, 2nd and 3rd are Partial Payment Document.
    My requirement is 2nd and 3rd record Netduedate value should have 01.01.2010 by referring reference Doc field, for the above Ex We should have the output like this
    Target table
    Doc         Amt         Netduedate      Reference Doc
    1000      10000     01.01.2010        
    1500       5000      01.01.2010        1000
    1700       3000      01.01.2010        1000  
    Please give me the syntax code and where to write the code ie in the start routine or in the field routine. the dataflow is between one DSO to Another DSO
    Please Provide me the solution ASAP as this is very Urgency.
    Thanks in Advance

    If suppose your documents are being loaded in same load,
    1. start routine - create internal table like SOURCE_PACKAGE
    DATA IT_SOURCE_PACKAGE TYPE TABLE OF SOURCE_PACKAGE.
    DATA WA_SOURCE_PACKAGE LIKE LINE OF SOURCE_PACKAGE.
    2. copy all records to new internal table, IT_SOURCE_PACKAGE[] = SOURCE_PACKAGE[]
    3. delete partial docs, DELETE IT_SOURCE_PACKAGE WHERE REF_DOC IS NOT INITIAL.
    4. Sort internal table SORT IT_SOURCE_PACKAGE BY DOC
    5. Look for original doc inside loop.
    LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS> WHERE REF_DOC IS NOT INITIAL.
    READ TABLE IT_SOURCE_PACKAGE 
          INTO WA_SOURCE_PACKAGE
          WITH KEY DOC = <SOURCE_FIELDS>-REF_DOC  BINARY SEARCH.
    IF SYSUBRC EQ 0.
      <SOURCE_FIELDS>-NDUEDATE = WA_SOURCE_PACKAGE -NDUEDATE.
    ENDIF.
    ENDLOOP.
    If the original documents are found in different loads in the source DSO, we need to pull the records from active table of the target DSO after step 2.
    -Jijo

  • Help! Need Abap code in Bex for Customer Exit

    Hi,
    I am new to abap, i need help in creating variable type customer exit.
    i want to create a variable type customer exit the reqmnt is to create a variable that will derive quarter(0CALQUARTER) from FINANCIAL_CLOSING variable.
    Really appreciate if one can provide me the coding for this logic.
    Thanks.

    Hi Yaser,
    Check this below.
    http://scn.sap.com/thread/278890
    Regards.

Maybe you are looking for

  • How to do "default interface" on IOS XR?

    Hi Guys, Does anybody know an equivalent of "default interface" for IOS XR or a smart way to delete hundreds of attachment circuits for single physical interface? Appreciate your comments. Regards, Vasil

  • How to delete Class

    I have created class for some new charecteristics, which for some reasons I have to delete now. when i delete those class  in CL02 the message shows : objects allocated ; Can you please help me too delete that, thanks Arif

  • Converting bitrate while syncing from itunes to ipod?

    Hello. My itunes library is mainly in MP3 320kbit. I would like to have the files converted to MP3 128kbit on the ipod (nano or 5G), but the files on the pc should remain in 320kbit. Is there a way for this? Thanks, Michael

  • Some problem with model connection code

    <b>try {              if(clientJCO==null)              clientJCO=wdThis.wdGetConnectionserviceInterface().getConnection("modelname");              //wdComponentAPI.getMessageManager().reportSuccess("jco client:: "+clientJCO);              mo_ptmng_ov

  • MS Office Professional Plus 2010 cannot verify the license (in use for more than a year)

    After more than a year of use, I now receive the following error message for all Office Applications .... "Microsoft Office Professional Plus 2010 cannot verify the license for this product. You should repair the Office program by using the Control P