How to read attachment via function module??

Hi All,
I have to Read the content of attachment of standard task TS00407864.
For that i have used a function module SAP_WAPI_GET_ATTACHMENTS.
and i got this.
OBJECT_ID                                SOFM      FOL32000000000004RAW340
DESCRIPT                       Office Document
SHORTTEXT                      Office Document
DEF_ATTRIB                     Document Not as per Accounting Stantard
OBJECT_TYP                     AT
Now i have to read it in internal table which function i should use and how can i pass the value to it.
Please Help!
Regards,
Purvesh Patel.

Hi,
use method cl_swf_utl_convert_por=>convert_bor_to_ibf( ). Also properly defined structures will parse data without need of offset reading/parsing.
Example:
     data:
         lt_attachment         type  swrtobject,
         lt_wapi_message       type  swr_msgtab,
         ls_docid              type  soentryi1,
         lv_subrc              type  sy-subrc,
         lv_doc_id             type  sofolenti1-doc_id
     field-symbols:
         <ls_attachment>       type  swr_object
     call function 'SAP_WAPI_GET_ATTACHMENTS'
         exporting
             workitem_id     = me->mv_workitem_id
             user            = me->mv_username
             language        = me->mv_language
         importing
             return_code     = lv_subrc
         tables
             attachments     = lt_attachment
             message_struct  = lt_wapi_message
     if ( lv_subrc <> 0 ).
         "! Handle error / messages
     endif.
     loop at       lt_attachment
         assigning <ls_attachment>
         lv_doc_id = cl_swf_utl_convert_por=>convert_bor_to_ibf( i_bor_por = <ls_attachment>-object_id ).
         ls_docid  = lv_doc_id.
     endloop.

Similar Messages

  • Read attributes via Function Module

    Hi Experts,
    I need to read Directorate and Division which are  attributes of fundscenter, fundscenter is an attribute of 0Employee by using  Function  Module RSAU_READ_MASTER_DATA in a Transformation.
    please advise how many times I would call the FM if so what would the Import and export parameters
    Regards,
    Koka

    Thanks for the reply satish. I am using DB connect both Text and Attr.but how does that gonna effect.
    I have actually passed the same what you have mentioned earlier I am able to get the funds ctr value.
    Please find the same.
    DATA:  l_employee  TYPE /bi0/memployee,
            lt_table    TYPE TABLE OF /bi0/memployee,
            l_funds_ctr TYPE /bi0/mfunds_ctr.
        DATA: l_iobjnm type RSDIOBJ-IOBJNM.
        DATA: l_chavl  type RSD_CHAVL.
        l_iobjnm = '0EMPLOYEE'.
        l_chavl = SOURCE_FIELDS-EMPLOYEE.
        CALL FUNCTION 'RSAU_READ_MASTER_DATA'
          EXPORTING
            i_iobjnm                      = l_iobjnm
            I_CHAVL                       = l_chavl
          I_T_CHAVL                     =
            I_DATE                        = SOURCE_FIELDS-tv_depdate
          I_FLG_WHOLE_TABLE             =
            I_ATTRNM                      = '0FUNDS_CTR'
          I_BYPASS_BUFFER               = RS_C_FALSE
          I_LOGSYS                      =
         IMPORTING
          E_STRUCTURE                   = l_employee
          E_TABLE                       = lt_table
           E_ATTRVAL                     = RESULT
         EXCEPTIONS
           READ_ERROR                    = 1
           NO_SUCH_ATTRIBUTE             = 2
           WRONG_IMPORT_PARAMETERS       = 3
           CHAVL_NOT_FOUND               = 4
           OTHERS                        = 5
        IF sy-subrc <> 0.
        CLEAR RESULT.
       ENDIF.
    I Need to check the tv_depdate which is a deperture date has to be within to data and from date of employee so I have passed it.please provide me with the logic if possible.
    Thanks in advance..
    Koka.

  • How to attach a Function Module to a custom Tcode

    Hi All,
    I need to attach a Function Module to a new custom Tcode.I tried to create the new Tcode with option Parameter Transaction by giving the Tcode as SE37. But i am not able to give my Function module name as default.
    Do you have any idea how to do this.
    Plese help me.
    Thanks
    Manas

    Hello Manas,
    For example in the first line of your FM you write
    call screen 100.
    Then double click on 100 number and you found yourself on program of creating screen.
    Then you write need to describe your pai and pbo functions and set pf-status.
    For example, on the click of some button you execute some function.
    In transaction you directly execute operator call screen 100 by specifying
    SAPLZTEST screen 100.
    One more time: call screen 100 in FM equals call transaction 'zmytcode', which have been created to SAPLZTEST screen 100.
    You can see tcode ckm3 and function group SAPLCKM8N
    Good luck.

  • How to code a predifined function module in sap ,in se37.

    can any one tell me how to code a predifined function module in sap ,in se37.it's an immediate requirement.if u give a brief description it'll do.

    Hi Henry,
    There are two possible ways in which I can interpret your question.
    1. You want to create a new Function Module in SE37. you will have to refer to the <a href="http://help.sap.com/saphelp_47x200/helpdata/en/d1/801e9a454211d189710000e8322d00/frameset.htm">Function Builder</a> tutorial for that.
    2. You want to use an existing function module in your program. In the code of your program in SE38, click the button <i>Pattern</i>. On the pop-up, give the name of the function module that you wish to use in your program.
    Regards,
    Anand Mandalika.

  • How to replace obsolete download function module in ECC6.0?

    Hi Experts,
    How to replace obsolete download function module in ECC6.0?
    Thanks,
    Adi.

    Hi,
    DOWNLOAD is obsolete FM in ECC 6. To get the same functionality , we need to use
    CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG  method (It provides the File selection feature)
    and
    GUI_DOWNLOAD function module.(It downloads the internal table from program to presentation server)
    Please see the example below:
    Example:
    *CALL FUNCTION 'DOWNLOAD'
              EXPORTING
                   FILENAME            = p_filename
                   FILETYPE            = ‘DAT’
              TABLES
                   DATA_TAB            = T_DOWNL
              EXCEPTIONS
                   INVALID_FILESIZE    = 1
                   INVALID_TABLE_WIDTH = 2
                   INVALID_TYPE        = 3
                   NO_BATCH            = 4
                   UNKNOWN_ERROR       = 5
                   OTHERS              = 6.
    *End of deletion CH01-
    Replacement Method for above code:
    DATA: l_filename    TYPE string,
           l_filen       TYPE string,
           l_path        TYPE string,
           l_fullpath    TYPE string,
           l_usr_act     TYPE I.
    l_filename = P_filename.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
      EXPORTING
        DEFAULT_FILE_NAME    = l_filename
      CHANGING
        FILENAME             = l_filen
        PATH                 = l_path
        FULLPATH             = l_fullpath
        USER_ACTION          = l_usr_act
      EXCEPTIONS
        CNTL_ERROR           = 1
        ERROR_NO_GUI         = 2
        NOT_SUPPORTED_BY_GUI = 3
        others               = 4.
    IF sy-subrc = 0
          AND l_usr_act <>
          CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                        = l_fullpath
       FILETYPE                        = 'DAT'
      TABLES
        DATA_TAB                        = T_DOWNL
    EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       GUI_REFUSE_FILETRANSFER         = 3
       INVALID_TYPE                    = 4
       NO_AUTHORITY                    = 5
       UNKNOWN_ERROR                   = 6
       HEADER_NOT_ALLOWED              = 7
       SEPARATOR_NOT_ALLOWED           = 8
       FILESIZE_NOT_ALLOWED            = 9
       HEADER_TOO_LONG                 = 10
       DP_ERROR_CREATE                 = 11
       DP_ERROR_SEND                   = 12
       DP_ERROR_WRITE                  = 13
       UNKNOWN_DP_ERROR                = 14
       ACCESS_DENIED                   = 15
       DP_OUT_OF_MEMORY                = 16
       DISK_FULL                       = 17
       DP_TIMEOUT                      = 18
       FILE_NOT_FOUND                  = 19
       DATAPROVIDER_EXCEPTION          = 20
       CONTROL_FLUSH_ERROR             = 21
       OTHERS                          = 22.

  • How can i use this  function module

    Hai
    How can i use this function module /SAPHT/SALES_ORDER_READ, already apply the some parameters in this function module, but it shows the error , please tell me, how to declare the parameters in this function module ,
    thanks
    neelima

    Hi
    For a particular sales order,you have to pass the order number and the item number in the sales order.
    It will display the rest of the values which u can capture them using internal tables.
    Regards,
    Vishwa.

  • How to create EXCEPTION in function module

    hi experts,
              how to create exeptions in function module i want step by step.
    regards,
    chaitu

    hi,
    Raising Exceptions
    There are two ABAP statements for raising exceptions. They can only be used in function modules:
    RAISE except.
    und
    MESSAGE.....RAISING except.
    The effect of these statements depends on whether the calling program handles the exception or not. The calling program handles an exception If the name of the except exception or OTHERS is specified after the EXCEPTION option of the CALL FUNCTION statement.
    If the calling program does not handle the exception
    ·         The RAISEstatement terminates the program and switches to debugging mode.
    ·         The MESSAGE..... RAISING statement displays the specified message. Processing is continued in relation to the message type.
    If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE..... RAISING statement does not display a message. Instead, it fills the system fields sy-msgid, sy-msgty, sy-msgno , and SY-MSGV1 to SY-MSGV4.
    Source Code of READ_SPFLI_INTO_TABLE
    The entire source code of READ_SPFLI_INTO_TABLE looks like this:
    FUNCTION read_spfli_into_table.
    ""Local Interface:
    *"       IMPORTING
    *"             VALUE(ID) LIKE  SPFLI-CARRID DEFAULT 'LH '
    *"       EXPORTING
    *"             VALUE(ITAB) TYPE  SPFLI_TAB
    *"       EXCEPTIONS
    *"              NOT_FOUND
      SELECT * FROM spfli INTO TABLE itab WHERE carrid = id.
      IF sy-subrc NE 0.
        MESSAGE e007(at) RAISING not_found.
      ENDIF.
    ENDFUNCTION.
    The function module reads all of the data from the database table SPFLI where the key field CARRID is equal to the import parameter ID and places the entries that it finds into the internal table spfli_tab. If it cannot find any entries, the exception NOT_FOUND is triggered with MESSAGE ... RAISING. Otherwise, the table is passed to the caller as an exporting parameter.
    Calling READ_SPFLI_INTO_TABLE
    The following program calls the function module READ_SPFLI_INTO_TABLE:
    REPORT demo_mod_tech_fb_read_spfli.
    PARAMETERS carrier TYPE s_carr_id.
    DATA: jtab TYPE spfli_tab,
          wa   LIKE LINE OF jtab.
    CALL FUNCTION 'READ_SPFLI_INTO_TABLE'
         EXPORTING
              id        = carrier
         IMPORTING
              itab      = jtab
         EXCEPTIONS
              not_found = 1
              OTHERS    = 2.
    CASE sy-subrc.
      WHEN 1.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
      WHEN 2.
        MESSAGE e702(at).
    ENDCASE.
    LOOP AT jtab INTO wa.
      WRITE: /  wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
    ENDLOOP.
    The actual parameters carrier and jtab have the same data types as their corresponding interface parameters in the function module. The exception NOT_FOUND is handled in the program. It displays the same message that the function module would have displayed had it handled the error.
    Hope this is helps,Do reward.

  • How to find Exits in Function Module & BAPI

    Hi,
      How to find exits in Function Module & BAPI.
    Thanks In advance

    Hi,
       i ve  a standard FM IDOC_INPUT_SALESORDER_CREATEFR which creates sales order using BAPI (inbound process).
      Now my requirement is to check for some custom segment field if its not initial i ve to change item category field in line item for sales order.
    could u pls help me in this.
    Thanks in advance.

  • WBS copy via function module "K_PLAN_TO_PLAN_COPY"

    Hi Experts
    anybody please advise whether WBS copy to other via function module "K_PLAN_TO_PLAN_COPY"
    is possible or not in below situation.
    Currently we faced some issue when WBS satus is "TECO", we can not
    copy WBS to another WBS (we want to copy whole wbs into others) by
    function module "K_PLAN_TO_PLAN_COPY".
    So we just change system status from TECO to REL then copy wbs to other,
    however, we could face another issue with this way of copying. (since we
    have to change wbs status, it could cause conflict against other project)
    We want to copy wbs without changing wbs status via function module "K_PLAN_TO_PLAN_COPY".
    Can it be possible? if yes, please advise how to, (settings/conditions/something like that)
    Thank you.
    Satoru

    Hi Satoru,
    The Function Module K_PLAN_TO_PLAN_COPY is not released for customers and therefore it is not intended to be used in customer specific programs or enhancements. For further details, please have a look SAP Note 109533.
    Sorry for not having better news.
    BR,
    Enrique

  • Generic Delta Extraction via Function Module

    Hello,
    i need a help for a generic delta extraction based on a Function Module. As an example i take the function module RSVD_BW_GET_DELTA_DATA.
    My generic delta extractor based on the field AEDAT - Change Date and i will extract purchase service orders and entry sheets.
    In the sample function module the select for the extraction worked with the table ROBWQTSTAT, but this table ist empty after the initialization.
    OPEN CURSOR WITH HOLD G_CURSOR FOR
          SELECT * FROM ROVERCUBE1
                   WHERE COUNTRY IN L_R_COUNTRY AND
                         REGION  IN L_R_REGION AND
                         KUNNR   IN L_R_KUNNR AND
                         TYPE    IN L_R_TYPE AND
                         GJAHR   IN L_R_GJAHR AND
    Here the timerange calculated in form GET_TIME_INTERVAL is evaluated.
                         TSTMP   IN S_R_TSTMP AND
                         OBJVERS = 'A'.
    I found the table ROOSGENDLM. In this table i found the field DELTAID with the last date of the extraction and the field REPEATID with the date for the repead-Update.
    My Questions:
    Is this the right way to build an generic delta extraction with an function module or must i install a coding in my function module for an update of the table ROBWQTSTAT?
    Which settings are needed in the table ROOSOURCE for a generic delta extraction via function module?
    Best regards
    Uwe

    Hi Uwe,
    please have a look at https://weblogs.sdn.sap.com/pub/wlg/2415. [original link is broken] [original link is broken] [original link is broken] It might help
    kind regards
    Siggi
    PS: We already had almost the same question here today.

  • How to create a callback function module

    Hi all,
    I am working in a requirement where we need to call a function module at a 'after change' event. So how to create a callback function module and register it with the crmvevent ?_
    I created a sample function module and try to create entries in table crmv_event_cust, but i got an error message saying that the function module name I provided is not in table CRMC_FUNC_ASSIGN. When I try to create entry there, I got a message that function module is not in CRMC_OBJ_FUNC and that table is a standard table with no maintanance options !!
    looks like i am going in wrong way ... can any one please help ??

    Looking at my system all you need to do is create the entry for the callback function in maint view: CRMV_FUNC_ASSIGN.
    Your entry should be as simple as Z-function name Object Function - <same as others in the segment you are assigning>
    IE for the partner it would be CRM_PARTNER as object function, for general order processing CRM_ORDER
    Take care,
    Stephen

  • How to check for a function module with its description and functionality

    Hi all,
    How to check for a function module,with its description and its functionality,in detail how can I know the purpose of a particular function module,how to search for a function module which suits my requirement .

    Hi,
    You can search a FM of your requirement by putting in the Key words and searching for a FM. Like * KEYWORD * and then pressing F4.
    Say for example you need to search something regarding converstion.
    Search for * CONVERT * and press F4.
    If there is something specfic like converting date to something you can give
    DATE * CONVERT *
    OR
    CONVERT * DATE *  and press F4.
    Once you narrow down your search you will have a Function module documentation inside the Function module. Please note that all the FMs willl not have documentation.
    Regards,
    Pramod

  • How to go into a function module through SE80 t - code

    Hi All , 
                 How to go into a function module through SE80 t - code.
    Thanks in advance.

    >
    Balaji Krishnamoorthy wrote:
    > Hi All , 
    >              How to go into a function module through SE80 t - code.
    >
    > Thanks in advance.
    Hi,
    With  help of  function group
    Thanks & Regards
    Edited by: Always Learner on Oct 16, 2008 2:31 PM

  • How to config Check Digits function module for Student Number Validation

    Hi SLCM Experts,
    In the SAP-SLCM, How to use check digits function module for validate student number.  Just only config it or need to customizing program.
    *Any idea to student number validation in SLCM?*
    Best Regards,
    Suvatchai K.

    Hi ,
    Can you expalin it further ?
    You configure the St. no in piq_matr . And set it  as external or internal no. range which suits your business .
    What is the validation you are looking for ?
    Regards
    Gajalakshmi

  • How to connect our outbound function module to the message type

    how to connect our outbound function module to the message type any transcation code exits to assign the message type with the function module .
    Thank in advance .
    A. Thiru

    Hi Thiru,
    Standard Transaction Codes, have their own Function Modules for generating Outbound/Indbound Idocs. Where these Function Modules will be configured to a particular Process Codes.
    For E.g for PO's
    Process code : ME10 - IDOC_OUTPUT_ORDERS - for creation
    In case if its a Z Function Module, It depends on the case how you use IDOC types. either directly through Z Program or through Inbound/Outbound Process  codes with respective Function modules.
    Regards,
    Anbalagan

Maybe you are looking for