Process an Interactive Form in a function module or method

Hello,
If I process an interactive form in a report everthing works fine. But when I execute the same coding in a function module or method nothing works! The call of the function module fm_name returns sy-subrc = 1 (usage error).
I believe that function call of 'FP_JOB_OPEN' cause the problems. I can't spool this job in an function module or method.
What can I do for using interactive Forms in a method.
If anybody had the same problem a piece of of coding will help.
Thanks a lot in advance
Roger
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
  EXPORTING
    i_name     = 'Z_EXPORT_FORM_01'
  IMPORTING
    e_funcname = fm_name.
Set output parameters and open spool job
fp_outputparams-nodialog = 'X'. " suppress printer dialog popup
fp_outputparams-getpdf = 'X'. " launch print preview
CALL FUNCTION 'FP_JOB_OPEN'
  CHANGING
    ie_outputparams = fp_outputparams
  EXCEPTIONS
    cancel          = 1
    usage_error     = 2
    system_error    = 3
    internal_error  = 4
    OTHERS          = 5.
Set form language and country (->form locale)
fp_docparams-langu     = 'E'.
fp_docparams-country   = 'US'.
fp_docparams-fillable  = 'X'.
call the generated function module
CALL FUNCTION fm_name
  EXPORTING
    /1bcdwb/docparams    = fp_docparams
    /vwk/z_tla_vw_export = wa_z_export
    it_vehicle           = lt_vehicle
    ddinit               = ddinit
    ddcomplaint          = ddcomplaint
    ddinformation        = ddinformation
    ddpraise             = ddpraise
    ddidea               = ddidea
  IMPORTING
    /1bcdwb/formoutput   = fp_formoutput
  EXCEPTIONS
    usage_error          = 1
    system_error         = 2
    internal_error       = 3
    OTHERS               = 4.

Yes I did.
I have written the code as given below. It is not working either. Can you please check my code.
DATA:
      FM_NAME TYPE RS38L_FNAM,
      FP_DOCPARAMS      TYPE SFPDOCPARAMS,
      FP_OUTPUTPARAMS   TYPE SFPOUTPUTPARAMS.
fp_outputparams-nodialog = 'X'.
fp_outputparams-getpdf = 'X'.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
Get the name of the generated function module
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = 'ZHR_APPT'
IMPORTING
e_funcname = fm_name.
Set form language and country (->form locale)
fp_docparams-langu = 'E'.
fp_docparams-country = 'US'.
fp_docparams-fillable = 'X'.
call the generated function module
CALL FUNCTION FM_NAME
    EXPORTING
      /1BCDWB/DOCPARAMS        = FP_DOCPARAMS
      T_HR                     = wa_emphr1
   IMPORTING
    /1BCDWB/FORMOUTPUT       =
    EXCEPTIONS
      USAGE_ERROR           = 1
      SYSTEM_ERROR          = 2
      INTERNAL_ERROR           = 3.
Thx,
John

Similar Messages

  • How to Send Internal table to SAP Spool using Function Modules or Methods?

    Hi Experts,
    How to Send Internal table to SAP Spool using Function Modules or Methods?
    Thanks ,
    Kiran

    This is my code.
    I still get the no ABAP list data for the spool, even tho I can see it sp01?
    REPORT  Z_MAIL_PAYSLIP.
    * Declaration Part *
    tables: PERNR, PV000, T549Q, V_T514D, HRPY_RGDIR.
    infotypes: 0000, 0001, 0105, 0655.
    data: begin of ITAB occurs 0,
      MTEXT(25) type C,
      PERNR like PA0001-PERNR,
      ABKRS like PA0001-ABKRS,
      ENAME like PA0001-ENAME,
      USRID_LONG like PA0105-USRID_LONG,
    end of ITAB.
    data: W_BEGDA like HRPY_RGDIR-FPBEG,
          W_ENDDA like HRPY_RGDIR-FPEND.
    data: RETURN like BAPIRETURN1 occurs 0 with header line.
    data: P_INFO like PC407,
          P_FORM like PC408 occurs 0 with header line.
    data: P_IDX type I,
          MY_MONTH type T549Q-PABRP,
          STR_MY_MONTH(2) type C,
          MY_YEAR type T549Q-PABRJ,
          STR_MY_YEAR(4) type C,
          CRLF(2) type x value '0D0A'.
    data: W_CMONTH(10) type C.
    data: TAB_LINES type I,
          ATT_TYPE like SOODK-OBJTP.
    data: begin of P_INDEX occurs 0,
            INDEX type I,
    end of P_INDEX.
    constants: begin of F__LTYPE, "type of line
       CMD like PC408-LTYPE value '/:',  "command
       TXT like PC408-LTYPE value 's',   "textline
    end of F__LTYPE.
    constants: begin of F__CMD, "commands
      NEWPAGE like PC408-LINDA value '',
    end of F__CMD.
    data: P_LIST like ABAPLIST occurs 1 with header line.
    *data: OBJBIN like SOLISTI1 occurs 10 with header line,
    data: OBJBIN like  LVC_S_1022 occurs 10 with header line,
          DOCDATA like SODOCCHGI1,
          OBJTXT like SOLISTI1 occurs 10 with header line,
          OBJPACK like SOPCKLSTI1 occurs 1 with header line,
          RECLIST like SOMLRECI1 occurs 1 with header line,
          OBJHEAD like SOLISTI1 occurs 1 with header line,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_buffer type string,
          l_no_of_bytes TYPE i,
          l_pdf_spoolid LIKE tsp01-rqident,
          l_jobname     LIKE tbtcjob-jobname.
    data: file_length  type int4,
          spool_id     type rspoid,
          line_cnt     type i.
    *-------------------------------------------------------------------* * INITIALIZATION *
    OBJBIN = ' | '.
    append OBJBIN.
    OBJPACK-HEAD_START = 1.
    data: S_ABKRS like PV000-ABKRS.
    data: S_PABRP like T549Q-PABRP.
    data: S_PABRJ like T549Q-PABRJ.
    * SELECTION SCREEN                                                  *
    selection-screen begin of block BL1.
    parameters: PAY_VAR like BAPI7004-PAYSLIP_VARIANT default 'ESS_PAYSLIPS' obligatory.
    selection-screen end of block BL1.
    START-OF-SELECTION.
      s_ABKRS = PNPXABKR.
      S_PABRP = PNPPABRP.
      s_pabrj = PNPPABRJ.
      w_begda = PN-BEGDA.
      w_endda = PN-ENDDA.
    get pernr.
    *                                 "Check active employees
      rp-provide-from-last p0000 space pn-begda  pn-endda.
      CHECK P0000-STAT2 IN PNPSTAT2.
    *                                 "Check Payslip Mail flag
      rp-provide-from-last p0655 space pn-begda  pn-endda.
      CHECK P0655-ESSONLY = 'X'.
      rp-provide-from-last p0001 space pn-begda  pn-endda.
    *                                 "Find email address
      RP-PROVIDE-FROM-LAST P0105 '0030' PN-BEGDA PN-ENDDA.
      if p0105-usrid_LONG ne ''.
        ITAB-PERNR      = P0001-PERNR.
        ITAB-ABKRS      = P0001-ABKRS.
        ITAB-ENAME      = P0001-ENAME.
        ITAB-USRID_LONG = P0105-USRID_LONG.
        append itab.
        clear itab.
      endif.
      "SY-UCOMM ='ONLI'
    END-OF-SELECTION.
    *------------------------------------------------------------------* start-of-selection.
      write : / 'Payroll Area        : ', S_ABKRS.
      write : / 'Payroll Period/Year : ',STR_MY_MONTH,'-',STR_MY_YEAR. write : / 'System Date : ', SY-DATUM.
      write : / 'System Time         : ', SY-UZEIT.
      write : / 'User Name           : ', SY-UNAME.
      write : / SY-ULINE.
      sort ITAB by PERNR.
      loop at ITAB.
        clear : P_INFO, P_FORM, P_INDEX, P_LIST, OBJBIN, DOCDATA, OBJTXT, OBJPACK, RECLIST, TAB_LINES.
        refresh : P_FORM, P_INDEX, P_LIST, OBJBIN, OBJTXT, OBJPACK, RECLIST.
    *                                                  Retrieve Payroll results sequence number for this run
        select single * from HRPY_RGDIR where PERNR eq ITAB-PERNR
                                        and FPBEG ge W_BEGDA
                                        and FPEND le W_ENDDA
                                        and SRTZA eq 'A'.
    *                                                  Produce payslip for those payroll results
        if SY-SUBRC = 0.
          call function 'GET_PAYSLIP'
            EXPORTING
              EMPLOYEE_NUMBER = ITAB-PERNR
              SEQUENCE_NUMBER = HRPY_RGDIR-SEQNR
              PAYSLIP_VARIANT = PAY_VAR
            IMPORTING
              RETURN          = RETURN
              P_INFO          = P_INFO
            TABLES
              P_FORM          = P_FORM.
          check RETURN is initial.
    *                                                 remove linetype from generated payslip
          loop at p_form.
            objbin = p_form-linda.
            append objbin.
            line_cnt = line_cnt + 1.
          endloop.
          file_length = line_cnt * 1022.
    *                                                 create spool file of paylsip
          CALL FUNCTION 'SLVC_TABLE_PS_TO_SPOOL'
            EXPORTING
              i_file_length = file_length
            IMPORTING
              e_spoolid     = spool_id
            TABLES
              it_textdata   = objbin.
          IF sy-subrc EQ 0.
            WRITE spool_id.
          ENDIF.
          DESCRIBE table objbin.
          DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
          CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
            EXPORTING
              SRC_SPOOLID                    = spool_id
              NO_DIALOG                      = ' '
              DST_DEVICE                     = 'MAIL'
    *      PDF_DESTINATION                =
    *    IMPORTING
    *      PDF_BYTECOUNT                  = l_no_of_bytes
    *      PDF_SPOOLID                    = l_pdf_spoolid
    *      LIST_PAGECOUNT                 =
    *      BTC_JOBNAME                    =
    *      BTC_JOBCOUNT                   =
            TABLES
              PDF                            = pdf
            EXCEPTIONS
              ERR_NO_ABAP_SPOOLJOB           = 1
              ERR_NO_SPOOLJOB                = 2
              ERR_NO_PERMISSION              = 3
              ERR_CONV_NOT_POSSIBLE          = 4
              ERR_BAD_DESTDEVICE             = 5
              USER_CANCELLED                 = 6
              ERR_SPOOLERROR                 = 7
              ERR_TEMSEERROR                 = 8
              ERR_BTCJOB_OPEN_FAILED         = 9
              ERR_BTCJOB_SUBMIT_FAILED       = 10
              ERR_BTCJOB_CLOSE_FAILED        = 11
              OTHERS                         = 12
          IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    *Download PDF file C Drive
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename = 'C:\itab_to_pdf.pdf'
          filetype = 'BIN'
        TABLES
          data_tab = pdf.
    * Transfer the 132-long strings to 255-long strings
    *  LOOP AT pdf.
    *    TRANSLATE pdf USING ' ~'.
    *    CONCATENATE gd_buffer pdf INTO gd_buffer.
    *  ENDLOOP.
    *  TRANSLATE gd_buffer USING '~ '.
    *  DO.
    *    it_mess_att = gd_buffer.
    *    APPEND it_mess_att.
    *    SHIFT gd_buffer LEFT BY 255 PLACES.
    *    IF gd_buffer IS INITIAL.
    *      EXIT.
    *    ENDIF.
    *  ENDDO.
          OBJHEAD = 'Objhead'.
          append OBJHEAD.
    * preparing email subject
          concatenate W_ENDDA(6)
                    ' Payslip-'
                    ITAB-ENAME+0(28)
                    ITAB-PERNR+4(4) ')'
                 into DOCDATA-OBJ_DESCR.
          DOCDATA-OBJ_NAME = 'Pay Slip'.
          DOCDATA-OBJ_LANGU = SY-LANGU.
          OBJTXT = 'Pay Slip.'.
          append OBJTXT.
    *prepare email lines
          OBJTXT = DOCDATA-OBJ_DESCR.
          append OBJTXT.
          OBJTXT = 'Please find enclosed your current payslip.'.
          append OBJTXT.
    * Write Attachment(Main)
    * 3 has been fixed because OBJTXT has fix three lines
          read table OBJTXT index 3.
    *    DOCDATA-DOC_SIZE = ( 3 - 1 ) * 255 + strlen( OBJTXT ).
          clear OBJPACK-TRANSF_BIN.
          OBJPACK-HEAD_START = 1.
          OBJPACK-HEAD_NUM = 0.
          OBJPACK-BODY_START = 1.
          OBJPACK-BODY_NUM = 3.
          OBJPACK-DOC_TYPE = 'RAW'.
          append OBJPACK.
    * Create Message Attachment
          ATT_TYPE = 'PDF'.
          describe table OBJBIN lines TAB_LINES.
          read table OBJBIN index TAB_LINES.
    *    OBJPACK-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + strlen( OBJBIN ).
          OBJPACK-TRANSF_BIN = 'X'.
          OBJPACK-HEAD_START = 1.
          OBJPACK-HEAD_NUM = 0.
          OBJPACK-BODY_START = 1.
          OBJPACK-BODY_NUM = TAB_LINES.
          OBJPACK-DOC_TYPE = ATT_TYPE.
          OBJPACK-OBJ_NAME = 'ATTACHMENT'.
          OBJPACK-OBJ_DESCR = 'Payslip'.
          append OBJPACK.
    * Create receiver list refresh RECLIST.
          clear RECLIST.
          RECLIST-RECEIVER = itab-USRID_long.
          translate RECLIST-RECEIVER to lower case.
          RECLIST-REC_TYPE = 'U'.
          append RECLIST.
    * Send the document
    *SO_NEW_DOCUMENT_ATT_SEND_API1
          call function 'SO_DOCUMENT_SEND_API1'
            exporting
              DOCUMENT_DATA = DOCDATA
              PUT_IN_OUTBOX = 'X'
              COMMIT_WORK = 'X'
    * IMPORTING
    *   SENT_TO_ALL =
    *   NEW_OBJECT_ID =
            tables
              PACKING_LIST  = OBJPACK
              OBJECT_HEADER = OBJHEAD
              CONTENTS_BIN  = pdf
              CONTENTS_TXT  = OBJTXT
    *   CONTENTS_HEX =
    *   OBJECT_PARA =
    *   OBJECT_PARB =
              RECEIVERS = RECLIST
            exceptions
              TOO_MANY_RECEIVERS = 1
              DOCUMENT_NOT_SENT = 2
              DOCUMENT_TYPE_NOT_EXIST = 3
              OPERATION_NO_AUTHORIZATION = 4
              PARAMETER_ERROR = 5
              X_ERROR = 6
              ENQUEUE_ERROR = 7
              others = 8.
          if SY-SUBRC NE 0.
            ITAB-MTEXT = 'Message Not Sent to : '.
          else.
            ITAB-MTEXT = 'Message Sent to : '.
          endif.
    *    else.
    *      ITAB-MTEXT = 'Message Not Sent to : '.
    *    endif.
        else.
          "SY-SUBRC Not = 0
          ITAB-MTEXT = 'Payroll data not found : '.
        endif.
        "end of SY-SUBRC = 0.
        modify ITAB.
      endloop. "end loop at ITAB
      sort ITAB by MTEXT PERNR.
      loop at ITAB.
        at new MTEXT.
          uline.
          write : / ITAB-MTEXT color 4 intensified on.
          write : / 'Emp. Code' color 2 intensified on,
                 12 'Emp. Name' color 2 intensified on,
                 54 'Email ID' color 2 intensified on.
        endat.
        write : / ITAB-PERNR, 12 ITAB-ENAME, 54 ITAB-USRID_LONG.
      endloop.

  • Function module or Method for changing a program with transport

    Hi,
    Can anybody please let me know if there is any Function module or Method to change a program under a Transport request
    (so it needs to go to next Version for the program).  I tried using
    INSERT REPORT .... with all options for this command. It is changing the program successfully but all are creating the program locally.
    I successfully found CIF_PROGRAM_INSERT for creating new program under a TR.
    But struggling a lot to find the same kind of FM or Method to change a program.
    Can anybody help?
    //Kothand

    Hi,
    Thanks. But i am asking for a Function module which can edit a program and keep it inside a Transport request.
    This FM is to import any change request.
    //Kothand

  • Is it possible to call a adobe form inside a function module?

    Hi gurus,
    i am trying to generate the pdf data source inside a custom function module,
    the function module will call the FUNCTION 'FP_JOB_OPEN' , then call the function module of the pdf interface. then get the pdf data back and return.
    but at run time i got the error message:
    FPRUNX101, the job already started.
    then the program stopped.
    i checked the service market place, there is a note for that:858325 Message "Job already started" when you display PDF forms .
    according to the notes,it seems that it's only possible to call the pdf generated function module in a program.
    my question is , is there a way to call that in a funciton module?
    best regards.
    Jun
    the note states that:
    Reason and Prerequisites
    At runtime, a PDF-based form is called using a generated function module. If you use the new interface, it is necessary to set the function modules FP_JOB_OPEN and FP_JOB_CLOSE as control structures with one or several generated function modules. In order for the single test from Transaction SFP to work simultaneously, however, the system checks for the test environment of Transaction SE37 (in which the test ultimately runs) in the single test. In this case, the function modules FP_JOB_OPEN or FP_JOB_CLOSE are called automatically.
    If you then test a function module that calls a PDF based form and therefore calls the function module FP_JOB_OPEN itself, this leads to the error message mentioned above.
    Solution
    The test should be carried out using a program that in turn calls the function module to be tested.

    sorry, i found out the reason.
    the fm can not test direct in se37, it should be wrapped by a program.
    br.
    zj

  • Error "Job already started" when calling a adobe form in Z function module

    Hi All,
    I have a error when calling a adobe form in a custom function module.
    I am using FP_FUNCTION_MODULE_NAME to get the adobe form function module and then i am using FP_JOB_OPEN function module to control the printing parameters such as no print preview or no dialog ..etc.. I dont have any exceptions during the call of FP_JOB_OPEN function module ..
    Later I am calling my function module which was generated for the adobe form and i am getting the error called " JOB ALREADY STARTED".
    I tried executing the same function module in se37 and the PDF form output was generated, and also by commenting FP_JOB_OPEN function module the PDF form output was generated.
    But i need the FP_JOB_OPEN function module to control the output based on the output type which triggers the form output such as the medium from nast record which says print or email or fax.. etc
    Please let me know how to handling this error.

    Just as a followup note. If you are testing a function module from SE37 and the test button you will get a value in SY-CPROG. You must override this value for everything to work.
    If you override the value of SY-CPROG with the main program that will be calling the function module you have no problem.
    John W.

  • Error while processing ADOBE interactive form

    Hi,
    I get following error when I try to submit an ADOBE interactive form.
    FormPostprocessor.ERROR_NO_DEFAULT_USER_FOR_ROLE
    com.sap.caf.eu.gp.base.exception.EngineException: FormPostprocessor.ERROR_NO_DEFAULT_USER_FOR_ROLE
    at com.sap.caf.eu.gp.model.iforms.postproc.FormPostprocessor.createProcessRoleInstance(FormPostprocessor.java:176)
    at com.sap.caf.eu.gp.model.iforms.postproc.FormPostprocessor.prepareProcessRoles(FormPostprocessor.java:157)
    at com.sap.caf.eu.gp.model.iforms.postproc.FormPostprocessor.initiateProcess(FormPostprocessor.java:289)
    at com.sap.caf.eu.gp.model.iforms.postproc.FormPostprocessor.processData(FormPostprocessor.java:564)
    at com.sap.caf.eu.gp.model.iforms.FormPostProcessor.doPost(FormPostProcessor.java:182)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
    at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
    at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
    at com.sap.engine.core.cluster.impl6.session.MessageRunner.run
    (MessageRunner.java:41)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Please help.
    Ashutosh

    I managed to sort the issue.
    It is not related to the ADS configuration.
    I had to assign all the default roles of process to the user /role.
    Thanks a lot for reply.

  • WD application- Interactive form -Not bringing values to Onclick method

    Hi,
    I am working on Interactive form which has a submit button.
    Requirement is Form should be pre-filled with fields in Item column1 and then user fills in a field in Item column C2.Finally my submit button on form should take c1,c2 values and I will be using this in Click method for further processing.
    For this I have done following.
    1- created a structure ZILAB( which has COLUMN 1 & COLUMN 2 FIELDS) and created a node adobe_data with cardinality 1.1, and then under it created another node called ITEM CARDINALITY 1..N).This is mapped to ZILAB.
    2- Created  job number as parameter and button1 .This button1 brings up the pre-filled item Column1 fields to form.
    3- There is new column C2 in the output form which user will input.
    4- When I click final submit button it is stopping in Onclick method.my code is bringing up C1 values but not bringing of C2 values(which is user input) in my Onclick event of SUbmit button-WDACTIVEX.
    Also I have checked enable option, Assigned pdfsource, change type to activeX.I even tried to change element item name but still not able to get entries in onclick method.
    What is wrong with my code/process?
    DATA lo_nd_adobe_data TYPE REF TO if_wd_context_node.
      DATA lo_nd_item TYPE REF TO if_wd_context_node.
      DATA lo_el_item TYPE REF TO if_wd_context_element.
      DATA ls_item1 TYPE IF_MAIN=>element_item.
    * navigate from <CONTEXT> to <ADOBE_DATA> via lead selection
      lo_nd_adobe_data = wd_context->get_child_node( name = IF_MAIN=>wdctx_adobe_data ).
    * navigate from <ADOBE_DATA> to <ITEM> via lead selection
      lo_nd_item = lo_nd_adobe_data->get_child_node( name = IF_MAIN=>wdctx_item ).
    * get element via lead selection
      lo_el_item = lo_nd_item->get_element(  ).
    * get all declared attributes
      lo_el_item->get_static_attributes(
        IMPORTING
          static_attributes = ls_item1 ).
    Rgds
    Vara

    Hi ravi,
    These are the function modules  which converts table to String and the String to Xstring.
             SOTR_SERV_TABLE_TO_STRING  "Table to String
             SCMS_STRING_TO_XSTRING "String to Xstring
    For triggering work flow is not a problem. But this pdf should be generated again at workitem attachment.
    For converting to PDF and attachming the pdf to workitem I already have a business object
    Can you tell me how you are attaching document to Workflow and how you are triggering workflow on click of Submit button and what is the businees object to send the attachements to workitems.

  • Difference between Function Module Vs Method in Class Module

    1) Can you please tell the difference between the Function module used in abap program and the method of the class module used in abap programming.
    2) does it necessary to do commit statement after calling the function module.
    Thankyou for you time.
    Bhaskar.

    Hi,
    1)
    Check this difference..
    The main difference between real object orientation and function groups is that although a program can work with the instances of several function groups at the same time, it cannot work with several instances of a single function group. Suppose a program wanted to use several independent counters, or process several orders at the same time. In this case, you would have to adapt the function group to include instance administration, for example, by using numbers to differentiate between the instances.
    2) COMMIT WORK is required for BAPI..And not required when you normally call a function module..Unless required ..
    Example
    Update function modules requires COMMIT WORK to execute the function module.
    Thanks,
    Naren

  • Function Modules or Methods to Retrieve texts in Material Master

    Hi All,
    Can you get me a list of Function Modules which retrieve the text from Material Master.
    My requirement is to extract texts:
    Basic Text - at material level
    Purchase Order text - at material level
    Sales Texts - at material-sales org level
    Thanks in Advance.
    Sure Points for all Valuable answers
    Regards
    Vinayak

    hi
          u can get using read_text FM ask ur functionl person to give you the ID and other details required..
    u can also get it from STXH table... from which even the FM gets data..

  • Hierarchy Function Modules (or Methods)?

    I am trying to retrieve all hierarchies, and their children nodes, below a main node. Is there a function module in SEM/BCS for doing this?
    Are there other function modules that come in handy with hierarchies?
          Thank-You.

    There isn't a single FM that I'm aware of.  You can piggy back the standard BCS functionality and acheive something similar.
    You need to know period, year, version and fiscal year variant. 
    Then...for this structure:
    CG1
    - CG2
    - CG3
    - - CG4
    you can pass CG1 as your "parent" and retreive CG2, CG3, and CG4 as selections (according to date-from date-to in your CG master data).
    I'll try to include the relevant section for this (it's from a number of methods in a class I created for an outbound interface)....I'm sure I don't have all the data declarations, and I might have a few unnecessary sections.
    global variables
      data DO_AREA type ref to IF_UC_AREA .
      data DO_MODEL type ref to IF_UC_MODEL .
      data DO_MD_FACTORY type ref to IF_UG_MD_FACTORY .
    initialize objects
    *** method for initialize objects
      DATA:
      lo_factory        TYPE REF TO if_ug_md_factory,
      lo_char           TYPE REF TO if_ug_md_char,
      lo_value          TYPE REF TO if_ug_md_char_value,
      lt_field_val      TYPE ugmd_ts_field_val,
      ls_field_val      TYPE ugmd_s_field_val.
    * Initialize master data factory
      CALL METHOD cl_uc_area=>if_uc_area~get_md_factory
        EXPORTING
          i_area        = c_cons_area
        IMPORTING
          eo_md_factory = lo_factory.
      do_md_factory = lo_factory.
    * get area object, if it's not set
      IF do_area IS NOT BOUND.
        lo_char = do_md_factory->get_char_instance(
            i_fieldname = uc00_cs_fld-area ).
        ls_field_val-fieldname = uc00_cs_fld-area.
        ls_field_val-value     = c_cons_area.
        INSERT ls_field_val INTO TABLE lt_field_val.
        lo_value = lo_char->get_value_instance(
           it_value = lt_field_val ).
        do_area   ?= lo_value.
    *   get data model
        IF do_model IS NOT BOUND.
          CALL METHOD do_area->get_model
            IMPORTING
              eo_model = do_model.
        ENDIF.
      ENDIF.
    determine lower level consolidation groups
    **Include lower level consolidation group nodes in cube selection.
      DATA:
      lo_context           TYPE REF TO if_uc_context,
      lt_value             TYPE uc0_ts_value,
      ls_value             TYPE uc0_s_value,
      ls_o_sel             TYPE uct_sx_sel,
      lt_sel               TYPE uc0_ts_sel,
      ls_sel               TYPE uc0_s_sel,
      ls_sid               TYPE ucd_s_sid,
      ls_sel_node          TYPE uc0_s_sel_node_sid,
      lt_sel_node          TYPE uc0_ts_sel_node_sid,
      lt_o_sel             TYPE uct_t_sel.
      CLEAR lt_value.
      ls_value-fieldname = c_cgcomp_fieldname. ' /1FB/SEM_CGCOMP
      ls_value-value = i_sem_cgcomp.           ' "parent" consolidation group
      APPEND ls_value TO lt_value.
      CALL METHOD do_model->do_sidmap->convert_value_to_sid
        EXPORTING
          i_fieldname = c_cgcomp_fieldname
          it_value    = lt_value
        IMPORTING
          es_sid      = ls_sid
        EXCEPTIONS
          not_found   = 1
          OTHERS      = 2.
      CLEAR lt_sel_node.
      ls_sel_node-fieldname =  c_cgcomp_fieldname.
      ls_sel_node-sign      = uc00_cs_ra-sign_i.
      ls_sel_node-s_node    = ls_sid.
      INSERT ls_sel_node INTO TABLE lt_sel_node.
      CLEAR lt_sel.
      CLEAR lt_value.
      CALL METHOD do_model->do_data_factory->create_sel
        EXPORTING
          it_node_sid = lt_sel_node
        RECEIVING
          eo_sel      = ls_o_sel-o_sel.
      APPEND ls_o_sel TO lt_o_sel.
      CLEAR ls_value.
      ls_value-fieldname = '/1FB/CS_VERSION'.     " CS Version
      ls_value-value = g_cs_version.
      APPEND ls_value TO lt_value.
      CLEAR ls_value.
      ls_value-fieldname = '/BIC/BCS_VERS'.          " Custom Version
      ls_value-value = g_bcs_vers.
      APPEND ls_value TO lt_value.
      CLEAR ls_value.
      ls_value-fieldname = 'FISCPERIOD'.
      ls_value-value = g_fiscperiod.
      APPEND ls_value TO lt_value.
      CLEAR ls_value.
      ls_value-fieldname = 'FISCVARNT'.
      ls_value-value = g_fiscvarnt.
      APPEND ls_value TO lt_value.
      CLEAR ls_value.
      ls_value-fieldname = 'FISCYEAR'.
      ls_value-value = g_fiscyear.
      APPEND ls_value TO lt_value.
      CALL METHOD do_model->derive_context
        EXPORTING
          it_value     = lt_value
        IMPORTING
          eo_context   = lo_context
        EXCEPTIONS
          info_missing = 1
          OTHERS       = 2.
      CALL METHOD ls_o_sel-o_sel->set_context
        EXPORTING
          io_context = lo_context.
      CALL METHOD ls_o_sel-o_sel->get_sel
        IMPORTING
          et_sel = lt_sel.
    * lt_sel will contain the lower-level consolidation groups, beneath the "parent" consolidation group (i_sem_cgcomp)
    * Add cons groups to selection criteria
      DELETE gt_range WHERE chanm = c_objnm_cgcomp.   ' 0SEM_CGCOMP
      LOOP AT lt_sel INTO ls_sel.
        CLEAR  gs_range.
        gs_range-chanm  = c_objnm_cgcomp.   ' 0SEM_CGCOMP
        gs_range-sign   = ls_sel-sign.
        gs_range-compop = ls_sel-option.
        gs_range-low    = ls_sel-low.
        gs_range-high   = ls_sel-high.
        APPEND gs_range TO gt_range.
      ENDLOOP.
    Hope that helps...if not, you might be able to do a find for some of the sections of the code to find exactly how SAP is doing (I can only say that this functionality worked in my situation, not sure it works in all consolidation scenarios).  FYI - I was using this to read from the virtual cube in a custom task in order to outbound consolidated results.
    - Chris

  • How to call function module/ class method of another system.

    Suppose now i am working in System A. And i need to check the system Status of System B, System C, System D....
    my design is to provide an interface. and each system realize the interface individually.now my question is how cani call the interface, because they are in different systems.
    of course i know about the host name, port and logon information over these systems.
    who can give my some suggestions or other solutions.
    thanks in advance.
    Johnney.

    Hello,
    If u want to call a FM of the other system then that FM should be a RFC enable on one.
    <b>CALL FUNCTION func DESTINATION dest.</b>
    Effect
    Executes the function module from an external source (as a Remote Function Call or RFC); dest can be a literal or a variable.
    Depending on the specified destination, the function module is executed in another R/3 or R/2 System. Externally callable function modules must be flagged as such in the Function Builder (of the target system).
    Since each destination defines its own program context, further calls to the same or different function modules with the same destination can access the local memory (global data) of these function modules.
    To maintain existing destinations, choose Tools -> Administration, Administration -> Network -> RFC destinations
    Note
    Under certain circumstances, an RFC may trigger a database commit. For this reason, RFCs must not be used between pairs of SQL statements that open and close a database cursor (such as SELECT... ENDSELECT).
    Vasanth

  • BOR object cannot use function module as method

    Hi All,
    I have a function module with an import parameter referring to data element DE_ABC. BOR indicates that it doesn't support this data type. However, if I define a DB table with a field whose type is DE_ABC and use that field as reference in FM interface definition, that FM can be used by the BOR object. Does anybody have any idea about this issue?
    Best Regards
    Jerome

    Hello,
    Please always mention version. It may help if you told us what data type, but to give a theoretical answer I'd say this would be correct behaviour.
    BOR is old, it was created to bring some kind of OO to then procedural ABAP. It has also not changed much, therefore doesn't support some of the newer data types. On the other hand it doesn't look at the components of a structure, so placing an unsupported element into a structure is a perfect workaround.
    Be careful however when using deep structures or one of the variable length types such as STRING. As I use classes most of the time I have no idea how they would behave but a quick test should verify whether it works.
    Hope that helps,
    Mike

  • How to call ABAP function module/ class method through web service?

    Hi Colleagues,
    I need to write an iphone version of current ABAP program. I want to call ABAP method and function module through my iphone so that I can re-use the ABAP APIs.So I choose web service. Can you give me any details information about how to do that?
    Thank you very much

    Hi,
    you need to create webservice out of FM. goto SE80 and follow the webservice creation wizard. Finally use webservice url for calling FM (remote enabled) from your iPhone.
    Regards,
    Gourav

  • Regarding Function modules and methods

    Hi,
    which of these calls to GUI_UPLOAD is more efficient?
    CALL METHOD cl_gui_frontend_services=>gui_upload
    or
    CALL FUNCTION GUI_UPLOAD

    both does the same job. if you look at the code inside the method cl_gui_frontend_services=>gui_upload
    it would be calling GUI_UPLOAD function.
    in terms of performance efficiency, there will be a very negligible differece and call function will be slightly better in my opinion.
    Regards
    Raja

  • Function Module or Method needed to Convert Nodes?

    When I read hierarchies of nodes, the first parent node can be lets say 3, its children are 2. Old logic the I have expects 0, not three for the parent. I can write some logic to convert all but wondering if their was an SAP FM or method I could use instead.
         Thank-You

    Hi Vishnu,
    Have a look at this FM.
    <b>CO_MP_CREATE_PURCHASE_ORDER</b>
    and also this
    <b>OIO_RS_M_CREATE_PURCHASE_ORDER</b>
    <b>Reward points if this helps,</b>
    Kiran

Maybe you are looking for