Assign value to field of table before calling function module

hi,
FM 'ABC' have some TABLES parameters.
Before calling a function module 'ABC',i want to assign a value to one of the fields of the TABLES parameter.
TAB1 is a name of parameter and field FLD1 is a name of the field of TAB1 which i want to update before calling 'ABC'.
Thank you in advance.

hi,
1. store value in workarea
tab1-fld1 = 'value'.
2. append/modify the entry in tab1.
append tab1.
or
modify tab1
3. call your function module

Similar Messages

  • Interrogating field data in a called Function Module

    Good day to all;
    I'd like to call a function module within my program and interrogate one of its fields once it is complete.  The field itself is not returned through the function module's interface, so in stead of trying to rewrite the thing, I'm wondering if I can just request it?
    I've ran a search on this and noted that someone said it may be possible to assign a field symbol to a program's variable, but that in order to actually gain access your program must be on the same calling stack.

    Hi,
    i think you mean the "dirty assign"
    Re: How to access global variable declaraed in the separate program?
    A.
    Message was edited by: Andreas Mann

  • Displaying table using call function 'REUSE_ALV_GRID_DISPLAY'

    I have created a table which has product code, product description, and product level.  I am trying to display it using REUSE_ALV_GRID_DISPLAY.  When I Check it, I get the following error message: "PVS2" is not an internal table - the "Occurs n" specification is missing.
    Is it possible to copy PVS2 into another table, and then display that table using REUSE_ALV_GRID_DISPLAY?
    I have patched together code from sdn, a client program, and my own code and I am starting to get confused.  So, please help me.
    Regards,
    Al Lal
    REPORT  YABHINAV16.
    * program to display products at chosen level *
    Tables: T179, T179t.
    types:  begin of hierarchy,
            prodh type t179-prodh,
            vtext type t179t-vtext,
            stufe type t179-stufe,
            end of hierarchy.
    types: begin of text,
    prodh type t179t-prodh,
    vtext type t179t-vtext,
    end of text.
    data: pvs type standard table of hierarchy initial size 0.
    data: pvs2 type hierarchy.
    data: it_text type standard table of text,
    wa_text type text.
    TYPE-POOLS:SLIS.
    *For ALV
    DATA: GT_FLD TYPE SLIS_T_FIELDCAT_ALV,
          GT_EV TYPE SLIS_T_EVENT,
          GT_HDR TYPE SLIS_T_LISTHEADER,
          GT_SORT TYPE SLIS_T_SORTINFO_ALV.
    DATA: WA_FLD TYPE SLIS_FIELDCAT_ALV,
          WA_EV TYPE SLIS_ALV_EVENT,
          WA_HDR TYPE SLIS_LISTHEADER,
          WA_SORT TYPE SLIS_SORTINFO_ALV,
          WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DEFINE FLD.
      WA_FLD-FIELDNAME   = &1.
      WA_FLD-TABNAME     = &2.
      WA_FLD-OUTPUTLEN   = &3.
      WA_FLD-SELTEXT_L   = &4.
      WA_FLD-SELTEXT_M   = &5.
      WA_FLD-SELTEXT_S   = &6.
      WA_FLD-COL_POS     = &7.
      WA_FLD-FIX_COLUMN  = &8.
      WA_FLD-DO_SUM      = &9.
      APPEND WA_FLD TO GT_FLD.
      CLEAR WA_FLD.
    END-OF-DEFINITION.
    CONSTANTS: C_TOP TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
               C_USER_COMMAND            TYPE  SLIS_FORMNAME  VALUE 'USER_COMMAND'.
    DATA: MTRL LIKE SY-REPID,
          TITLE LIKE SY-TITLE.
    select-options level for t179-stufe no intervals.
    start-of-selection.
    Select prodh stufe from T179 into corresponding fields of table pvs where stufe in level.
    select prodh vtext from t179t into corresponding fields of table it_text for all entries in pvs where prodh = pvs-prodh.
    end-of-selection.
    sort pvs by prodh.
    sort it_text by prodh.
    loop at pvs into pvs2.
      read table it_text into wa_text with key prodh = pvs2-prodh.
      if sy-subrc eq 0.
        pvs2-vtext = wa_text-vtext.
        write: / pvs2-prodh, pvs2-vtext, pvs2-stufe.
      endif.
    *  modify pvs2.
    endloop.
    perform BUILD_FIELDCAT.
    perform GRID_DISPLAY.
    form BUILD_FIELDCAT .
        FLD 'PRODH'   'PVS2'   '20'     'Product Hierarchy'        ' ' ' '  '1'  ''   '' .
        FLD 'VTEXT'   'PVS2'   '40'     'Description '        ' ' ' '  '3'  ''   '' .
        FLD 'STUFE'   'PVS2'    '5'    'Level'        ' ' ' '  '2'  ''   '' .
    endform.                    " BUILD_FIELDCAT
    form GRID_DISPLAY .
      call function 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM      = MTRL
          I_CALLBACK_USER_COMMAND = 'C_USER_COMMAND'
          I_CALLBACK_TOP_OF_PAGE  = C_TOP
          I_STRUCTURE_NAME        = 'PVS2'
          IS_LAYOUT               = WA_LAYOUT
          IT_FIELDCAT             = GT_FLD
          IT_SORT                 = GT_SORT
          I_DEFAULT               = 'X'
          I_SAVE                  = 'U'
          IT_EVENTS               = GT_EV
        TABLES
          T_OUTTAB                = PVS2[]
        EXCEPTIONS
          PROGRAM_ERROR           = 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.                    " GRID_DISPLAY

    TYPE-POOLS : SLIS.
    DATA : BEGIN OF WA_T001,
                 BUKRS LIKE T001-BUKRS,
                 BUTXT LIKE T001-BUTXT,
                 ORT01 LIKE T001-ORT01,
                 END OF WA_T001,
                 IT_T001 LIKE TABLE OF WA_T001.
    DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
                WA_FCAT LIKE LINE OF IT_FCAT.
    DATA : V_NAME LIKE  SY-REPID.
    SELECT BUKRS BUTXT ORT01 FROM T001 INTO TABLE IT_T001 UP TO 15 ROWS. V_NAME = SY-REPID.
    CALL FUCTION MODULE 'REUSE_ALV_FIELDCATLOG_MERGE. EXPORTING  I_CALBACK_PROGRAM =
    V_NAME I_INTERAL_TABNAME = 'WA_T001' I_INCLNAME = V_NAME CHANGING CT_FIELDCAT =
    IT_FCAT.
    CALL FUNCTION MODULE "REUSE_ALV_GRID_DISPLAY"
    EXPORTING
    I_CALLBACK_PROGRAM = V_NAME
    IT_FCAT = IT_FCAT.
    TABLES
         T_OUTTAB  = IT_T001
    SY-REPID IS THE SYSTEM VARIABLE WHICH IS HAVING THE ABAP PROGRAM 
    OR CURRENT MAIN PROGRAM.
    ----- Sample Progam -
    ***INCLUDE YRVR058_DEST_WISE_SUMMARY_DF01 .
    *&      Form  DISPLAY_DATA
          text      *-- Rajesh Vasudeva
    -->  p1        text
    <--  p2        text
    FORM DISPLAY_DATA .
      IF ITAB[] IS NOT  INITIAL.
        PERFORM F_APPEND_BLOCK.
      ELSE.
        MESSAGE 'Data not found for the selection
    criteria' TYPE 'S'.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " display_data
    *&      Form  f_append_block
          text
    -->  p1        text
    <--  p2        text
    FORM F_APPEND_BLOCK .
      DATA : L_WA_SORT    TYPE SLIS_SORTINFO_ALV,   "For
    sort
             L_WA_EVENTS  TYPE SLIS_ALV_EVENT.      "For
    events
    Event (Top of List)
      CLEAR L_WA_EVENTS.
      L_WA_EVENTS-NAME = SLIS_EV_TOP_OF_LIST.
      L_WA_EVENTS-FORM = C_TOPOFPAGE.
      APPEND L_WA_EVENTS TO I_EVENTS_PART.
    Event (Top of Page)
      CLEAR L_WA_EVENTS.
      L_WA_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
      L_WA_EVENTS-FORM = 'F_DISPLAY_HEADER_PARTA'(031).
      "f_display_header_part
      APPEND L_WA_EVENTS TO I_EVENTS_PART.
    Event (End of List)
      CLEAR L_WA_EVENTS.
      L_WA_EVENTS-NAME = SLIS_EV_END_OF_LIST.
      L_WA_EVENTS-FORM = C_END_OF_LIST.
      APPEND L_WA_EVENTS TO I_EVENTS_PART.
    Set Layout Zebra
      STRUCT_LAYOUT-ZEBRA          = 'X'.
      STRUCT_LAYOUT-NUMC_SUM       = 'X'.
      STRUCT_LAYOUT-TOTALS_TEXT    = 'TOTAL:'(032).
    set field catalog
      PERFORM F_FIELD_CATALOG_PART.
      ASSIGN ITAB[] TO <F_OUTTAB>.
      V_PART = 'A'.  "initiating list is A
      PERFORM F_DISPLAY_BLOCK USING STRUCT_LAYOUT
                                   I_FIELD_CAT_PART[]
                                   C_TAB
                                   I_EVENTS_PART[]
                                   I_SORT_PART[].
    ENDFORM.                    " f_append_block
    *&      Form  f_field_catalog_part
          text
    -->  p1        text
    <--  p2        text
    FORM F_FIELD_CATALOG_PART .
      REFRESH I_FIELD_CAT_PART.
      CLEAR I_FIELD_CAT_PART.
      PERFORM F_CREATE_CATALOG USING :
    *Month
    C_TAB 'MONTH'  'MONTH'      SPACE 'L' 7
    I_FIELD_CAT_PART[],
    *OBD
    *C_TAB 'VBELN'  'Delivery'      SPACE 'L' 12
    I_FIELD_CAT_PART[],
    *DATE
    C_TAB 'WADAT_IST'  'Date'      SPACE 'L' 10
    I_FIELD_CAT_PART[],
    *Destination
    C_TAB 'CITY1'  'Destination'      SPACE 'L' 25
    I_FIELD_CAT_PART[],
    *Qty By Road
    C_TAB 'NTGEW_ROAD'  'Road Quantity'   SPACE 'R' 16
    I_FIELD_CAT_PART[],
    *Rail Qty
    C_TAB 'NTGEW_RAIL'  'Rail Quantity'  SPACE 'R' 16 I_FIELD_CAT_PART[],
    *Total  Qty C_TAB 'TOT'  'Total Quantity'  SPACE 'R' 16 I_FIELD_CAT_PART[], *RR/Trk No.
      C_TAB 'EXTI2'  'Truck/RR No.' SPACE 'L' 17 I_FIELD_CAT_PART[].
    ENDFORM.                    " f_field_catalog_part
    *&      Form  f_DISPLAY_block
          text
         -->P_STRUCT_LAYOUT  text
         -->P_I_FIELD_CAT_PART[]  text
         -->P_C_TAB  text
         -->P_I_EVENTS_PART[]  text
         -->P_I_SORT_PART[]  text
    FORM F_DISPLAY_BLOCK  USING  FP_LAYOUT         TYPE
    SLIS_LAYOUT_ALV
                                 FP_I_FCAT         TYPE
    SLIS_T_FIELDCAT_ALV
                                 VALUE(FP_TABNAME) TYPE
    ANY
                                 FP_I_EVENTS       TYPE
    SLIS_T_EVENT
                                 FP_I_SORT         TYPE
    SLIS_T_SORTINFO_ALV.
      DATA: V_REPID  TYPE SYREPID,                 
    "current Program id
            C_SAVE       TYPE CHAR1 VALUE 'A'.     
    "variant save
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    *CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = V_REPID
          IS_LAYOUT          = FP_LAYOUT
          IT_FIELDCAT        = FP_I_FCAT[]
          IT_SORT            = FP_I_SORT[]
          I_SAVE             = C_SAVE             "variant
    save
          IT_EVENTS          = FP_I_EVENTS[]
        TABLES
          T_OUTTAB           = <F_OUTTAB>
        EXCEPTIONS
          PROGRAM_ERROR      = 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_DISPLAY_block
    *&      Form  f_create_catalog
          text
         -->P_C_TAB  text
         -->P_0085   text
         -->P_0086   text
         -->P_SPACE  text
         -->P_0088   text
         -->P_5      text
         -->P_I_FIELD_CAT_PART[]  text
    FORM F_CREATE_CATALOG  USING  FP_I_TABNAME   TYPE
    SLIS_TABNAME
                                  FP_I_FIELDNAME TYPE SLIS_FIELDNAME
                                  FP_I_SELTEXT   TYPE
    SCRTEXT_L
                                  FP_I_DOSUM     TYPE
    CHAR1
                                  FP_I_JUST      TYPE C
                                  FP_I_OUTPUTLEN TYPE
    OUTPUTLEN
                                  FP_I_FCAT      TYPE
    SLIS_T_FIELDCAT_ALV.
    Record for field catalog
      DATA: L_REC_FCAT TYPE SLIS_FIELDCAT_ALV.
      L_REC_FCAT-TABNAME   = FP_I_TABNAME.
      L_REC_FCAT-FIELDNAME = FP_I_FIELDNAME.
      L_REC_FCAT-SELTEXT_L = FP_I_SELTEXT.
      L_REC_FCAT-DO_SUM    = 'X'.
    *l_rec_fcat-do_sum    = ' '.
      L_REC_FCAT-JUST      = FP_I_JUST.
      L_REC_FCAT-OUTPUTLEN = FP_I_OUTPUTLEN.
      L_REC_FCAT-DECIMALS_OUT = '2'.
      L_REC_FCAT-KEY          = '1'.
      APPEND L_REC_FCAT TO FP_I_FCAT.
    ENDFORM.                    " f_create_catalog
         Subroutines for Headings
    *&      Form  f_display_header_partA
          Display header for report for Part A
    *&      Form  top_of_page
          text
    -->  p1        text
    <--  p2        text
    FORM TOP_OF_PAGE .
      SKIP 1.
      WRITE:/25 ' Name of Company ',80 'RUN DATE' ,
    SY-DATUM.
    SKIP 1.
    WRITE:/60 'RUN DATE' , SY-DATUM.
      SKIP 1.
      DATA: YR(4) TYPE N,
             FIN_PRD(10) TYPE C.
      IF S_DTABF-LOW+4(2) LT '04'.
        YR = S_DTABF-LOW+0(4) - 1.
        CONCATENATE YR '-' S_DTABF-LOW+2(2) INTO FIN_PRD.
      ELSE.
        YR = S_DTABF-LOW+0(4) + 1.
        CONCATENATE S_DTABF-LOW0(4) '-' YR2(2) INTO
    FIN_PRD.
      ENDIF.
      WRITE:/5 'DETAILS OF THE MONTH/DATE WISE DESPATCHES
    MADE BY ROAD/RAIL DURING THE YEAR ' , FIN_PRD  .
      SKIP 1.
    WRITE :/ 'SALES OFFICE : ' , P_SALES,' ' , RNAME.
    SKIP 1.
    ENDFORM.                    " DISPLAY_DATA
    Award Points If Useful...

  • Third party system call function module/BAPI through RFC to update Z table

    Dear Friends,
    We have a third party system which directly inserts a Z table in SAP through its programming, which is an auditing issue.
    We want the third party system should call function module/BAPI through RFC so that the Z table gets updated.
    waiting for inputs..
    Thanks,
    Kumar

    if third party system is capable of making Remote Function call, then writing a Function module & making it remote enable is not difficult task in ABAP.
    You may have to prepare specifications first to decide if third party system is going to Read, insert, update, delete records from Zee table.

  • BTE Name in Called Function Module

    Hello,
    A function module say XYZ is called from a BTE. Can I know the name of the BTE which called the function module XYZ inside the function module XYZ ?
    With Regards,
    Avisesh.

    I think this document may help you...
    <b>Business Transaction Events</b>
    This activity describes how you can connect additional components (such as in the form of function modules developed yourself or a product from an external software provider) to the standard R/3 System.
    There are two types of interface available in the General Ledger
    Accounting (FI-GL), Accounts Receivable and Accounts Payable
    (FI-AR/FI-AP), and Sales and Distribution (SD) components for this:
    1. Publish & Subscribe interfaces (also called "informing interfaces" in the following) These should inform you about particular events (such as a document being entered) in the SAP standard application and make the data generated as a result available to the external software. The external software does not return any data to the standard R/3 System.
    (I'm confused. MIT is using two business transaction events for the SD to FI interface. Both of these events are Publish & Subscribe interfaces. They both return data to the SAP standard application! They both change the FI document before it is posted. What I've figured out is that if there is an export to memory and an import from memory before and after the function call, then we can't modify the data. We can check this in the calling function module - OUTBOUND_CALL_00503110_E or OPEN_FI_PERFORM_00001020_E, etc)
    Examples of such events in the R/3 System are:
    Master record was created, changed, or blocked
    Document was entered, parked, changed, or reversed
    Items were cleared or reset
    Additional processing can be caused in the additional component on the basis of these events and data:
    Starting a workflow
    Generating or changing additional data
    Requesting correspondence
    FI Clearing (F-32) calls (gathered via SE30):
    Function OPEN_FI_PERFORM_00001020_E (can't modify data)
    00001020 POST DOCUMENT:       Prior to final checks
    EVENT
    This Event is reached prior to completing the document. The checks that are carried out at this point include checking, prior to posting, that the document balances to zero, and calculations for tax offsetting. This Event is accessed once per standard posting process and is similar to validation at document level (Event 0003). A document number has not yet
    been assigned when this Event is reached.
    INTERFACE
    All document line items created and the document header data are
    transferred (both as tables).
    Parameter
    T_BSEG
    T_BKPF
    Function OPEN_FI_PERFORM_00001025_E (can't modify data)
    00001025 POST DOCUMENT:       Final checks completed
    EVENT
    This Event lies following all checks on the whole document, but prior to number assignment. Following this Event, no further error messages may be sent. The document is complete at this point, and no further changes can be made to it prior to posting.
    INTERFACE
    All current data, all document data relevant for the posting, and various control parameters are transferred to the additional component. At this point you can still implement your own checks on the current document data.
    Parameter
    I_BKDF
    T_AUSZ1
    T_AUSZ2
    T_AUSZ3
    T_BKP1
    T_BKPF
    T_BSEC
    T_BSED
    T_BSEG
    T_BSET
    T_BSEU
    Function OPEN_FI_PERFORM_00001030_E (can't modify data)
    Function OPEN_FI_PERFORM_00001140_E (can't modify data)
    2. Process interfaces (also referred to as "process" in the following) Process interfaces are used to submit business processes to a different control which cannot be realized with the standard system, that is process interfaces replace standard processes. Here you can structure determination of individual field contents or of specific reactions to process flows individually. It is possible to connect different external developments to the standard R/3 System. The additional developments are generally carried out using the ABAP/4 Development Workbench. This way you can, for example, influence the control of payment transactions. Selection of payment method, house bank and partner bank can be made using the payment data (currency, amount, and payee) according to a selection logic which you have defined.
    FI Clearing (F-32) calls:
    Function OPEN_FI_PERFORM_00001120_P
    Function OPEN_FI_PERFORM_00001130_P
    Function OPEN_FI_PERFORM_00001150_P
    Function OPEN_FI_PERFORM_00001170_P
    Standard Settings
    Sample modules are delivered in the standard R/3 System which you can
    copy into your name range and fill them with statements there.
    Activities
    1. Enter a product using "Settings -> Customer's products". Actually, in 4.6C, from transaction FIBF (IMG -> Financial Accounting -> Financial Accounting Global
    Settings -> Business Transaction Events):
    Settings -> Products -> ...of a customer
    There are generally a large number of function modules belonging to a product which can be called by different program events from within the standard R/3 System. A product can also be an external software component. If the product is in an external system, enter an RFC destination here. If the product is in the same system, you do not have to enter anything. Important: Do not forget to activate the product after making the following settings.
    2. Establish the interfaces with which the R/3 System provides you. To do this, choose
    Environment -> Info system (P/S)
    or
    Environment -> Info system (Processes).
    Execute the program. You should enter "A" as the
    attribute type. You see the respective interfaces with which the R/3 System provides you. Note the key of the interface which you require.
    You can also select:
    By particular SAP application components
    By particular events by entering intervals
    Which interfaces are used in activated products
    Which interfaces are used within a particular country version or within a particular industry
    Which interfaces are used within a particular customer product
    3. Enter the function module which you have developed yourself. To do this, choose either Goto -> Edit modules within the info system or Settings -> P/S modules or Process modules -> Customer's in the "SAP Business Framework" menu. Make the following entries:
    Key for the interface
    The product that you want to use
    Function module which belongs to this product.
    You can also enter several function modules for a product. Caution:
    The function module must be within your name range, that is must begin with the letter Z. You leave the Ctr and Appl. fields blank unless you want a particular country version or a particular SAP industry-specific component to be enhanced or replaced instead of the standard process flow.
    4. Fill the source text of your function module
    and activate it. To do this, go again via Environment -> Info system (P/S) or Environment -> Info system (Processes) into the information system and execute the program. Then proceed as follows:
    Click twice on the interface you have chosen. If you want, you can look at the interface at this point by choosing Goto -> Interface. Then choose the Back function again afterwards.
    Place the cursor on the relevant line and choose Goto -> Function library. You see the sample function module delivered by SAP.
    Copy the sample module delivered by SAP and call it the same as the function module entered in step 3.
    Fill the source text of the empty function module.
    Activate the function module.
    Activate the product as described in step 1.
    5. Run the R/3 program affected and test whether calling your function module works.
    Further Notes
    The other menu paths are only used for information about additional components delivered by SAP or about software already installed by external software providers.

  • How to call Function Module in Selection Screen

    Hi All,
    I have developed one HR Report (Qualification Overview Report: To display all active employees and their Qualifications along with their Proficiency).
    Already it has 3 selection fields on selection screen and now I want one more field on selection screen like Qualification Id.
    But when the end user press F4 it should display the Popup which comes in TCode: PA30 at the time of Creating Qualification.
    I have debugged the Standard Code and searched the Function Module: 'RH_OBJID_REQUEST' which shows Popup which I wanted to show at Selection screen for newly added field.
    So I have to define new field like 'Qualification Id' and want to attach above Function Module so that it will cater my requirement.
    If anybody has worked on this type of requirement then please let me know.
    Thanks,
    Jay.

    Hi Raymond,
    I have written following code:
    s_quali is used in selection screen for Qualification Id.
    SELECT-OPTIONS :  s_quali   FOR hrp1000-objid NO INTERVALS.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_quali-low.
      CALL FUNCTION 'RH_OBJID_REQUEST'
        EXPORTING
          plvar           = '01'
          otype           = 'Q'
          seark           = '*'
          seark_begda     = '18000101'
          seark_endda     = '99991231'
          set_mode        = 'X'
        TABLES
          sel_objects     = git_objects.
      LOOP AT git_objects INTO wa_objects.         " Logic is to fill up the Selection screen field
        s_quali-low = wa_objects-objid.
        APPEND s_quali TO s_quali.
        CLEAR : s_quali, wa_objects.
      ENDLOOP.
    Now problem is that, its not populating all values in selection screen which I select from Popup screen (Choose Qualification).
    I checked that the first value in the internal Table is over written by second records in the internal table
    For e.g.: If I select 001,002,003,004 from Popup screen then I am able to see only 002,003,004 in the Multiple selection view of that field though it is available in the internal table s_quali (because I am filling up the table using Loop-Endloop)
    Please advise me how to overcome this issue. (How to fill up selection screen)
    Thanks,
    Jay.

  • Add entries to database tables using update function module

    Hi All,
    I have a small requirement, in which I need to update Z-tables usimg update function module in update task. In the calling program, I have gathered the data in a field symbol value of type any. I need to pass the same to that function module to update the data which is in the field symbol.
    Please guide me how to achieve this technically.
    Thanks in advance,
    Pradipta .

    Hi,
    I believe you already have evrything with you.....Start Coding the same and come back with any Coding issue.
    I believe you will not be able to pass the Field Symbol in FM Interface.....You need to pass the Variable which Field Symbol is referring....

  • Can we call function module in sap script

    hi
    can we call function module in sap script
    i want to use function module HR_TMW_GET_EMPLOYEE_NAME in sapscript
    to get Empname by using personal no
    pernr no is coming from bseg-pernr table
    so how i can use it .
    please help me
    thanks in advanced.

    hi,
    You can use like this:
    PERFORM FUNCTION_MODULE IN PROGRAM SUBROUTINE_POOL
    USING &FIELD1&
    USING &FIELD2&
    CHANGING &FIELD3&
    ENDPERFORM.
    where function_module is the func. module name defined in program SUBROUTINE_POOL , field1 n field2 are the fields to be passed, and field3 is the value which you want to display...
    You have to read field1 & field2 in the pool, process them & get the value of field to be output.
    Reward helpful answers.
    Regards,
    SIddhesh Sanghvi.

  • What is the use of CALL FUNCTION MODULE - AT BACKGROUND TASK?

    Hi experts,
    I found Call functional module in background task will make the FM run at the next commit work as some people said. So I have some questions:
    1 if we use COMMIT WORK commend, the pending FM will be called? If there are several FMs called at background task, what is the sequence of them? How many conditions will trigger the running of these FMs?
    2 Where can I find the log of this pending FMs? In SAP library, it says there are 2 tables. But I checked these tables and can only find the FM name and user of it. And I can not understand content of these tables. It seems one is for the main information of FM, and the other is for the data of the FM, maybe the parameters.
    3 If I call a FM in this way, Can I canncel it before the next commit work in some way?
    Finally, thanks for reading and help.

    HI,
    When the COMMIT WORK statement is executed, the function modules registered for the current SAP-LUW are started in the order in which they were registered. ROLLBACK WORK deletes all previous registrations for the current SAP-LUW.
    If the specified destination is not available when COMMIT WORK is executed, an executable program called RSARFCSE is started in background processing. By default, this tries to start the function modules registered for a SAP-LUW in their destination every 15 minutes and up to 30 times. These parameters can be changed in the transaction SM59. If the destination does not become available within the defined time, it is recorded in the database table ARFCSDATA as the entry "CPICERR". The entry in the database table ARFCSSTATE is deleted after a standard period of eight days

  • Calling Function Module in Update Task

    Hello Experts,
                              Can anyone let me know about
    Calling Function Module in Update Task.
    Why do we use this " In Update Task "  ??
    How do we Use ??
    What is the Use... ??
    Kindly let me know....
    Thanks and Regards
    Pramod

    hi,
    Why do we use this " In Update Task " ??
    The main update technique for bundling database changes in a single database LUW is to use CALL FUNCTION... IN UPDATE TASK.
    How do we Use ??
    A typical R/3 installation contains dialog work processes and at least one update work process. The update work processes are responsible for updating the database. When an ABAP program reaches a COMMIT WORK statement, any function modules from CALL FUNCTION... IN UPDATE TASK statements are released for processing in an update work process. The dialog process does not wait for the update to finish. This kind of update is called asynchronous update.
    What is the Use... ??
    Asynchronous update is useful when response time from the transaction is critical, and the database updates themselves are so complex that they justify the extra system load
    Real time scenario.
    Suppose a user wants to change an entry in a database table, or add a new one. He or she enters the necessary data, and then starts the update process by choosing Save. This starts the following procedure in the ABAP program:
    Firstly, the program locks the database entry against other users, using the enqueue work process (or the message server in the case of a distributed system). This generates an entry in the lock table. The user is informed whether the update was successful, or whether the lock could not be set because of other users.
    If the lock is set, the program reads the entry that is to be changed and modifies it. If the user has created a new entry, the program checks whether a record with the same key values already exists.
    In the current dialog work process, the program calls a function module using CALL FUNCTION... IN UPDATE TASK, and this writes the change details as an entry in table VBLOG.
    When the program is finished (maybe after further dialog steps), a COMMIT WORK statement starts the final part of the SAP LUW. The work process that is processing the current dialog step starts an update work process.
    Based on the information passed to it from the dialog work process, the update work process reads the log entries belonging to the SAP LUW from table VBLOG.
    The update work process passes this data to the database for updating, and analyzes the return message from the database. If the update was successful, the update work process triggers a database commit after the last database change and deletes the log entries from table VBLOG.
    If an error occurred, the update work process triggers a database rollback, leaves the log entries in table VBLOG, flags them as containing errors, and sends a SAPoffice message to the user, who should then inform the system administrator.
    The corresponding entries in the lock table are reset by the update work process.
    Hope this is helpful, Do reward.

  • Call function module in backgrouns task and in update task

    Hi Gurus,Pls crear me on the " <b>Call function module in backgrouns task and in update task</b>".
    how it works and waht is the link with LUW  releated to these .
    also heard that commit work statement aslo linked with this.
    Pls clarfiy me with expalnation of code.

    Hi sridhar,
    the explanation already given is correct and good. Small add-on:
    All functions called during one LUW with addition IN UPDATE TASK are stored together with their actual parameters in a temporary memory area. The moment a COMMIT WORK is issued, the functions are released to be executed by a so-called update task which is running in the background. This explains why functions called in update task never return anything, no SY-SUBRC and no export or table parameters If a function called in update task raises an exception or runs into an error the calling user will get an express message informing about this. Also, all database updates done by this update process are rolled back to keep consistency.
    This proceeding helps to keep database tables consistent and allows the user to keep on doing his work before all database updates are complete. You may have seen messages like "material will be changed" after saving. If you open the same material immediately, you'll get a message "object locked by...<yourself>". This means the update task is still running.
    Regards,
    Clemens

  • Error BT616 when calling function module SXPG_COMMAND_EXECUTE in background

    Hi All,
    We use function module SXPG_COMMAND_EXECUTE with a custom command we defined in SM69 to move files in unix (mv command).
    The function module call has worked fine for almost a year and recently we have been seeing an error (BT616) in our job lob (SM37) when the program is run in background. We have not been able to reproduce the error in foreground mode and it seems to be occuring only periodically in the background. (The appropriate SAP authorization objects where assigned to the batch job ID and the steps on the batch job.) We are in the process of setting up the trace flag and performing analysis on the trace log via ST11 to help identify the issue.
    After perform analysis on SXPG_COMMAND_EXECUTE, the error is occurring when calling function module SAPXPG_END_XPG for exception 2, system failure, yet function module SAPXPG_END_XPG does not exist. I assume this is a program at the operating system level and is just a signature of the parameters to be passed to the operating system program.
    Below is part of the SAP function module SXPG_COMMAND_EXECUTE that is failing.
    * Now we have to wait for the termination of the external
    * command if the caller wants us to.
        IF TERMINATIONWAIT = 'X'.
          CALL FUNCTION 'SAPXPG_END_XPG'
            DESTINATION DESTINATION
            IMPORTING   EXITSTAT = STATUS
                        EXITCODE = EXITCODE
            TABLES      LOG      = LOG
            EXCEPTIONS  COMMUNICATION_FAILURE = 1 MESSAGE MSG
                        SYSTEM_FAILURE        = 2 MESSAGE MSG.
    I performed a where used on function module SXPG_COMMAND_EXECUTE, and most of SAP programs call the function module with the parameter TERMINATIONWAIT = 'X', so I assume we should pass ‘X’ as well.
    Any ideas on what could be causing this issue?
    Mike Vondran

    I also remember I have this kind of issue, as I have some UNIX script at OS( UNIX) level . The problem was with the ID , as it don’t have proper authorization at OS level ( UNIX ) . Please check this ID authorization. This could be the one of reasons if you’re sure from SAP standpoint.
    Hope this’ll give you some guide line..
    Thanks
    Bye

  • Can we call functional module in a subroutine? Any example?

    Can we call functional module in a subroutine? Any example?

    sample code....
    REPORT  ZPL_BDC_PA30.
    TABLES : PA0022.
    DATA : V_PERNR LIKE PA0022-PERNR,
           V_SLABS LIKE PA0022-SLABS.
    DATA : FILENAME TYPE STRING.
    DATA : BEGIN OF IT_DATA OCCURS 0,
             PERNR LIKE PA0022-PERNR,       "Personnel Number
             SLABS LIKE PA0022-SLABS,       "Certificate code
             SLABS1 LIKE PA0022-SLABS,      "Certificate code new
           END OF IT_DATA.
    DATA : IT_BDCDATA LIKE BDCDATA OCCURS 1 WITH HEADER LINE.
    DATA : BEGIN OF IT_ERROR OCCURS 0,
             POS LIKE SY-TABIX,
             TEXT(40),
           END OF IT_ERROR.
    PARAMETERS : P_FNAME TYPE DXFIELDS-LONGPATH.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
      CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
    EXPORTING
      I_LOCATION_FLAG       = ' '
      I_SERVER              = '?'
      I_PATH                = I_PATH
      FILEMASK              = '.'
      FILEOPERATION         = 'R'
       IMPORTING
      O_LOCATION_FLAG       = O_LOCATION_FLAG
      O_SERVER              = O_SERVER
         O_PATH                = P_FNAME
      ABEND_FLAG            = ABEND_FLAG
       EXCEPTIONS
         RFC_ERROR             = 1
         ERROR_WITH_GUI        = 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.
    START-OF-SELECTION.
      FILENAME = P_FNAME.
      PERFORM UPLOAD.            "Uploading inputfile to internal table.
      PERFORM VALIDATE.          "validating the values
      PERFORM POPULATE_BDC.      "Populating bdc internal table
      PERFORM ERROR_RECORDS
            TABLES IT_ERROR.     "Error records
    *&      Form  bdc_fdata
    FORM BDC_FDATA  USING  FNAM FVAL.
      CLEAR IT_BDCDATA.
      IT_BDCDATA-FNAM = FNAM.
      IT_BDCDATA-FVAL = FVAL.
      APPEND IT_BDCDATA.
    ENDFORM.                    " bdc_fdata
    *&      Form  bdc_hdata
    FORM BDC_HDATA  USING PROGRAM SCRNO DYNBEGIN.
      CLEAR IT_BDCDATA.
      IT_BDCDATA-PROGRAM = PROGRAM.
      IT_BDCDATA-DYNPRO = SCRNO.
      IT_BDCDATA-DYNBEGIN = DYNBEGIN.
      APPEND IT_BDCDATA.
    ENDFORM.                    " bdc_hdata
    *&      Form  upload
    FORM UPLOAD .
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                      = FILENAME
         FILETYPE                      = 'ASC'
         HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            = VIRUS_SCAN_PROFILE
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    = FILELENGTH
      HEADER                        = HEADER
        TABLES
          DATA_TAB                      = IT_DATA
       EXCEPTIONS
         FILE_OPEN_ERROR               = 1
         FILE_READ_ERROR               = 2
         NO_BATCH                      = 3
         GUI_REFUSE_FILETRANSFER       = 4
         INVALID_TYPE                  = 5
         NO_AUTHORITY                  = 6
         UNKNOWN_ERROR                 = 7
         BAD_DATA_FORMAT               = 8
         HEADER_NOT_ALLOWED            = 9
         SEPARATOR_NOT_ALLOWED         = 10
         HEADER_TOO_LONG               = 11
         UNKNOWN_DP_ERROR              = 12
         ACCESS_DENIED                 = 13
         DP_OUT_OF_MEMORY              = 14
         DISK_FULL                     = 15
         DP_TIMEOUT                    = 16
         OTHERS                        = 17
      IF SY-SUBRC <> 0.
        MESSAGE I000(BCTRAIN) WITH 'FILE NOT UPLOADED'.
      ELSE.
       MESSAGE I000(BCTRAIN) WITH 'FILE UPLOADED'.
      ENDIF.
    ENDFORM.                    " upload
    *&      Form  populate_bdc
    FORM POPULATE_BDC .
      LOOP AT IT_DATA .
        PERFORM BDC_HDATA USING 'SAPMP50A'
                                    '1000'
                                    'X'.
        PERFORM BDC_FDATA USING 'RP50G-PERNR'
                                 IT_DATA-PERNR.
        PERFORM BDC_FDATA USING 'RP50G-CHOIC'
                                 '0022'.
        PERFORM BDC_FDATA USING 'BDC_OKCODE'
                                 '=MOD'.
        PERFORM BDC_HDATA USING 'MP002200'
                                     '2000'
                                     'X'.
        PERFORM BDC_FDATA USING 'P0022-SLABS'
                                 IT_DATA-SLABS1.
        PERFORM BDC_FDATA USING 'BDC_OKCODE'
                                 '=UPD'.
        CALL TRANSACTION 'PA30' USING IT_BDCDATA.
        REFRESH IT_BDCDATA.
      ENDLOOP.
    ENDFORM.                    " populate_bdc
    *&      Form  validate
    FORM VALIDATE .
        data : num like sy-tabix,
               num1 like sy-tabix.
      LOOP AT IT_DATA.
       num = num + 1.
    num1 = sy-tabix.
        SELECT PERNR
             FROM PA0022
             INTO V_PERNR WHERE
             PERNR EQ IT_DATA-PERNR.
        ENDSELECT.
        IF SY-SUBRC <> 0.
          MOVE num TO IT_ERROR-POS.
          MOVE 'Invalid Pernr' TO IT_ERROR-TEXT.
          APPEND IT_ERROR.
          DELETE IT_DATA .
        ELSE.
          IF IT_DATA-SLABS IS INITIAL.
            MOVE num TO IT_ERROR-POS.
            MOVE 'Certificate code is initial' TO IT_ERROR-TEXT.
            APPEND IT_ERROR.
            DELETE IT_DATA.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " validate
    *&      Form  error_records
    FORM ERROR_RECORDS TABLES IT_ERRORS.
      FORMAT COLOR COL_GROUP.
      WRITE : / 'Error in the following records : ' .
      FORMAT COLOR COL_NEGATIVE.
      LOOP AT IT_ERROR.
        WRITE : /  IT_ERROR-POS,
                   IT_ERROR-TEXT.
      ENDLOOP.
    ENDFORM.                    " error_records

  • Dynamic Export table of a function Module

    Hi Friends,
    I have a requirement where fields of  Export table of my function Module is dynamic. It is like the Fields to be expoerted by the Function Module would be stored in a seperate Z table
    The Z table would contain the records as follows .
    Table Name              FieldName
    =========     
    MARA                      MATNR
    MARC                      WERKS
    and So on..
    . How can I define my Export table in Function module dynamically so that the structure of my Export Function Module would be same as that of the Fieldnames in Z table..
    Thanks

    Just declare the associate type as "ANY TABLE" in the exporting parameter.
    FUNCTION ZTEST.
    *"*"Local Interface:
    *"  EXPORTING
    *"     REFERENCE(IT_TAB) TYPE  ANY TABLE

  • Type error while calling function module with in FOX formula

    Hi,
    I am getting following error while calling function module from FOX Formula:
    "Types of parameter DAY_IN () and variable J_CALDAY(D) are inconsistent"
    Following is the code:
    DATA    I_CALDAY       TYPE  0CALDAY.
    DATA    N_CALDAY       TYPE  0CALDAY.
    DATA    KYF              TYPE KEYFIGURE_NAME.
    FOREACH   I_CALDAY, KYF.
       CALL FUNCTION SLS_MISC_GET_LAST_DAY_OF_MONTH
          EXPORTING
             DAY_IN  =  I_CALDAY
          IMPORTING
             LAST_DAY_OF_MONTH = N_CALDAY.
        {KYF, N_CALDAY}  =  {KYF, L_CALDAY}.
    ENDFOR.
    Import parameter DAY_IN is of type sy-datum (that inturn is data element SYDATUM of data type DATS - same as 0CALDAY). Not sure why error is being thrown. Any idea? Thanks.
    Edited by: SAP_BOY on Dec 4, 2009 5:26 PM

    Hi,
    I think It will not identify ,though you have  (data element SYDATUM of data type DATS - same as 0CALDAY).Check it out by assigning it through a variable of type D.
    Data I_CALDAY TYPE D.
    Hope it may work out.
    Regards,
    Indu

Maybe you are looking for