Error in using functional module CS_BOM_EXPLOSION

Hi Experts,
I am using the functional module CS_BOM_EXPLOSION to explode a BOM to its components. When it is beign called in a custom program, it throws an exception message as "No alternative found (Exception 01)". But when  it is executed in test mode (tcode SE37), it does not issue such warning message and gives the result accurately.
Below are the parameters used for exploding the BOM.
        FUNCTION 'CS_BOM_EXPLOSION'
        EXPORTING
            CAPID = BOM Application; PP01
            DATUV = BOM Explosion date; System date
            EMENG = Base Quantity
            MTNRV = Parent Material
            WERKS = Plant
            STLAL = Alternative BOM
            STLAN = BOM Usage
            MEHRS = Whether multilevel BOM explosion is required (Then put X)
            MDMPS = BOM explosion level (Level 1, 2, 3u2026..)
Please provide me with a solution as to use the same in the program.
Thanks in advance,
Ramindu

Dear Ramindu,
Ensure you are entering a value say 01 or 02 or 03 for alternative BOM.
A Product may be having one or more than one alternative BOM.
Say a product X has only one BOM,then in this case the value will be 01.
Suppose if its having 2 different BOM's then the values will be 01 and 02.
So in test mode you may be checking with a different material code and also giving 01 as the value for
the alternative BOM.
Check whether the same is happening in the custom program also.
Check and revert back.
Regards
Mangalraj.S

Similar Messages

  • Error while using Function module SPELL_AMOUNT with arabic language AR

    Hi ,
    When i am trying to convert the number to words, using function module SPELL_AMOUNT with arabic language(AR),following abend message is coming and FM is getting abended.
    Entry AR 0 1 in table T015Z does not have a delimiter (
    Can you please provide me how to overcome this error?
    Thanks & Regards
    Seshagiri.

    Hi Santosh,
    Thanks for quick inputs.
    And amount is not having any delimitors.
    I have checked in table T015Z and it has entries with AR as SPRAS.
    All entries are having ':' at the beginning of the arabic words,and there is no single entry with ';'.
    All entries with EN as SPRAS are having delimiters ';' at the end of the words.
    Numbers are correctly converted to words in english,but abending in arabic.
    Any idea please.
    Thanks & Regards
    Seshagiri.

  • Error occurred while loading Generic extraction using Function module

    Hi all
    I'm trying to do INIT for Generic Extractor using Function module, but i'm getting error as "Error occurred in the source system"
    Error message from the source system
    Diagnosis
    An error occurred in the source system.
    System Response
    Caller 09 contains an error message.
    Further analysis:
    The error occurred in Extractor .
    Refer to the error message.
    Procedure
    How you remove the error depends on the error message.
    Note
    If the source system is a Client Workstation, then it is possible that the file that you wanted to load was being edited at the time of the data request. Make sure that the file is in the specified directory, that it is not being processed at the moment, and restart the request.
    Job terminated in source system --> Request set to red
    Message no. RSM078
    Can u help plz....

    Hi Vishnu
    This are the Job log details i found in source system...Can u tell what whould be the problem?
    Message
    Job started
    Step 001 started (program SBIE0001, variant &0000000002861, user ID
    Asynchronous transmission of info IDoc 2 in task 0001 (0 parallel tasks)
    DATASOURCE = ZYFI102
    RLOGSYS    =
    REQUNR     = REQU_D9Y4CZDQULRIHRRVU33KOLQZO
    UPDMODE    = D
    LANGUAGES  = *
             Current Values for Selected Profile Parameters               *
    abap/heap_area_nondia......... 0                                       *
    abap/heap_area_total.......... 10737418240                             *
    abap/heaplimit................ 40000000                                *
    zcsa/installed_languages...... DE                                      *
    zcsa/system_language.......... E                                       *
    ztta/max_memreq_MB............ 2047                                    *
    ztta/roll_area................ 3000000                                 *
    ztta/roll_extension........... 2000000000                              *
    No authorization for Acct type D
    Job cancelled after system exception ERROR_MESSAGE
    Thanks in advance
    Edited by: MohanDP on Feb 25, 2011 11:58 AM
    Edited by: MohanDP on Feb 25, 2011 12:01 PM

  • Error in Data selection in R/3 Generic Extraction Using function Modules

    Hi Friends,
    I have created a a generic data source using function module to load data from PA0000 and PA0001 Tables ,Function module is working fine when i execute it indipendently and  the data source is also working fine when i extract data using RSA3. it is showing correct no of records 157.
    When loading data into DSO from BW (using 3.x/7.0 flows) data is comming to PSA  all 157 records but in the RSMO the load status is showing yellow when i look into the step by step analysis it is
    data selection successfully started
    Data selection successfully ended
    All Data packets completed.
    are showing in red.
    after and hour time load getting failed and in the error message it is showing " job terminated in source system---> Request set to red"
    it is giving this message wir no RSM 78.
    Please let me know it

    Hi Jerry,
    Thanks for the immediate replay
    But here in my source system job is getting terminated.
    this is the status of job in Job logs.
    the job is running till this step not going ahead.
    Call customer enhancement BW_BTE_CALL_BW204010_E (BTE) with 157 records 
    Result of customer enhancement: 157 records                             
    Call customer enhancement EXIT_SAPLRSAP_001 (CMOD) with 301 records     
    Result of customer enhancement: 157 records                             
    Asynchronous send of data package 000001 in task 0002 (1 parallel tasks)
    pl. update me if any idea.

  • Error message when using function module HRIQ_TESTRESULTS_CREATE

    Hi,
    I need your help, I'm trying to use function module HRIQ_TESTRESULTS_CREATE to create external test results, I've used this function before without subscores, now I need to create subscores, but I get the message: "Grading scale UBID applies".
    The test type EXAM_UB_ING has assigned the UBID academic scale, which has a range from 1 to 677. Test type EXAM_UB_ING has 3 subtests (grammar, listening and reading) which also have the UBID academic scale assigned.
    I think this isn't a customizing problem because I can create test results with subscores using the PIQST00 transaction, the error message happens just when using the function module.
    I'm using this import parameters:
    STUDENT:
    PL:           01
    OT:          ST
    OBJID:     Student ID
    TESTRESULTS_HEADER:
    ISSUEDATE                      08.02.2010
    VALIDDATE                      30.04.2010
    TEST_GUID
    TESTEO                         50000269
    TRANSEO                        00000000
    TESTTYPE                       EXAM_UB_ING
    SESSIONID                      T1
    SESSIONYEAR                    2010
    ENTRYDATE                      08.02.2010
    TESTPASSFAIL
    TESTTOTRES                     458
    TESTSCALE_ID
    TOTALPERCENT1                   0,00
    TOTALPERCENT2                   0,00
    ENTRYMODE
    SUBTY
    Table TESTRESULTS_SUBSCORES:
    SUBTESTID            GRAMMAR
    SUBTESTTRES      GRAMMAR
    SUBT                     203
    SUBTESTID            READING
    SUBTESTTRES      READING
    SUBT                     120
    Does anybody know which could be the error? Or any other function module which I can use? (with HRIQ_TESTRESULTS_PROCESS_DATA I get the same error message).
    Thanks in advance!
    Araceli

    Araceli,
      I just noticed. You are populating SUBTESTSCALE_ID in subtest result structure.That's the reason it's throwing this error. it is trying to match Scale ID from test with value in sub test result scale ID.
    Prabhat Singh

  • Error with quantity field:Datasource Creation Using Function Module method

    Problem with DATASOURCE Creation using Function Module method :
    I have created a datasource ZSTANDARD_COST_PRICE using Function Module method . The datasource creation is successfull when I remove the quantity field from the Z table . If I dont remove the quantity field from my Z table it gives an error as "Units Field WAERS for field STPRS of datasource ZSTANDARD_COST_PRICE is hidden". I am not able to remove this error . Please someone guide.
    Let me know if my explanation is not clear enough.
    Thanks in advance,
    Neha.
    Z table definition is as below :
    MATNR MATNR CHAR 18 0 Material Number
    BWKEY BWKEY CHAR 4 0 Valuation area
    LFGJA LFGJA NUMC 4 0 Fiscal Year of Current Period
    STPRS STPRS CURR 11 2 Standard Price   " Here the currency field is WAERS and table T001
    PEINH PEINH DEC 5 0 Price Unit
    VJSTP VJSTP CURR 11 2 Standard price in previous year
    VJPEI VJPEI DEC 5 0 Price unit of previous year.
    Edited by: Neha Rathi on Jan 30, 2009 3:03 PM

    Hi,
    You should add it as one of the main fields as you have added other fields and not as the currency fields...that is..it should be part of the data source and you should be able to see it in RSO2...
    Also if added as i said then it will come as new field in the data source...you can either let it be there...or hide it..
    also if you want to populate it then you will have to write the code for this fields as well.
    Thanks
    Ajeet

  • GETTING RUNTIME ERROR IN TEXT_CONVERT_CSV_TO_SAP FUNCTION MODULE

    HI TO ALL SDNERS,
                       IM TRYING TO INSERT A COMMA SEPERATED FILE INTO AN INTERNAL TABLE BY USING FUNCTION MODULE "TEXT_CONVERT_CSV_TO_SAP",BUT IM GETTING A TYPE CONFLICT AND THE PROGRAM IS DUMPED
    TYPES : BEGIN OF TY_CUST,
               KUNNR(10),
               BUKRS(4),
               KTOKD(4),
               ANRED(15),
               NAME1(35),
               SORTL(10),
               STRAS(35),
               ORT01(10),
               PSTLZ(10),
               LZONE(10),
               LAND1(3),
               SPRAS(2),
               AKONT(10),
         END OF TY_CUST.
    TYPES: BEGIN OF TY_ECUST,
             KUNNR(10),
             ERRORMSG(255),
          END OF TY_ECUST.
    TYPES: BEGIN OF TY_SCUST,
             KUNNR(10),
             SUCESSMSG(255),
           END OF TY_SCUST.
                  INTERNAL TABLE AND WORK AREAS
    DATA : IT_CUST TYPE STANDARD TABLE OF TY_CUST INITIAL SIZE 0,
           RAW_DATA TYPE  TABLE OF TY_CUST,
           W_RAW_DATA LIKE LINE OF RAW_DATA,
           WA_CUST LIKE LINE OF IT_CUST.
    DATA: IT_ECUST TYPE TABLE OF TY_ECUST,
          WA_ECUST LIKE LINE OF IT_ECUST.
    DATA : IT_SCUST TYPE TABLE OF TY_SCUST,
           WA_SCUST LIKE LINE OF IT_SCUST.
        INTERANAL TABLE FOR STORING BDCDATA
    DATA: BEGIN OF IT_BDCDATA OCCURS 0.
    INCLUDE STRUCTURE BDCDATA.
    DATA: END OF IT_BDCDATA.
         INTERNAL TABLE FOR STORING MESSAGES
    DATA: BEGIN OF IT_CUSTMSG OCCURS 0.
    INCLUDE STRUCTURE BDCMSGCOLL.
    DATA: END OF IT_CUSTMSG.
    DATA: V_FLAG(1) VALUE '',"FLAG FOR OPENING OF SESSION
          V_TLINES TYPE SY-TABIX,"TOTAL NO RECORDS PROCESSED
          V_SLINES TYPE SY-TABIX,"TOTAL NO OF SUCESS RECORDS PROCESSED
          V_ELINES TYPE SY-TABIX."TOTAL NO OF ERROR RECORDS
       SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
    PARAMETERS : V_FNAME TYPE RLGRAP-FILENAME,
                 V_SESS TYPE RLGRAP-FILENAME.
    SELECTION-SCREEN END OF BLOCK B2.
    INITIALIZATION.
    V_FNAME = 'C:\Documents and Settings\Administrator\Desktop\2.TXT'.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR V_FNAME.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
       PROGRAM_NAME        = SYST-CPROG
       DYNPRO_NUMBER       = SYST-DYNNR
       FIELD_NAME          = ' '
    IMPORTING
       FILE_NAME           = V_FNAME
    START-OF-SELECTION.
    PERFORM F_UPLOAD USING V_FNAME
                    CHANGING  IT_CUST.
    END-OF-SELECTION.
    PERFORM F_BDCGENERATE.
    *&      Form  F_UPLOAD
          text
         -->P_V_FNAME  text
         <--P_IT_CUST  text
    FORM F_UPLOAD  USING    P_V_FNAME LIKE V_FNAME
                   CHANGING P_IT_CUST LIKE IT_CUST.
    DATA: LV_FILE TYPE STRING.
    LV_FILE = P_V_FNAME.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = LV_FILE
      TABLES
        DATA_TAB                      = RAW_DATA
    IF SY-SUBRC = 0.
    *DESCRIBE TABLE P_IT_CUST LINES V_TLINES.
    ENDIF.
    CALL FUNCTION 'TEXT_CONVERT_CSV_TO_SAP'
      EXPORTING
       I_FIELD_SEPERATOR          = ';'
      I_LINE_HEADER              =
        I_TAB_RAW_DATA             = RAW_DATA
       I_FILENAME                 =  'C:\Documents and Settings\Administrator\Desktop\2.TXT'
      TABLES
        I_TAB_CONVERTED_DATA       = P_IT_CUST
    EXCEPTIONS
       CONVERSION_FAILED          = 1
       OTHERS                     = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " F_UPLOAD

    hai,
    Use
    raw_data TYPE TRUXS_T_TEXT_DATA
    Don't forget to reward if useful....

  • When i use function module to create additive costs using KKPI_BDC_ADD_ON_C

    Hi,
    When i use function module KKPI_BDC_ADD_ON_COSTS_CREATE to create additive costs it shows an error. The error is 'THE OBJECT IS LOCKED BY THE USER SARKARD'  the transaction it uses is CK74 for creating.
    I have also read about KKP4_ADD_ON_COSTS_CREATE. But i dont know the usage of it.. 
    I think it will be helpful if u can clarify with first FM.
    Kindly suggest.
    Thank you.
    Harsha

    Hi Harsha,
    I have a similar requirement, but the issue that I am facing is that I can not find any parameter in the FM - KKPI_BDC_ADD_ON_COSTS_CREATE for Valuation Date which is a mandatory field in CK74. How did you overcome that issue, can you please share ?

  • Getting error in the function module

    Hi everybody.
    I have created one function module in se37 and i am calling that function module in the se38 report, when i am executing the report it is throwing me an error.
    here in my report i am having the select option fields ex matnr, in the function module importing i have given the parameter matnr over there and when i am running the report it is through an error that 
    "The function module interface allows you to specify only 
    fields of a particular type under "MATNR".               
    The field "S_MATNR" specified here is a different        
    field type                                                "
    IF i am giving the parameter instead of select-options in the report and executing, then the function module is getting triggered and receiving the data what ever the code is available in the source code.
    can anyone help me out in this issue so that i can get the data while using the select-option instead of parameter.
    Thanks in advance

    Hi,
    Actually, I wouldn't recommend the use of that tables parameter...
    From sap help:
    Table parameters are obsolete CHANGING parameters that are typed as standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to a formal parameter of this type, an empty local header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. Pass by value is not possible in formal parameters defined using TABLES. Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created for the internal table in the function module by using the addition LIKE LINE OF itab of the DATA statement.
    Exceptions
    So i definitely would go with either importing or changing parameter...
    Cheers,
    m.

  • Data transfer of Selected sets (QS51) using Function modules

    Hi All,
    I am doing data migration of Selected sets (TCODE QS51) using function module. I have tried using BDC recording but it is not working in background.In foreground it is giving information error on second screen as field  RQSKT-AUSWAHLMGE is not present on screen 1000..  In foreground I am pressing enter after this error its working fine but in background the execution stops there. So I am trying function modules QPAM_SELSET_CODE_CREATE  and QPAM_SELECTED_SET_CREATE
    The fields in template I have are KATALOGART(Catalog), WERKS(Plant),AUSWAHLMGE(Selected set) ,KTX01(short text), STATUS(status),CODEGRUPPE(code group), CODE (code), KURZTEXT (short text for codegroup),BEWERTUNG(Valuation code), FEHLKLASSE(Defect class)
    QPAM_SELSET_CODE_CREATE contains fields  KATALOGART, WERKS,AUSWAHLMGE ,CODEGRUPPE,CODE which I need and While stand alone testing of this function module I am geting error as follows with the data filled :
    Runtime:        6.496 Microseconds
    Exception       WRONG_KEY
    Message ID:          QS                         Message number:           299
    Message:
    No entries were found in catalog 1
    MAN WERK K AUSWAHLM CODEGRUP CODE
    300 WI10 1 DDTEST   THREADS  1
    QPAM_SELECTED_SET_CREATE contains KATALOGART , WERKS,AUSWAHLMGE , KTX01 which I need and it requires Language key fiels KSP01. I specified it it executes successfully but in transaction it is not there. some FMs contain some fields and not all fields so I want to know which one to use ? Can anyone give me sample code how to use these FMs?

    Note 381286 - Code grps + selectd sets:Transport request requestd
    Note 592418 - Composite SAP note: Transport of code groups and codes
    But I do not recommend a modification because the system does not generate request for that in the production system.
    This means you can maintain catalog directly without transport in the production system.
    Only development or test system ask you a request number.
    Regards
    Luke

  • There seems to be an error in the function module OPEN_FORM obstructing the

    Hi,
    There seems to be an error in the function module OPEN_FORM obstructing the process.
    Some vendors are not cabaple of usinf EDI and for some reason also not willing to use TTOOL solutions (example Hewlet Packard). In those cases the supplier still would like to get purchase order electronically via e-mail. Sending POu2019s via external mail (SMTP) is basically standard function in R/3 that has been possible since the version 4.5. It is not pre-configured, so (almost) all the required elements needs to be configured.
    When we send the output message through ME9F t'code i facing the problem in the above FM.
    Please help me how to solve this.
    Vijay

    Got you, the digital display for Cupertino and Frankfurt are wrong too.
    Submit feedback:
    http://www.apple.com/feedback/iphone.html

  • Create a generic extractor using Function module,  what steps must I follow

    Hello gurus team
    I need to Create a generic extractor using Function module,  what steps must I follow?
    Just I have a function module not estructures or something, only the program.... and I have intented to do it in rso2 using the fm option, but give an error... somebody can helpme???
    BR

    Hi,
    Generic Extraction via Function Module
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33
    http://help.sap.com/saphelp_nw04/helpdata/en/86/1c8c3e94243446e10000000a114084/frameset.htm
    Thanks,
    JituK

  • Command Error in FTP_COPY function module

    I need to transfer file to non-sap server and I am using function modules FTP_CONNECT and FTP_COPY to do the same. FTP_CONNECT establishes connection to server but FTP_COPY fails with raising exception COMMAND_ERROR (CERROR = 2). We are unable to trace why exactly this exception is raised and what is the root cause for it.
    Has anybody used these function modules to transfer file? Any experience or hints on mentioned error? Any kindly is very much appreciated. Thank you.
    -Abhijit

    Hello,
    Did you use SAPFTP as RFC destination ?
    What you also can do is take a look at the following SAP test programs who use the same function modules (FTP_CONNECT, FTP_COPY, ...):
    RSFTP003                               FTP put / get Test
    RSFTP004                               FTP Copy
    RSFTP006                               FTP command list
    RSFTP007                               Test FB:FTP_SERVER_TO_R3 / FTP_R3_TO_SERVER
    RSFTP009                               Test FTP put with Verify
    RSFTP011                               FTP Copy
    I have always used these programs as a reference for FTP programmation with success.
    Good luck.
    Wim

  • ALV Tree using Function Modules

    Hi,
    I want a simple example of ALV Tree using Function Modules which can display multiple Columns in the Hierarchically arranged fashion along with nodes & icons.
    Also should be able to handle the events.
    Thanks in Advance..

    Hi Ramesh,
    Here is a example of alv tree
    *& Report  BCALV_TREE_DEMO                                             *
    report  bcalv_tree_demo.
    class cl_gui_column_tree definition load.
    class cl_gui_cfw definition load.
    data tree1  type ref to cl_gui_alv_tree.
    data mr_toolbar type ref to cl_gui_toolbar.
    include <icon>.
    include bcalv_toolbar_event_receiver.
    include bcalv_tree_event_receiver.
    data: toolbar_event_receiver type ref to lcl_toolbar_event_receiver.
    data: gt_sflight      type sflight occurs 0,      "Output-Table
          gt_fieldcatalog type lvc_t_fcat, "Fieldcatalog
          ok_code like sy-ucomm.           "OK-Code
    start-of-selection.
    end-of-selection.
      call screen 100.
    *&      Module  PBO  OUTPUT
    *       process before output
    module pbo output.
      set pf-status 'MAIN100'.
      if tree1 is initial.
        perform init_tree.
      endif.
      call method cl_gui_cfw=>flush.
    endmodule.                             " PBO  OUTPUT
    *&      Module  PAI  INPUT
    *       process after input
    module pai input.
      case ok_code.
        when 'EXIT' or 'BACK' or 'CANC'.
          perform exit_program.
        when others.
          call method cl_gui_cfw=>dispatch.
      endcase.
      clear ok_code.
      call method cl_gui_cfw=>flush.
    endmodule.                             " PAI  INPUT
    *&      Form  build_fieldcatalog
    *       build fieldcatalog for structure sflight
    form build_fieldcatalog.
    * get fieldcatalog
      call function 'LVC_FIELDCATALOG_MERGE'
           exporting
                i_structure_name = 'SFLIGHT'
           changing
                ct_fieldcat      = gt_fieldcatalog.
    * change fieldcatalog
      data: ls_fieldcatalog type lvc_s_fcat.
      loop at gt_fieldcatalog into ls_fieldcatalog.
        case ls_fieldcatalog-fieldname.
          when 'CARRID' or 'CONNID' or 'FLDATE'.
            ls_fieldcatalog-no_out = 'X'.
            ls_fieldcatalog-key    = ''.
          when 'PRICE' or 'SEATSOCC' or 'SEATSMAX' or 'PAYMENTSUM'.
            ls_fieldcatalog-do_sum = 'X'.
        endcase.
        modify gt_fieldcatalog from ls_fieldcatalog.
      endloop.
    endform.                               " build_fieldcatalog
    *&      Form  build_hierarchy_header
    *       build hierarchy-header-information
    *      -->P_L_HIERARCHY_HEADER  strucxture for hierarchy-header
    form build_hierarchy_header changing
                                   p_hierarchy_header type treev_hhdr.
      p_hierarchy_header-heading = 'Hierarchy Header'.         "#EC NOTEXT
      p_hierarchy_header-tooltip =
                             'This is the Hierarchy Header !'. "#EC NOTEXT
      p_hierarchy_header-width = 30.
      p_hierarchy_header-width_pix = ''.
    endform.                               " build_hierarchy_header
    *&      Form  exit_program
    *       free object and leave program
    form exit_program.
      call method tree1->free.
      leave program.
    endform.                               " exit_program
    *&      Form  build_header
    *       build table for html_header
    *  -->  p1        text
    *  <--  p2        text
    form build_comment using
          pt_list_commentary type slis_t_listheader
          p_logo             type sdydo_value.
      data: ls_line type slis_listheader.
    * LIST HEADING LINE: TYPE H
      clear ls_line.
      ls_line-typ  = 'H'.
    * LS_LINE-KEY:  NOT USED FOR THIS TYPE
      ls_line-info = 'ALV-tree-demo: flight-overview'.       "#EC NOTEXT
      append ls_line to pt_list_commentary.
    * STATUS LINE: TYPE S
      clear ls_line.
      ls_line-typ  = 'S'.
      ls_line-key  = 'valid until'.                          "#EC NOTEXT
      ls_line-info = 'January 29 1999'.                      "#EC NOTEXT
      append ls_line to pt_list_commentary.
      ls_line-key  = 'time'.
      ls_line-info = '2.00 pm'.                              "#EC NOTEXT
      append ls_line to pt_list_commentary.
    * ACTION LINE: TYPE A
      clear ls_line.
      ls_line-typ  = 'A'.
    * LS_LINE-KEY:  NOT USED FOR THIS TYPE
      ls_line-info = 'actual data'.                          "#EC NOTEXT
      append ls_line to pt_list_commentary.
      p_logo = 'ENJOYSAP_LOGO'.
    endform.
    *&      Form  create_hierarchy
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form create_hierarchy.
      data: ls_sflight type sflight,
            lt_sflight type sflight occurs 0.
    * get data
      select * from sflight into table lt_sflight
                            UP TO 200 ROWS .
      sort lt_sflight by carrid connid fldate.
    * add data to tree
      data: l_carrid_key type lvc_nkey,
            l_connid_key type lvc_nkey,
            l_last_key type lvc_nkey.
      loop at lt_sflight into ls_sflight.
        on change of ls_sflight-carrid.
          perform add_carrid_line using    ls_sflight
                                  changing l_carrid_key.
        endon.
        on change of ls_sflight-connid.
          perform add_connid_line using    ls_sflight
                                           l_carrid_key
                                  changing l_connid_key.
        endon.
        perform add_complete_line using  ls_sflight
                                         l_connid_key
                                changing l_last_key.
      endloop.
    * calculate totals
      call method tree1->update_calculations.
    * this method must be called to send the data to the frontend
      call method tree1->frontend_update.
    endform.                               " create_hierarchy
    *&      Form  add_carrid_line
    *       add hierarchy-level 1 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    form add_carrid_line using     ps_sflight type sflight
                                   p_relat_key type lvc_nkey
                         changing  p_node_key type lvc_nkey.
      data: l_node_text type lvc_value,
            ls_sflight type sflight.
    * set item-layout
      data: lt_item_layout type lvc_t_layi,
            ls_item_layout type lvc_s_layi.
      ls_item_layout-t_image = '@3P@'.
      ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
      append ls_item_layout to lt_item_layout.
    * add node
      l_node_text =  ps_sflight-carrid.
      call method tree1->add_node
        exporting
              i_relat_node_key = p_relat_key
              i_relationship   = cl_gui_column_tree=>relat_last_child
              i_node_text      = l_node_text
              is_outtab_line   = ls_sflight
              it_item_layout   = lt_item_layout
           importing
              e_new_node_key = p_node_key.
    endform.                               " add_carrid_line
    *&      Form  add_connid_line
    *       add hierarchy-level 2 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    form add_connid_line using     ps_sflight type sflight
                                   p_relat_key type lvc_nkey
                         changing  p_node_key type lvc_nkey.
      data: l_node_text type lvc_value,
            ls_sflight type sflight.
    * set item-layout
      data: lt_item_layout type lvc_t_layi,
            ls_item_layout type lvc_s_layi.
      ls_item_layout-t_image = '@3Y@'.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensified.
      ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
      append ls_item_layout to lt_item_layout.
    * add node
      l_node_text =  ps_sflight-connid.
      call method tree1->add_node
        exporting
              i_relat_node_key = p_relat_key
              i_relationship   = cl_gui_column_tree=>relat_last_child
              i_node_text      = l_node_text
              is_outtab_line   = ls_sflight
              it_item_layout   = lt_item_layout
           importing
              e_new_node_key = p_node_key.
    endform.                               " add_connid_line
    *&      Form  add_cmplete_line
    *       add hierarchy-level 3 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    form add_complete_line using   ps_sflight type sflight
                                   p_relat_key type lvc_nkey
                         changing  p_node_key type lvc_nkey.
      data: l_node_text type lvc_value.
    * set item-layout
      data: lt_item_layout type lvc_t_layi,
            ls_item_layout type lvc_s_layi.
      ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
      ls_item_layout-class   = cl_gui_column_tree=>item_class_checkbox.
      ls_item_layout-editable = 'X'.
      append ls_item_layout to lt_item_layout.
      l_node_text =  ps_sflight-fldate.
      call method tree1->add_node
        exporting
              i_relat_node_key = p_relat_key
              i_relationship   = cl_gui_column_tree=>relat_last_child
              is_outtab_line   = ps_sflight
              i_node_text      = l_node_text
              it_item_layout   = lt_item_layout
           importing
              e_new_node_key = p_node_key.
    endform.                               " add_complete_line
    *&      Form  register_events
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form register_events.
    * define the events which will be passed to the backend
      data: lt_events type cntl_simple_events,
            l_event type cntl_simple_event.
    * define the events which will be passed to the backend
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_click.
      append L_EVENT to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
      append L_EVENT to lt_events.
      call method tree1->set_registered_events
        exporting
          events = lt_events
        exceptions
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      if sy-subrc <> 0.
        message x208(00) with 'ERROR'.                       "#EC NOTEXT
      endif.
    * set Handler
      data: l_event_receiver type ref to lcl_tree_event_receiver.
      create object l_event_receiver.
      set handler l_event_receiver->handle_node_ctmenu_request
                                                            for tree1.
      set handler l_event_receiver->handle_node_ctmenu_selected
                                                            for tree1.
      set handler l_event_receiver->handle_item_ctmenu_request
                                                            for tree1.
      set handler l_event_receiver->handle_item_ctmenu_selected
                                                            for tree1.
    endform.                               " register_events
    *&      Form  change_toolbar
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form change_toolbar.
    * get toolbar control
      call method tree1->get_toolbar_object
              importing
                  er_toolbar = mr_toolbar.
      check not mr_toolbar is initial.
    * add seperator to toolbar
      call method mr_toolbar->add_button
              exporting
                  fcode     = ''
                  icon      = ''
                  butn_type = cntb_btype_sep
                  text      = ''
                  quickinfo = 'This is a Seperator'.         "#EC NOTEXT
    * add Standard Button to toolbar (for Delete Subtree)
      call method mr_toolbar->add_button
              exporting
                  fcode     = 'DELETE'
                  icon      = '@18@'
                  butn_type = cntb_btype_button
                  text      = ''
                  quickinfo = 'Delete subtree'.              "#EC NOTEXT
    * add Dropdown Button to toolbar (for Insert Line)
      call method mr_toolbar->add_button
              exporting
                  fcode     = 'INSERT_LC'
                  icon      = '@17@'
                  butn_type = cntb_btype_dropdown
                  text      = ''
                  quickinfo = 'Insert Line'.           "#EC NOTEXT
    * set event-handler for toolbar-control
      create object toolbar_event_receiver.
      set handler toolbar_event_receiver->on_function_selected
                                                          for mr_toolbar.
      set handler toolbar_event_receiver->on_toolbar_dropdown
                                                          for mr_toolbar.
    endform.                               " change_toolbar
    *&      Form  init_tree
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_tree.
    * create fieldcatalog for structure sflight
      perform build_fieldcatalog.
    * create container for alv-tree
      data: l_tree_container_name(30) type c,
            l_custom_container type ref to cl_gui_custom_container.
      l_tree_container_name = 'TREE1'.
      if sy-batch is initial.
        create object l_custom_container
          exporting
                container_name = l_tree_container_name
          exceptions
                cntl_error                  = 1
                cntl_system_error           = 2
                create_error                = 3
                lifetime_error              = 4
                lifetime_dynpro_dynpro_link = 5.
        if sy-subrc <> 0.
          message x208(00) with 'ERROR'.                       "#EC NOTEXT
        endif.
      endif.
    * create tree control
      create object tree1
        exporting
            parent              = l_custom_container
            node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
            item_selection      = 'X'
            no_html_header      = ''
            no_toolbar          = ''
        exceptions
            cntl_error                   = 1
            cntl_system_error            = 2
            create_error                 = 3
            lifetime_error               = 4
            illegal_node_selection_mode  = 5
            failed                       = 6
            illegal_column_name          = 7.
      if sy-subrc <> 0.
        message x208(00) with 'ERROR'.                       "#EC NOTEXT
      endif.
    * create Hierarchy-header
      data l_hierarchy_header type treev_hhdr.
      perform build_hierarchy_header changing l_hierarchy_header.
    * create info-table for html-header
      data: lt_list_commentary type slis_t_listheader,
            l_logo             type sdydo_value.
      perform build_comment using
                     lt_list_commentary
                     l_logo.
    * repid for saving variants
      data: ls_variant type disvariant.
      ls_variant-report = sy-repid.
    * create emty tree-control
      call method tree1->set_table_for_first_display
         exporting
                   is_hierarchy_header  = l_hierarchy_header
                   it_list_commentary   = lt_list_commentary
                   i_logo               = l_logo
                   i_background_id      = 'ALV_BACKGROUND'
                   i_save               = 'A'
                   is_variant            = ls_variant
         changing
                   it_outtab            = gt_sflight "table must be emty !!
                   it_fieldcatalog      = gt_fieldcatalog.
    * create hierarchy
      perform create_hierarchy.
    * add own functioncodes to the toolbar
      perform change_toolbar.
    * register events
      perform register_events.
    * adjust column_width
      call method tree1->COLUMN_OPTIMIZE.
    ENDFORM.                    " init_tree
    regards,
    venu.

  • Problem in getting public holiday class using function module

    Hi to all
    I am using function module
    HR_PERSON_READ_WORK_SCHEDULE.
    for getting the employee's actual work schedule and public holiday class FTKLA.
    But I am unable to get the correct public holiday class.
    Please guide me.
    How to do that.
    Regards
    Anubhav

    Hi,
    form build_work_schedule tables b_psp structure pdpsp
                                    b_day_psp structure pdsppsp
                                    b_employees structure pdpnr
                             using value(b_begda) like sy-datum
                                   value(b_endda) like sy-datum
                                   value(b_read_db) type c.
      data: counter type i. "Note 495298
      call function 'HR_PERSON_READ_WORK_SCHEDULE'
           exporting
                begin_date          = b_begda
                end_date            = b_endda
               grouping_dws        = motpr    "VEX Modif
               grouping_attendence = moabw
               grouping_substitute = mover
                read_from_database  = b_read_db
                im_read_no_locked_records = 'X'                 "803380
           tables
                pernr_tab           = b_employees
                psp                 = b_psp
                day_psp             = b_day_psp
           exceptions
                error_in_build_psp  = 1
                others              = 2.
      read table b_employees with key error = 'X'
                             transporting pernr.
      if sy-subrc eq 0.
        read table d3000_pers with key pernr = b_employees-pernr
                                               transporting name.
        if sy-subrc eq 0.
          message s582 with d3000_pers-name.
        else.
          message s582 with b_employees-pernr.
        endif.
      endif.
    Hope it helps you.

Maybe you are looking for