HR ABAP - Using of function module HR_READ_INFOTYPE

Hi,
I want to replace the below SELECT statement with the function module by HR_READ_INFOTYPE.
IF l_begda LE '20100331'.
          l_assgnda = '20100401'.
        ELSE.
          l_assgnda = l_begda.
        ENDIF.
SELECT SINGLE werks
        FROM pa0315
        INTO e_t_data-zz_werks
        WHERE pernr = wa-pernr
        AND endda GE l_assgnda   
        AND begda LE l_assgnda.
But the problem is, in the where condition i have to use LE or GE condition for endda and begda. So how can i use  the function module  for replacing the select statement without changing the functionality.

Hi,
You are selecting a single entry... So you will just need to pass the variable l_assgnda to the BEGDA and ENDDA parameters of the FM...
added: also, if that infotype can have concurrent records (but in that case the select is not correct), you will have to take the first one from INFTY_TAB...
Cheers,
Manu.
Edited by: Manu D'Haeyer on Dec 29, 2011 2:40 PM

Similar Messages

  • Regarding the Function module HR_READ_INFOTYPE

    Hi Experts,
    I'm using the Function module HR_READ_INFOTYPE and the code is as following
    CALL FUNCTION 'HR_READ_INFOTYPE'
            EXPORTING
              pernr     = g_pernr
              infty     = '0002'
            TABLES
              infty_tab = it0002.
          CLEAR wa0002.
          READ TABLE it0002 INTO wa0002 WITH KEY pernr = g_pernr.
    it is not fetching the data for a particular PERNR but the sy-subrc is 0 after the executing the Function module.
    Please help me out.
    Thanks
    Nivash S

    Hi Experts,
    Thanks for Ur advice. Actually there is no authorization for that particular PERNR thats why it has skipped that particular record.
    Thanks Once again,
    Nivash S
    Edited by: Nivash S on May 12, 2009 8:49 AM

  • Using a function module in ABAP Query

    Hi All,
    I want to use a function module in ABAp query in the Record Processing Section.
    In the report program we click on Pattern button to inser the function module so that all the Importing and exporting parameter automatically appears.
    Similarly is there any particular method of inserting a function module in ABAp Query.
    Regards
    Manipal Parkala

    When you are doing the infoset for the query (SQ02) you can add coding by clicking the coding tab. You can chose in wich event you want your coding and there is Pattern Button for  you to easy use.
    If you don't want to put the code in the infoset just in the query then is not posible.
    Nevertheless, I higly descourage the use of coding in queryies. If you need to insert some coding make an ALV its easier, clearer and much easier to mantain.
    Hope it helps.

  • How to use this function module on abap hr GET_PDSNR_RANGE

    how to use this function module on abap hr GET_PDSNR_RANGE
    thankx.

    PASS INETRNAL TABLE WITH SOME DATA TO TABELLE FOR GENERATING PDSNR SEQUENCE

  • Using function module HR_READ_INFOTYPE

    Hi,
    I am fetching the data from PA0001,PA0002 and PA0105 using function module HR_READ_INFOTYPE.But when I am passing the prnr as 7 , it is getting changed to 7000 in the function module. Thats why it is not fetching the data.Please suggest why is it happening. ALso I have to fetch name of the pernr. But from PA0002 , I am not able to fetch the name.Please suggest the solution.

    Make sure for data Declaration in you program you have defined Pernr like
            pernr         LIKE p0000-pernr,            "Personnel Number
    Also check the valid infotype records exists for the dates you are passing
      CALL FUNCTION 'HR_READ_INFOTYPE'
              EXPORTING
                 TCLAS                 = 'A'
                 pernr                 = g_t_table-pernr
                 infty                 = '0002'
                 begda                 = g_t_table-begda
                 endda                 = g_t_table-endda
    *             BYPASS_BUFFER         = ' '
    *             LEGACY_MODE           = ' '
    *           IMPORTING
    *             SUBRC                 =
              TABLES
                infty_tab             = p0002
              EXCEPTIONS
                infty_not_found       = 1
                OTHERS                = 2

  • Issue with use of Function Module GUI_UPLOAD

    Hi Experts,
    I have an issue in using the Function Module GUI_UPLOAD for uploading the contents of an Excel file on the Presentation Server to an internal table in an ABAP Program.
    My file consists of around 300 records but the FM succeeds in uploading only the first 6 lines to the Internal Table specified while calling the FM.
    I dont have any idea why this happens. Any pointers in this direction will be helpful.
    Thanks in advance.
    Regards,
    Keerthi

    Hi,
    Kindly go through this link below:
    https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=60655105
    Hope it helps you
    Regards
    Mansi

  • How to Use ECC function Module

    Hi Experts - We need to execute the function module in ECC and need to write data in Oracle table.
    We are using BODS 4.0.
    How to use function module in data flow ? how it can work as a source ?
    I just need some basic steps how to use function module as a source and do the transformation to target.
    Thanks
    R

    Hi Ashwani,
    It is still not possible to use a FM as a source in DS.
    You can use a FM in a transformation but you have to start from a file or table as a source and load into a target (a FM can not be an end point of a dataflow - as it is used in the transformation and each transformation requires a source and a target.
    The scenario I described above was based on a situation where you have a source (flat file or table) and want to use a Function Module to transform your data and/or load the data in a transparant table in SAP.
    Your scenario is different, as your source is not a table/ff but a FM.
    In your case, I can see two scerio's:
    - Use an ABAP dataflow. Although I haven't got any experience with this I do believe this would be an option for your scenario. Please referer to the Data Services documentation on ABAP dataflows for further guidance.
    - As suggested earlier, you can create a bespoke (BW) Datasource based on a Function Module. Please refer to SAP help for creating a generic datasource:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
    Depending on your scenario there might be a third option:
    - Use a SAP transparant table as a source. Create a transformation into the designated Oracle table. In the transformation call a FM which executes whatever logic you require. This solution will work if you have a table which produces the same number of records as your FM. If your function module produces more or less records (than there are in the transparant table), then this might become a bit tricky. It might work, but I have never tried it.
    Instead of a transparant table you can also use a table join, obviously. Perhaps part of the complexity of your FM could be resolved by using a join and you can create a new simpler FM for the remaining logic?
    Good luck,
    Jan.

  • How to use the function module ....

    hi
    how to use the function module ssf_function_module_name in smartforms

    Hi..
    If you are using this Function module, you can get the generated function module name of smartform dynamically. It is good progrmaming practice to get the fucntion module name dynamically because there might be some problems if you are hard coding in program.
    This will return the name of the function module and then from the exporting parameters you can use the fucntion module name to pass parameters to Smartforms.
    Check this link.I am expalining here how to use this function module.
    https://wiki.sdn.sap.com/wiki/pages/pointstab/viewpageversion.action?pageId=36109&version=2
    Calling SMARTFORMS from your ABAP program
    REPORT ZSMARTFORM.
    Calling SMARTFORMS from your ABAP program.
    Collecting all the table data in your program, and pass once to SMARTFORMS
    SMARTFORMS
    Declare your table type in :-
    Global Settings -> Form Interface
    Global Definintions -> Global Data
    Main Window -> Table -> DATA
    Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
    http://sapr3.tripod.com
    TABLES: MKPF.
    DATA: FM_NAME TYPE RS38L_FNAM.
    DATA: BEGIN OF INT_MKPF OCCURS 0.
    INCLUDE STRUCTURE MKPF.
    DATA: END OF INT_MKPF.
    SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
    SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
    MOVE-CORRESPONDING MKPF TO INT_MKPF.
    APPEND INT_MKPF.
    ENDSELECT.
    At the end of your program.
    Passing data to SMARTFORMS
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZSMARTFORM'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    if sy-subrc <> 0.
    WRITE: / 'ERROR 1'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function FM_NAME
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS =
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    TABLES
    GS_MKPF = INT_MKPF
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    <b>Reward points if useful</b>
    Regards
    Ashu

  • ABAP Program or Function Module to activate infospoke/openhub table

    Hi,
    Post migration to production, when i am trying to load the data in open hub table, its showing OH table is not active. i had tried to all aspect but i am unable to load the data.
    is there any ABAP Program or Function Module to activate infospoke/openhub table
    Thanks & Regards,
    Pankaj Bansal

    Hello Pankaj,
    Please check whether you have access to TCode SE14 . If Yes , You can use this TCode to activate the Tables.
    There are lot of  Posts talk about the procedure for activation through SE14. please refer the same
    Thanks & regards,
    Prasath

  • Regarding how to use the function module *control_form* in scripts

    HI friends,
    Can any one tell why and where do we use the function module control_form in scripts. Can you give me a small scenario how to use in scripts.

    hi satish,
    by using this function module we can pass the control
    commands to FORM THROUGH ABAP/4 PROGRAM.
    see the following example:
    TABLES: kna1.
    DATA: BEGIN OF it_kna1 OCCURS 0,
          kunnr LIKE kna1-kunnr,
          name1 LIKE kna1-name1,
          ort01 LIKE kna1-ort01,
          land1 LIKE kna1-land1,
          END OF it_kna1.
    DATA:records TYPE i,
         window TYPE i value 1.
    select-options:s_kunnr for kna1-kunnr.
    SELECT kunnr name1 ort01 land1 FROM kna1 INTO TABLE it_kna1
    where kunnr in s_kunnr.
    CALL FUNCTION 'OPEN_FORM'
      EXPORTING
        form     = 'ZSCRIPT4'
        language = sy-langu.
    LOOP AT it_kna1.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element  = 'ELE1'
          function = 'SET'
          type     = 'BODY'
          window   = 'MAIN'.
      DESCRIBE TABLE it_kna1 LINES records.
      IF window lt records.
        window = window + 1.
      CALL FUNCTION 'CONTROL_FORM'
       EXPORTING
            command         = 'NEW-WINDOW'
    EXCEPTIONS
      UNOPENED        = 1
    UNSTARTED       = 2
    OTHERS          = 3
      ENDIF.
    ENDLOOP.
    CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
      RESULT                         =
      RDI_RESULT                     =
    TABLES
      OTFDATA                        =
    EXCEPTIONS
      UNOPENED                       = 1
      BAD_PAGEFORMAT_FOR_PRINT       = 2
      SEND_ERROR                     = 3
      SPOOL_ERROR                    = 4
      CODEPAGE                       = 5
      OTHERS                         = 6
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    thanks,
    raji

  • ABAP Object or function module?

    Hello all!
    I have to create a reusable routine. This routine should be select data from Z table for to get data with a parameter ID. I will pass a ID and expect result a internal table with some parameter values.
    So, my question is: What i use for to do that? ABAP Object or function module?
    I think that so easy to use function module. Why i should to use ABAP objects? What is positive points in use object and not function module?
    For me, both do the same thing... i don't see any difference. Just object is more complicated.
    Please, tell me why should i use object??
    Edited by: Rodrigo Kenji Matsunaga on Dec 10, 2009 5:51 PM

    I would go with Class.
    Read through this discussion:
    Needing Evidence on the Advantages of ABAP OO
    Class would provide you a flexibility of inheritance. E.g. if you want to use the same data selection with little modification in your other applications, you can inherit some other class form this class. Redefine the method, call the Super's method and change the output before sending back to the caller.
    Regards,
    Naimesh Patel

  • Null character removal in sap using a function module

    Little background :
    1) we are using a lot of interfaces with legacy and the data in sap has null characters for example : phone#123 .
    the prob is not on sap side but on bw side when i extract this data it converts to hex format and the load fails.
    2) so i wrote a abap function module for the extractor which uses the function modules SRET_TEXT_TO_BINARY and SRET_BINARY_TO_TEXT and passed the variable that has the null character and replaced it with space.
    3) the prob is i get null characters in a lot of fields now and i am not sure how i can pass it to SRET_BINARY_TO_TEXT OR SRET_TEXT_TO_BINARY as they are SAP standard and it takes in just a single variable. i have all my fields in a internal table .
    I apologize for the the length of the message but any help is greatly appreciated.I want to know how to pass a internal table with null in all fields to a standard function module bec . The code is below :
    =======================================================
      CALL FUNCTION 'SRET_TEXT_TO_BINARY'
        EXPORTING
          TEXT                        = input
        TEXT_LENGTH                 = -1
          LAISO                       = '00'
        IV_CATID                    = ' '
        IV_RFC_FOR_INITIALIZE       = ' '
       IMPORTING
        OUTPUT_LENGTH               =
          XBUFFER                     = v_hexa
       EXCEPTIONS
          FAILED                      = 1
          OTHERS                      = 2
      IF SY-SUBRC = 0.
    *Replacing all NULL (X'00') values with SPACE (X'20')
      REPLACE ALL OCCURRENCES OF c_null IN v_hexa WITH c_space IN BYTE MODE.
        CALL FUNCTION 'SRET_BINARY_TO_TEXT'
          EXPORTING
            XBUFFER                     = v_hexa
            LAISO                       = '00'
          IV_CATID                    = ' '
          IV_RFC_FOR_INITIALIZE       = ' '
         IMPORTING
          OUTPUT_LENGTH               =
            TEXTBUFFER                  = output
         EXCEPTIONS
            FAILED                      = 1
            OTHERS                      = 2

    The entire code :
    =======================================================
    FUNCTION YFR1_CA_U_NULL_SPACE.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(INPUT) TYPE  C
    *"  EXPORTING
    *"     REFERENCE(OUTPUT) TYPE  C
    *"  EXCEPTIONS
    *"      LENGTH_TOO_LONG
    *"      FAILED
    This function provides the functionality of replacing the NULL
    characters with SPACE .
      DATA : v_hexa(100) TYPE X ,
             c_space(2) TYPE X VALUE '0020' ,
             c_null(2) TYPE X VALUE '0000' ,
             v_length TYPE i .
      COMPUTE v_length = STRLEN( input ) .
      IF v_length > '100'.
        RAISE length_too_long .
      ENDIF .
      CALL FUNCTION 'SRET_TEXT_TO_BINARY'
        EXPORTING
          TEXT                        = input
        TEXT_LENGTH                 = -1
          LAISO                       = '00'
        IV_CATID                    = ' '
        IV_RFC_FOR_INITIALIZE       = ' '
       IMPORTING
        OUTPUT_LENGTH               =
          XBUFFER                     = v_hexa
       EXCEPTIONS
          FAILED                      = 1
          OTHERS                      = 2
      IF SY-SUBRC = 0.
    *Replacing all NULL (X'00') values with SPACE (X'20')
      REPLACE ALL OCCURRENCES OF c_null IN v_hexa WITH c_space IN BYTE MODE.
        CALL FUNCTION 'SRET_BINARY_TO_TEXT'
          EXPORTING
            XBUFFER                     = v_hexa
            LAISO                       = '00'
          IV_CATID                    = ' '
          IV_RFC_FOR_INITIALIZE       = ' '
         IMPORTING
          OUTPUT_LENGTH               =
            TEXTBUFFER                  = output
         EXCEPTIONS
            FAILED                      = 1
            OTHERS                      = 2
        IF SY-SUBRC <> 0.
          RAISE FAILED .
        ENDIF.
      ELSE.
        RAISE FAILED .
      ENDIF .
    ENDFUNCTION.

  • How to insert  WorkBench Request to a domain using a function Module...

    Dear ALL,
                        I am creating a program where I have created a domain using a Function Module and assigned the same domain to a package using a Function Module. Now I want to assign the domain to a WorkBench Request...Can anyone tell me of a Function Module to achieve the same???  Please note that the WorkBench Request is entered by the user on the Selection-Screen.
    Moderator message: please do not open multiple threads for the same issue, rather follow up (or bump up) on existing ones.
    Edited by: Thomas Zloch on Dec 15, 2010 1:18 PM

    Hi Anjali,
    Thanks for the response.
    I have passed the PSGNUM and HLEVEL values while populating the data records. Then I sent the data records and control record information to the function module IDOC_INBOUND_WRITE_TO_DB. Inside this function module there is code to clear the PSGNUM values and HLEVEL values.
    for compatibility: clear administration data of data records
               perform data_records_wipe
                                      tables
                                          t_data_records.
    FORM DATA_RECORDS_WIPE
                      TABLES
                          T_DATA_RECORDS_IN  STRUCTURE EDIDD.
      LOOP AT  T_DATA_RECORDS_IN.
        CLEAR: T_DATA_RECORDS_IN-MANDT,
               T_DATA_RECORDS_IN-DOCNUM,
               T_DATA_RECORDS_IN-SEGNUM,
               T_DATA_RECORDS_IN-PSGNUM,
               T_DATA_RECORDS_IN-HLEVEL.
        modify t_data_records_in.
      ENDLOOP.
    ENDFORM.                               " DATA_RECORDS_WIPE
    This is the code which is clearing all the PSGNUM and HLEVEL values. After coming out of this function module we are getting the error idocs created with disturbed hierarchy.
    I need to create INBOUND Idocs with the data in ABAP program.
    Please let me know if any inputs? Is there any function module existing to create Inbound Idocs inside an ABAP program?
    Regards

  • Is there a way to goto SE38 using a Function module

    Hello Friends,
    I don't have authorisation to SE38 in dev system. But I need it to check something. Is there a way to goto SE38 using a Function module. I know that one of my ABAP friends had done this long back.
    This will be very helpful.
    Thanks
    Simmi

    Hi,
    No need to go for function module also. Just write the below code and execute your program, then it will directly goto SE38:
    call transaction 'SE38'.
    Anyway if the login have no authorization then you cant login.
    Regards,
    Raghu

  • How to use SD_VBAK_ARRAY_READ functional module

    hello
    can you please tell me how to use SD_VBAK_ARRAY_READ  functional module. that means what i have to pass and what i should get.
    Please help me

    Hi Ravi,
    i want to display vkorg,kunnr,and some other fields from the VBAK. User enters VKORG and some other fields but VKORG is compulsory.
    so i written the code like this.
    TYPES :BEGIN OF TEITAB_VBAK,
           VKORG type VBAK-VKORG,
           KUNNR TYPE VBAK-KUNNR,
           VBELN TYPE VBAK-VBELN,
           AUDAT TYPE VBAK-AUDAT,
           VDATU TYPE VBAK-VDATU,
           ERNAM TYPE VBAK-ERNAM,
           END OF TEITAB_VBAK.
    DATA: ITAB_VBAK TYPE TABLE OF TEITAB_VBAK,
          WA_VBAK TYPE TEITAB_VBAK.
    SELECT-OPTIONS: s_VKORG FOR P_VKORG OBLIGATORY,         " Sales Organization
                    s_KUNNR FOR P_KUNNR,         " Sold-to party.
                    s_VBELN FOR P_VBELN,         " Sales Document.
                    s_MATNR FOR P_MATNR,         " Material number.
                    s_AUDAT FOR P_AUDAT,         " Document Date (Date Received/Sent).
                    s_VDATU FOR P_VDATU,         " Requested delivery date.
                    s_ERNAM FOR P_ERNAM,         " Name of Person who Created the Object.
                    s_VKAUS FOR P_VKAUS.         " Usage indicator.
    SELECT VKORG KUNNR VBELN AUDAT VDATU ERNAM
    FROM VBAK
    INTO CORRESPONDING FIELDS OF TABLE ITAB_VBAK
    WHERE VKORG IN S_VKORG AND AUART EQ 'ZRA'.
    CALL FUNCTION 'SD_VBAK_ARRAY_READ'
    EXPORTING
      I_BYPASSING_BUFFER          = ' '
      I_REFRESH_BUFFER            =
      TABLES
        IT_VBAK_KEY                 =
      ET_VBAK                     =
    EXCEPTIONS
      RECORDS_NOT_FOUND           = 1
      RECORDS_NOT_REQUESTED       = 2
      OTHERS                      = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    so i confused where to call this fucntional module and what to pass. That means call this functional module before the select query or after the select query and what to pass.
    i am new in ABAP.
    Please help me to solve this problem .

Maybe you are looking for