Passing parameter in function module

hi friends,
I have created one function module in which i need to pass PO/SO number from standard EKKO/VBAK tables through the select option parameter S_POSONO. Inside the function module I have a select query which fetches the records from a Z-table which has a field called 'REFERENCE' which is 16-char long. Hence the length mismatches with PO/SO no which is 10-char long. the first 10-char from 'REFERENCE' is PO/SO number, next 3-char is line-item num, and the last three char is schedule item num. It is required to match only first 10-char with the parameter passed i.e, S_POSONO and display only those datas.
The function module is as follows.....
Function :
CALL FUNCTION 'YFIIN_RETRIEVE_SOURCE_DATA'
EXPORTING
   LT_RANGE_BUKRS          = S_BUKRS[]
   LT_RANGE_DOCNO          = S_POSONO[]
   LT_RANGE_DOCDATE        = S_DATUM[]
   LT_RANGE_CURRENCY       = S_FCURR[]
  TABLES
    IT_TEMEXPOSU            = LT_TEMEXPOSU
EXCEPTIONS
   INVALID_SELECTION       = 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.
Source code inside function module:
  SELECT * FROM ZFIGL_TEMEXPOSU INTO  TABLE IT_TEMEXPOSU
                                 WHERE   COMPANY_CODE IN LT_RANGE_BUKRS
                                 AND  currency in LT_RANGE_CURRENCY
                                 and  REFERENCE in LT_RANGE_DOCNO
                                 and  doc_date in LT_RANGE_docdate.
IF SY-SUBRC = 0.
SELECT COMPANY_CODE ATTRIBUTE_01 REFERENCE CREATION_DATE FOREIGN_CURR                                                               
           FROM TEMT_RAWEXPOS APPENDING CORRESPONDING FIELDS OF
               TABLE IT_TEMEXPOSU WHERE COMPANY_CODE IN  LT_RANGE_BUKRS
                                 AND REFERENCE in LT_RANGE_DOCNO
                                 AND CREATION_DATE IN  LT_RANGE_DOCDATE
                                 AND FOREIGN_CURR IN LT_RANGE_CURRENCY.
   ENDIF.
Import Parameter of Function Modules :
LT_RANGE_BUKRS   - type - BUKRS
LT_RANGE_DOCNO  - type - EBELN
LT_RANGE_DOCDATE - type - DOKDATS
LT_RANGE_CURRENCY - type - WAERS
please help me to solve this problem..

Hi Ram Tej,
Try this.
First Read all the records without Checking REFERENCE field with LT_RANGE_DOCNO into an internal Tbale.
Then looping at that internal table delete records from the same internal table where REFERENCE(10) <> LT_RANGE_DOCNO.
Hope this may help ur requirement.
Award points if useful.

Similar Messages

  • Fetch data from table(ET_) which is exporting parameter of function module

    Hi,
    I m new to ABAP programming.
    I have to develop a smartform that has to be filled in with fields from few tables.
    These tables have the naming convention ET_<XXX> (i.e. exporting parameter of function module).
    I m not able to directly view its contents in se11 or use select query for it.
    I have a report program which i can execute to view these parameter names.
    Now, how do i fetch data from these parameters/tables and pass it from my driver program to smartform??
    Someone pls guide me...
    Thank You.

    Hi,
    I have done that using Field-Symbols.
    Thanks,
    Preetha

  • Add parameter in Function Module

    hi all,
    I'm trying to add a parameter to function module HRGPBS_HER_GET_SURNAME_NINO.
    However, the system is telling me to carry out modification comparison first.
    Can someone guide me on using SPAU or SE95, as I don't understand what to enter in the selection area?
    thanks

    If you go to transaction code: SPAU, you can find the item (program, function module, screen, etc) in question, open the tree to the lower levels. On the lower item, you can choose to save your changes or revert back to original.
    The developers should be able to tell what has been changed. In most cases, we wanted to keep our changes with the exception of when a change was made and later a note was released to produce the same result or if new functionality is released related to the item in question.
    Hope this helps.

  • Passing values to function module

    Hello Everybody!
         I have defined a function group ZSUB_FGROUP1 and within that, I have defined a function module ZSUB_FMOD1. I wish to pass one set of values of following types:
    VBELN, POSNR, MATNR, ARKTX, KWMENG, VRKME, NETWR   from VBAP
    and  WAERK from VBAK.
    from my main report ZSUB_REP1 to ZSUB_FMOD1, which will then print those values in the form of a list. When I processed the list from within the main report, I used regular methods like top-of-page and all. But, I am not sure how to handle things from within the function module. Please help!

    Hi...
    When u create the function module , we generally provide the import and export parameters....
    <b>Import parameters :</b> Which we pass to the function module ..
    <b>Export parameters:</b> Which we receive from the function module...
    <b>Tables parameters:</b> Tables to pass and to receive to and from the function module...
    <b>Changing Parameters:</b> Which we pass to the function module and change these values in the function module and receive those from function module...
    So define the fields
    VBELN, POSNR, MATNR, ARKTX, KWMENG, VRKME, NETWR ,WAERK in the import parameters with LIKE declaration and corresponding type..
    <b><u>Field  ||  Type  || Associated Type || Optional || Default ||</u></b>
    vbeln  || like  ||  vbak-vbeln ||
    <b>Optional : </b>If u check this then this field is not mandatory to receive the value..
    If uncheck then we have to pass value to this field from the program !! otherwise it gives an error.
    In the <b><u>source code</u></b> tab u can write the list output related code with these imported and exported parameters !!
    To call the function module we use<b> PATTERN </b>which is present on the application tool bar of the SE38-Editor screen..
    Click on this .. u will get a popup ..IN this check the <b>CALL FUNCTION</b> and in the input field of this,, give the function module name... and press enter ...Here u can give values for these imported fields...
    reward if it helps u...
    sai ramesh

  • Checkbox as import parameter in function module

    Hi all,
    how to create a checkbox as import parameter in function module,
    thnx in advance

    ?? Function modules don't have screens...they do have import, export parameters.
    If you look at how "checkboxes" are stored in db tables, you'll see that the previous replies are precisely correct.  A check box is a char1 field...it is on when 'X' (ABAP_TRUE) and off when blank (initial)....you would call your FM with an import field of type char1 set to 'X' or set to space, and handle accordingly in your FM code.
    If you have a checkbox on a selection screen, then the value of that parameter is either 'X' or space, depending upon whether or not the user checked the box.

  • Passing Select-options as parameter to function module

    I need to pass a select-option as a parameter to a function module. Is this possible?
    There is an option of passing all the values of the select-option to an internal table, passing that internal table as parameter to the function module, and then adding it manually again to a select-option in the function module.
    But is there any direct way to do this?

    Hi,
    I have a similar problem: I have RFC function module to which I want to pass select options. Therefore I defined table parameters as follows:
    IT_RUNID     TYPE     EFG_TAB_RANGES
    IT_PERNR      TYPE     EFG_TAB_RANGES
    IT_REINR     TYPE     EFG_TAB_RANGES
    I can successfully pass my values to the module, but if I try to check these parameters
    using
    CHECK IT_TRIPS-RUNID IN IT_RUNID.
        CHECK IT_TRIPS-PERNR IN IT_PERNR.
        CHECK IT_TRIPS-REINR IN IT_REINR.
    the check always fails, I guess because there are leading zeros in the ranges. Is there a way to solve this problem?
    Thanks and regards,
    Martin

  • Passing selection table as parameter to function modules

    i tried to pass a selection table as a parameter to a function module but there is a problem stating the eror the table length is different.
    *& Report  ZSFSELECT_OPTIONS_PGM
    REPORT  zsfselect_options_pgm.
    TABLES zselect_options.
    SELECT-OPTIONS sop FOR zselect_options-id.
    DATA  : fname(15) TYPE c.
    *CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
       formname                 = fname
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
      FM_NAME                  =
    EXCEPTIONS
      NO_FORM                  = 1
      NO_FUNCTION_MODULE       = 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.
    DATA lth(2) TYPE c.
    DATA ty TYPE i.
    DATA o TYPE i.
    DATA l TYPE i.
    DATA k TYPE c.
    DESCRIBE FIELD sop-sign TYPE lth LENGTH ty IN CHARACTER MODE.
    CALL FUNCTION fname
    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
        sf_sop                     =sop
    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.
    in the smart form i have tried to pass the sp as the table.
    i have created a program line node
    :SELECT * FROM zselect_options INTO TABLE it_tab WHERE id IN sf_sop.

    Hi,
    If i understand ur problem correctly u r trying to pass a select-option to Tables for a smartform function module. It gives an error & it correct.
    If u understand the structure of a select option, it will have 4 fields in it & the structure will be
    SIGN                   CHAR1
    OPTION               CHAR2
    LOW                   Type Zfield
    HIGH                   Type Zfield
    But ur receiving Table paramter of the smnartform FM will be having only 1 field - Type Zfield
    So this mismatch gives u an error.
    Solution:
    Case1:
    Write code outsied th FM in ur program to get all the values & build an internal table & pass that to the FM.
    Case2:
    Define the Structure of table in the smartforms as tols earlier & then try passsig the Select option.
    Thanks & Regards,
    Bhargava

  • (internal) Tables obsolete as parameter in function modules,

    Hi
    As you probably can see by the question, my ABAP Knowledge isn't exactly overwhelming !
    <i>anyway:</i>
    I'm trying to create a function module in NW2004s, This functionmodule should take an internal table, based on a structure as (import) parameter.
    In the earlier version, I've done this by defining it under the TAB 'Tables' in the function builder - But know its telling me that "<i>Tables Parameters are obsolete</i>", and that I should define it under "Changing" instead.
    I have tried that, but I'm only allowed to pass a single line, and if I try to do a Loop, in the function module, it tells me that ity isn't created as an internal table.
    So please - what is the "best practice" here ?
    Regards
    Morten Nielsen

    Hi All,
    I followed Steps 1 and 2 but when I use the following select statement I get a dump with the error enclosed.
    Step1. Created a structure ZDFKKCOHI which is a replica of DFKKCOHI.
    Step2. Created a table type ZDFKKCOHITABLE with line type as ZDFKKCOHI.
    Step3. In my function module I have a changing parameter ZDFKKCOHIPARAM of type ZDFKKCOHITABLE.
    Step 4. When I use the following select clause I am getting a dump.
    DATA: wa_zdfkkcohi LIKE LINE OF zdfkkcohiparam.
      SELECT *
      FROM dfkkcohi
      INTO  CORRESPONDING FIELDS OF TABLE zdfkkcohiparam
      WHERE cotyp EQ zcotyp
      AND gpart EQ zgpart
      AND corr_status EQ zcorr_status.
      LOOP AT zdfkkcohiparam INTO wa_zdfkkcohi.
    *Move IT_ZDFKKCOHI to ZDFKKCOHIOUT.
    *Append ZDFKKCOHIOUT.
    *Clear IT_ZDFKKCOHI.
      ENDLOOP.
    What could be wrong?
    Thanks for all your help in advance.
    Regards,
    Divya

  • How to pass parameters to function module

    Hello,
    Can someone suggest how to pass parameter values to BAPI function module from a .NET client? I am using the BAPI_PO_GETDETAILS module and want to pass required parameters to get the item details. Also, please let me know which table should I refer to when retrieving the result. I am using sap .net connector 3.0.
    Thanks in advance

    Hi unosino,
    at http://www.se80.co.uk/sapfms/b/bapi/bapi_po_getdetail.htm you can see, that you have to pass po_header and po_address to the function.
    You can do that with the nco3 like this:
    IRfcFunction rfcFunction = destination.Repository.CreateFunction("BAPI_PO_GETDETAILS");
    rfcFunction.SetValue("po_header", /* your value */);
    rfcFunction.SetValue("po_address", /* your value */);
    rfcFunction.Invoke(destination);
    kind regards
    christian
    Edited by: chrislind on Nov 11, 2011 2:47 PM

  • Probelem with passing parameters to function module

    hey i am facing a problem to pass the parameters to function module.let me explain.. we cant pass the parameters which we are using in the select option statements directly to a function module called...i just wanna know if there is any way so that i can pass those values to a fnc module while passing it from select options

    Hi,
    You have to create a table type in SE11..
    Check this sample table type PDSMAINT_MATNR_RNG_T...
    Then use that table type in the importing parameter of FM..
    PT_MATNR TYPE PDSMAINT_MATNR_RNG_T..
    For which field you have created select-options..I will check if there is any existing table type in se11..
    Thanks,
    Naren

  • How to pass parameters into Function module : CLOI_PUT_SIGN_IN_FRONT

    Hello friends,
    I am displaying values ie, amounts in the screen using write statements here i have to display the
    sign left side , i am using  Function module   'CLOI_PUT_SIGN_IN_FRONT'    
    Does anybody help me - How to pass paramter into this Function module.
    Regards,
    Phaneendra

    If you look to the code of the function module, you can see it is condensing the value.
    I would make a copy of this function, and remove the condense lines to give the result you want.
      data: text1(1) type c.
      search value for '-'.
      if sy-subrc = 0 and sy-fdpos <> 0.
        split value at '-' into value text1.
        condense value.
        concatenate '-' value into value.
      else.
        condense value.
      endif.

  • Populating the output parameter in function module.

    Hi Experts,
       I have written a function module,with material number,BEZEI as input and mvgr2 as output from table tvm2t.I am facing a problem in populating the material number as well in outputtable.The material number in input is nothing to do with output.
    please help me at the earliest.
    Regards,
    Sridevi.

    Hmmm, you wrote that the output is 'table parameter' but you mention 2 single fields. If you expect a good reply here, it helps to mention how you defined the table and how you select the data for the output. For example: input is matnr and you select the material group of this matnr. Output is all other matnr of this material group. Then we would know what you want to do here.
    So please describe what you need and give us the table description.
    Regards
    Nicola

  • What are minimum passing parameters for function module CS_BOM_EXPL_MAT_V2

    Hi
    Im going to use FM: CS_BOM_EXPL_MAT_V2 and I want to only pass WERKS, but when I execute FM is gives exception as CALL_INVALID.
    I saw all the Import parameters are Optional, but I think I need to pass more inputs to FM.
    Please let me know what are MINIMUM input parameters required to run this FM
    Thanks

    Hi
    In my requirement, there are range of WERKS and MATNR which has to be given from selection screen, where as In CS_BOM_EXPL_MAT_V2 function module I can only give single value for WERKS and MATNR.
    Can any one guide me how can I implement this?

  • Passing parameter to Function in select clause BIP 11g

    Hi,
    I am developing a dataset where i ahave to pass Parameter to a function which retrives the cursor in BIP 11g
    below is the SQL:
    select cizcompfn(:P_USER_ID) COMPANY_INFO,
    cizinstfn(:P_REPORT_CD, :P_USER_ID) CURRENCY_INFO,
    sysdate AS PRINT_DATE_TIME_INFO,
    cizlballfn(:P_REPORT_CD, :P_USER_ID) LABEL_INFO,
    cipacsvpfn(:P_USER_ID, to_char(:P_FROM_DT,'yyyy-MM-dd') ,
    to_char(:P_TO_DT, 'yyyy-MM-dd')) RETURN_CODE_INFO, rpt_option_val SERVER
    FROM ci_rpt_option where rpt_opt_flg = 'RPSV'
    I have created the 4 parameters :P_USER_ID, :P_REPORT_CD , :P_FROM_DT and :P_TO_DT
    I am not getting the result generated.
    If develop the dataset in BIP 10g, this working fine.
    Please, let me know what needs to changed so that it works in BIP11g.
    Regards,
    Hemanth

    I am getting the result like this:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <!-- Generated by Oracle BI Publisher 11.1.1.5.0
    -->
    - <DATA_DS>
    <P_TO_DT>2010-01-01T00:00:00.000-05:00</P_TO_DT>
    <P_FROM_DT>2000-01-01T00:00:00.000-05:00</P_FROM_DT>
    <P_REPORT_CD>CI_ACSVPR</P_REPORT_CD>
    <P_USER_ID>CDX</P_USER_ID>
    - <G_1>
    <PRINT_DATE_TIME_INFO>2012-05-11T07:22:57.000-04:00</PRINT_DATE_TIME_INFO>
    <SERVER>http://server-name:port-number</SERVER>
    </G_1>
    </DATA_DS>
    Value for two columns:
    sysdate AS PRINT_DATE_TIME_INFO
    rpt_option_val SERVER
    which are straight forward columns.
    When i pass hardcoded values instaed of parameters I get the XML:
    Below is the SQL:
    select cizcompfn('CDX') COMPANY_INFO, cizinstfn('CI_ACSVPR', 'CDX') CURRENCY_INFO, sysdate AS PRINT_DATE_TIME_INFO,
    cizlballfn('CI_ACSVPR', 'CDX') LABEL_INFO,
    cipacsvpfn('cdx', to_char('05-may-1900') ,to_char( '05-may-2012')) RETURN_CODE_INFO,
    rpt_option_val SERVER from ci_rpt_option where rpt_opt_flg = 'RPSV'
    Edited by: 931007 on May 11, 2012 7:29 AM

  • Import parameter in Function Module for user exit

    Hi Experts,
    I need to send IDOC when PO release, for that i found an Exit M06E0004. It is having
    FUNCTION EXIT_SAPLEBND_002.
    ""Lokale Schnittstelle:
    *"  IMPORTING
    *"     VALUE(I_CEKKO) LIKE  CEKKO STRUCTURE  CEKKO  " EKKO table
    *"     VALUE(IT_BEKPO) TYPE  MMPUR_BEKPO OPTIONAL  " EKPO table
    *"     VALUE(IT_BEKET) TYPE  MMPUR_BEKET OPTIONAL    " EKEt table
    *"     VALUE(IT_EKKNU) TYPE  MMPUR_EKKNU OPTIONAL  
    *"  EXPORTING
    *"     VALUE(E_CEKKO) LIKE  CEKKO STRUCTURE  CEKKO
      INCLUDE ZXM06U22.
    ENDFUNCTION.
    All of the fields i have to take in IDOC segment r from EKKO and EKPO table, but 1 field is from MDSB table (MDSB-MATNR), how can i take it in the code i have to write. can i take TABLE: MDSB in the include, or any other way. because its standard FM we cant take it in IMPORT.
    Regards,
    Nik

    Hello Nik
    You can use a similar approach as described in thread:
    Get Parameter from Standard Transaction to BADi
    You need to find out in which main program MDSB is defined. Then you can try to access this field dynamically from within your exit.
    Alternatively, you have to search for a function module which can retrieve this (runtime) information (MDSB-MATNR).
    Regards
      Uwe

Maybe you are looking for

  • Running a java service on linux (Redhat)

    I can create a basic script to run my java service, I can stop, and restart it from the command line when logged in. I have installed the script as a service. However, when I reboot, the service will not start. I have set it to be the very last thing

  • How do I eject a DVD that won't appear on my desktop?

    I tried to read a DVD furnished to me but when I loaded it into the computer it won't appear on the desktop. How do I get it to eject?

  • HAPPY BIRTHDAY FCP X !

    Two years ago today, FCP X became available to download and the eager general public could get their hands on it. Much of the general public was not too impressed when they fired it up and Apple found itself being lampooned by the press and TV for  s

  • Problem in forms deployment

    after the splatch screen i have this error message MessageManager:Key confail bundle oracle.forms.RunformBundle exception java.lang.illegalargumentException unknown format type at ... thanks

  • Table with n foreign key vs n tables or n foreign key vs 1 table?

    Hi, we have a scenario with n tables containing some attributes one table for one category of attribute (es: color, role, type, etc..) of a principal entity and 1 table for the principal entity with n foreign keys vs every attribute table. Some propo