Function module to read the the idoc

Hi abap gurus,
   I have an inbound idoc coming form a wms system .The IDOC is for goods recieved . how can I read the idoc to update the inbound delivery data in the sap system ? Is there any function module to read the data from teh inbound idoc ?

Hi Gaurab,
Creating a Function Module (Direct Inbound Processing)
This step describes how to create a function module which is identified by the IDoc Interface using a new process code and called from ALE (field TBD52-FUNCNAME). Direct inbound processing using a function module (not using a workflow) always includes the ALE layer. This setting (processing with function module and ALE layer) is identified by the value 6 in the field TEDE2-EDIVRS, which is read by the function module IDOC_START_INBOUND. IDOC_START_INBOUND then calls ALE.
Prerequisites
You must have completed the required steps in Defining and Using a Basic Type .
Procedure
Choose Tools ® ABAP Workbench ® Development ® Function Builder, and create a new function module.
Create the segments as global data in your function group. The function module should copy the application data from the segments into the corresponding application tables and modify the IDoc status accordingly. If an error occurs, the function module must set the corresponding workflow parameters for exception handling.
Activate the function module: From the initial screen of the Function Builder select .
In the example, create the function module IDOC_INPUT_TESTER with a global interface. The function module is called when an IDoc of type TESTER01 is received for inbound processing. You will assign an application object ("standard order") to this IDoc type and therefore maintain tables from SD. To do this, call transaction VA01 using the command CALL TRANSACTION. Please note that the intention here is not to simulate a realistic standard order, but only to illustrate how data reaches application tables from an IDoc table via segment structures (form routine READ_IDOC_TESTER) and how the function module triggers an event for exception handling (by returning suitable return variables to the ALE layer in the FORM routine RETURN_VARIABLES_FILL).
A comprehensive example of the code for an inbound function module is provided in the ALE documentation in the SAP Library under  Example Program to Generate an IDoc. This function module, for example, also checks whether the logical message is correct and calls a (fictitious) second function module which first writes the application data and then returns the number of the generated document. In addition, status 53 is only set if the application document was posted correctly.
Administration parameters for IDOC_INPUT_TESTER
Application abbreviation
V (Sales and Distribution)
Processing type
Normal, start immediately
Interface for IDOC_INPUT_TESTER (global interface)
Formal parameters
Reference structure
Explanation
Import parameters
INPUT_METHOD
BDWFAP_PAR-INPUTMETHD
Describes how the function module is to be processed (example: in the background)
MASS_PROCESSING
BDWFAP_PAR-MASS_PROC
Mass inbound processing? (indicator)
Export parameters
WORKFLOW_RESULT
BDWFAP_PAR-RESULT
Set to 99999 if an event is to be triggered for error handling.
APPLICATION_VARIABLE
BDWFAP_PAR-APPL_VAR
Variable freely available from application for workflow
IN_UPDATE_TASK
BDWFAP_PAR-UPDATETASK
Asynchronous update? (indicator is not set in example)
CALL_TRANSACTION_DONE
BDWFAP_PAR-CALLTRANS
Transaction called? (indicator is not set in example)
Table
IDOC_CONTRL
EDIDC
IDoc control record
IDOC_DATA
EDIDD
IDoc data records
IDOC_STATUS
BDIDOCSTAT
IDoc status records for ALE
RETURN_VARIABLES
BDWFRETVAR
IDoc assigned to Object type method parameters.
SERIALIZATION_INFO
BDI_SER
If several IDocs are to be processed in a certain sequence: this structure contains the necessary information
Example
FUNCTION IDOC_INPUT_TESTER.
""Globale Schnittstelle:
*"       IMPORTING
*"             VALUE(INPUT_METHOD) LIKE  BDWFAP_PAR-INPUTMETHD
*"             VALUE(MASS_PROCESSING) LIKE  BDWFAP_PAR-MASS_PROC
*"       EXPORTING
*"             VALUE(WORKFLOW_RESULT) LIKE  BDWFAP_PAR-RESULT
*"             VALUE(APPLICATION_VARIABLE) LIKE  BDWFAP_PAR-APPL_VAR
*"             VALUE(IN_UPDATE_TASK) LIKE  BDWFAP_PAR-UPDATETASK
*"             VALUE(CALL_TRANSACTION_DONE) LIKE  BDWFAP_PAR-CALLTRANS
*"       TABLES
*"              IDOC_CONTRL STRUCTURE  EDIDC OPTIONAL
*"              IDOC_DATA STRUCTURE  EDIDD
*"              IDOC_STATUS STRUCTURE  BDIDOCSTAT
*"              RETURN_VARIABLES STRUCTURE  BDWFRETVAR
*"              SERIALIZATION_INFO STRUCTURE  BDI_SER
initialize SET/GET Parameter and internal tables
  PERFORM INITIALIZE_ORGANIZATIONAL_DATA.
Move IDOC to internal tables of application
  PERFORM READ_IDOC_TESTER.
call transaction Order Entry VA01
  PERFORM CALL_VA01_IDOC_ORDERS USING ERRORCODE.
set status value
  perform write_status_record using errorcode.
return values of function module
  PERFORM RETURN_VARIABLES_FILL USING ERRORCODE.
ENDFUNCTION.
FORM INITIALIZE_ORGANIZATIONAL_DATA.
initialize SET/GET parameters
   SET PARAMETER ID 'VKO' FIELD SPACE.
   SET PARAMETER ID 'VTW' FIELD SPACE.
   SET PARAMETER ID 'SPA' FIELD SPACE.
   SET PARAMETER ID 'VKB' FIELD SPACE.
   SET PARAMETER ID 'VKG' FIELD SPACE.
initialize internal tables
   REFRESH BDCDATA.
   CLEAR BDCDATA.
   CLEAR BELEGNUMMER.
   CLEAR ERRTAB.
   REFRESH ERRTAB.
   REFRESH XBDCMSGCOLL.
   CLEAR XBDCMSGCOLL.
ENDFORM.                    " INITIALIZE_ORGANIZATIONAL_DATA
FORM READ_IDOC_TESTER.
  PERFORM INITIALIZE_IDOC.
LOOP AT IDOC_DATA
   WHERE DOCNUM = IDOC_CONTRL-DOCNUM.
    CASE IDOC_DATA-SEGNAM.
header data
      WHEN 'E1HEAD'.
        MOVE IDOC_DATA-SDATA TO E1HEAD.
        PERFORM PROCESS_SEGMENT_E1HEAD.
position data
      WHEN 'E1ITEM'.
        MOVE IDOC_DATA-SDATA TO E1ITEM.
        PERFORM PROCESS_SEGMENT_E1ITEM.
    ENDCASE.
ENDLOOP.
only when there were one or more items
  CHECK FIRST NE 'X'.
  APPEND XVBAP.                        "last one
ENDFORM.                    " READ_IDOC_TESTER
FORM INITIALIZE_IDOC.
  CLEAR XVBAK.
  REFRESH XVBAP.
  CLEAR XVBAP.
  POSNR = 0.
  FIRST = 'X'.
ENDFORM.                    " INITIALIZE_IDOC
FORM PROCESS_SEGMENT_E1HEAD.
requested date of delivery
  WLDAT = E1HEAD-WLDAT.
delivery date
  XVBAK-BSTDK = E1HEAD-BSTDK.
customer number
  XVBAK-KUNNR = E1HEAD-AUGEB.
order number
  XVBAK-BSTNK = E1HEAD-BELNR.
division
  XVBAK-SPART = E1HEAD-SPART.
distribution channel
  XVBAK-VTWEG = E1HEAD-VTWEG.
sales organization
  XVBAK-VKORG = E1HEAD-VKORG.
order type
  XVBAK-AUART = E1HEAD-AUART.
do not fill incoterms (inco1, inco2)
customer function
  CALL CUSTOMER-FUNCTION '001'
       EXPORTING
            PI_VBAK621           = XVBAK
       IMPORTING
            PE_VBAK621           = XVBAK
       TABLES
            PT_IDOC_DATA_RECORDS = IDOC_DATA.
ENDFORM.                    " PROCESS_SEGMENT_E1HEAD
FORM PROCESS_SEGMENT_E1ITEM.
position number
  XVBAP-POSNR = XVBAP-POSNR + 1.
amount
  XVBAP-WMENG = E1ITEM-MENGE.
unit
  CALL FUNCTION 'ISO_TO_SAP_MEASURE_UNIT_CODE'
       EXPORTING
            ISO_CODE  = E1ITEM-BMEINH
       IMPORTING
            SAP_CODE  = XVBAP-VRKME
       EXCEPTIONS
            OTHERS    = 0.
material number
  XVBAP-MATNR = E1ITEM-LMATNR.
CALL CUSTOMER-FUNCTION '002'
       EXPORTING
            PI_VBAP621           = XVBAP
       IMPORTING
            PE_VBAP621           = XVBAP
       TABLES
            PT_IDOC_DATA_RECORDS = IDOC_DATA.
APPEND XVBAP.
ENDFORM.                    " PROCESS_SEGMENT_E1ITEM
FORM CALL_VA01_IDOC_ORDERS USING ERRORCODE.
call transaction first dynpro
  PERFORM DYNPRO_START.
call transaction double-line entry
  PERFORM DYNPRO_DETAIL2.
incoterms
  PERFORM DYNPRO_HEAD_300.
call transaction item datas
  PERFORM DYNPRO_POSITION.
  PERFORM DYNPRO_SET USING 'BDC_OKCODE' 'SICH'.
determine input method
  IF INPUT_METHOD IS INITIAL.
    INPUT_METHOD = 'N'.
  ENDIF.
call transaction VA01
CALL TRANSACTION 'VA01' USING    BDCDATA
                         MODE     INPUT_METHOD
                         UPDATE   'S'
                         MESSAGES INTO XBDCMSGCOLL.
errorcode = SY-SUBRC.       " remember returncode for status update
ENDFORM.                    " CALL_VA01_IDOC_ORDERS
form write_status_record using errorcode.
FILL IDOC_STATUS
IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
IF ERRORCODE = 0.
IDOC_STATUS-STATUS = BELEG_GEBUCHT. "value 53
   GET PARAMETER ID 'AUN' FIELD BELEGNUMMER.
   IDOC_STATUS-MSGID = 'V1'.
   IDOC_STATUS-MSGNO = '311'.
   IDOC_STATUS-MSGV1 = 'Terminauftrag'.
   IDOC_STATUS-MSGV2 = BELEGNUMMER.
ELSE.
    IDOC_STATUS-STATUS = BELEG_NICHT_GEBUCHT. "value 51
    IDOC_STATUS-MSGID = SY-MSwGID.
    IDOC_STATUS-MSGNO = SY-MSGNO.
    IDOC_STATUS-MSGV1 = SY-MSGV1.
    IDOC_STATUS-MSGV2 = SY-MSGV2.
    IDOC_STATUS-MSGV3 = SY-MSGV3.
    IDOC_STATUS-MSGV4 = SY-MSGV4.
  ENDIF.
  APPEND IDOC_STATUS.
ENDFORM.
FORM DYNPRO_START.
  PERFORM DYNPRO_NEW USING PROGRAMM_AUFTRAG
                           DYNPRO-EINSTIEG
                  CHANGING LAST_DYNPRO.
ordertype
  PERFORM DYNPRO_SET USING 'VBAK-AUART' XVBAK-AUART.
sales organization
  PERFORM DYNPRO_SET USING 'VBAK-VKORG' XVBAK-VKORG.
Distribution channel
  PERFORM DYNPRO_SET USING 'VBAK-VTWEG' XVBAK-VTWEG.
Division
  PERFORM DYNPRO_SET USING 'VBAK-SPART' XVBAK-SPART.
Sales office
  PERFORM DYNPRO_SET USING 'VBAK-VKBUR' XVBAK-VKBUR.
Sales group
  PERFORM DYNPRO_SET USING 'VBAK-VKGRP' XVBAK-VKGRP.
ENDFORM.                    " DYNPRO_START
FORM DYNPRO_NEW USING    PROGNAME
                         DYNPRONR
                CHANGING LAST_DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGNAME.
BDCDATA-DYNPRO  = DYNPRONR.
BDCDATA-DYNBEGIN   = 'X'.
APPEND BDCDATA.
LAST_DYNPRO = DYNPRONR.
ENDFORM.                    " DYNPRO_NEW
FORM DYNPRO_SET USING    FELDNAME
                         FELDINHALT.
  CLEAR BDCDATA.
  CHECK FELDINHALT NE SPACE.
dynpro field name
  BDCDATA-FNAM = FELDNAME.
contents
  BDCDATA-FVAL = FELDINHALT.
  APPEND  BDCDATA.
ENDFORM.                    " DYNPRO_SET
FORM DYNPRO_DETAIL2.
okcode
PERFORM DYNPRO_SET USING 'BDC_OKCODE' PANEL-UER2.
fix dynpro number 4001
  PERFORM DYNPRO_NEW  USING    PROGRAMM_AUFTRAG
                               '4001'
                      CHANGING LAST_DYNPRO.
order party
  PERFORM DYNPRO_SET      USING 'KUAGV-KUNNR'  XVBAK-KUNNR.
purchase order number
  PERFORM DYNPRO_SET      USING 'VBKD-BSTKD'   XVBAK-BSTNK.
requested delivery date
  PERFORM DYNPRO_DATE_SET USING 'VBKD-BSTDK'   XVBAK-BSTDK.
purchase order date
  PERFORM DYNPRO_DATE_SET USING 'RV45A-KETDAT' WLDAT.
ENDFORM.                    " DYNPRO_DETAIL2
FORM DYNPRO_DATE_SET USING    FELDNAME
                              FELDINHALT.
  DATA: DATE TYPE D.
  CLEAR BDCDATA.
  CHECK FELDINHALT NE SPACE.
  BDCDATA-FNAM = FELDNAME.
  WRITE FELDINHALT  TO DATE.
  BDCDATA-FVAL = DATE.
  APPEND  BDCDATA.
ENDFORM.                    " DYNPRO_DATE_SET
FORM DYNPRO_HEAD_300.
  PERFORM DYNPRO_SET USING 'BDC_OKCODE' PANEL-KKAU.
incoterms part 1
  IF NOT XVBAK-INCO1 IS INITIAL.
   PERFORM DYNPRO_SET USING 'VBKD-INCO1' XVBAK-INCO1.
  ENDIF.
incoterms part 2
  IF NOT XVBAK-INCO2 IS INITIAL.
   PERFORM DYNPRO_SET USING 'VBKD-INCO2' XVBAK-INCO2.
  ENDIF.
PERFORM DYNPRO_SET USING 'BDC_OKCODE' 'BACK'.
ENDFORM.                    " DYNPRO_HEAD_300
FORM DYNPRO_POSITION.
  LOOP AT XVBAP.
dynpro item double line entry
  PERFORM DYNPRO_SET USING 'BDC_OKCODE' 'UER2'.
    IF XVBAP-POSNR = 1.
material number
      PERFORM DYNPRO_SET      USING 'VBAP-MATNR(01)'   XVBAP-MATNR.
order quantity
      PERFORM DYNPRO_SET      USING 'RV45A-KWMENG(01)' XVBAP-WMENG.
desired delivery date
      PERFORM DYNPRO_DATE_SET USING 'RV45A-ETDAT(1)'  WLDAT.
sales unit
      PERFORM DYNPRO_SET      USING 'VBAP-VRKME(1)'   XVBAP-VRKME.
    ELSE.
     PERFORM DYNPRO_SET      USING 'BDC_OKCODE'      'POAN'.
material number
      PERFORM DYNPRO_SET      USING 'VBAP-MATNR(02)'    XVBAP-MATNR.
order quantity
      PERFORM DYNPRO_SET      USING 'RV45A-KWMENG(02)'  XVBAP-WMENG.
desired delivery date
      PERFORM DYNPRO_DATE_SET USING 'RV45A-ETDAT(02)'   WLDAT.
sales unit
      PERFORM DYNPRO_SET      USING 'VBAP-VRKME(02)'    XVBAP-VRKME.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " DYNPRO_POSITION
FORM RETURN_VARIABLES_FILL USING ERRORCODE.
allocate IDOC numbers to Workflow output parameters
  IF MASS_PROCESSING <> SPACE.
    IF ERRORCODE = 0.
      RETURN_VARIABLES-WF_PARAM = PID.
      RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
      APPEND RETURN_VARIABLES.
      RETURN_VARIABLES-WF_PARAM = APO.
      RETURN_VARIABLES-DOC_NUMBER = BELEGNUMMER.
      APPEND RETURN_VARIABLES.
      WORKFLOW_RESULT = C_WF_RESULT_OK.
    ELSE.
      RETURN_VARIABLES-WF_PARAM = EID.
      RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
      APPEND RETURN_VARIABLES.
      WORKFLOW_RESULT = C_WF_RESULT_ERROR.
    ENDIF.
  ELSE.
    IF ERRORCODE = 0.
      RETURN_VARIABLES-WF_PARAM = APE.
      RETURN_VARIABLES-DOC_NUMBER = BELEGNUMMER.
      APPEND RETURN_VARIABLES.
      WORKFLOW_RESULT = C_WF_RESULT_OK.
    ELSE.
      WORKFLOW_RESULT = C_WF_RESULT_ERROR.
    ENDIF.
  ENDIF.
ENDFORM.                    " RETURN_VARIABLES_FILL
Globale Daten von IDOC_INPUT_TESTER
TABLES: E1HEAD, E1ITEM.
DATA: BEGIN OF BDCDATA OCCURS 500.
        INCLUDE STRUCTURE BDCDATA.
DATA: END OF BDCDATA.
DATA: BEGIN OF XVBAK.                 "Kopfdaten
     INCLUDE STRUCTURE VBAK621.
DATA: END OF XVBAK.
DATA: BEGIN OF XVBAP OCCURS 50.        "Position
       INCLUDE STRUCTURE VBAP.
DATA:  WMENG(18) TYPE C.
DATA:  LFDAT LIKE VBAP-ABDAT.
DATA:  KSCHL LIKE KOMV-KSCHL.
DATA:  KBTRG(16) TYPE C.
DATA:  KSCHL_NETWR LIKE KOMV-KSCHL.
DATA:  KBTRG_NETWR(16) TYPE C.
DATA:  INCO1 LIKE VBKD-INCO1.
DATA:  INCO2 LIKE VBKD-INCO2.
DATA:  YANTLF(1) TYPE C.
DATA:  PRSDT LIKE VBKD-PRSDT.
DATA:  HPRSFD LIKE TVAP-PRSFD.
DATA: END OF XVBAP.
DATA: BEGIN OF DYNPRO,
      EINSTIEG          LIKE T185V-DYNNR VALUE 101,
      KKAU              LIKE T185V-DYNNR,
      UER2              LIKE T185V-DYNNR,
      KBES              LIKE T185V-DYNNR,
      ERF1              LIKE T185V-DYNNR,
      PBES              LIKE T185V-DYNNR,
      PKAU              LIKE T185V-DYNNR,
      PEIN              LIKE T185V-DYNNR,
      EID1              LIKE T185V-DYNNR,
      POPO              LIKE T185V-DYNNR,
      EIPO              LIKE T185V-DYNNR,
      KPAR              LIKE T185V-DYNNR,
      PSDE              LIKE T185V-DYNNR,
      PPAR              LIKE T185V-DYNNR,
      KDE1              LIKE T185V-DYNNR,
      KDE2              LIKE T185V-DYNNR,
      PDE1              LIKE T185V-DYNNR,
      PDE2              LIKE T185V-DYNNR,
      PKON              LIKE T185V-DYNNR,
      END OF DYNPRO.
DATA: BEGIN OF PANEL,
      KKAU              LIKE T185V-PANEL VALUE 'KKAU',
      UER2              LIKE T185V-PANEL VALUE 'UER2',
      KBES              LIKE T185V-PANEL VALUE 'KBES',
      ERF1              LIKE T185V-PANEL VALUE 'ERF1',
      PBES              LIKE T185V-PANEL VALUE 'PBES',
      PKAU              LIKE T185V-PANEL VALUE 'PKAU',
      PEIN              LIKE T185V-PANEL VALUE 'PEIN',
      EID1              LIKE T185V-PANEL VALUE 'EID1',
      EIAN              LIKE T185V-PANEL VALUE 'EIAN',
      POPO              LIKE T185V-PANEL VALUE 'POPO',
      EIPO              LIKE T185V-PANEL VALUE 'EIPO',
      KPAR              LIKE T185V-PANEL VALUE 'KPAR',
      PSDE              LIKE T185V-PANEL VALUE 'PSDE',
      POAN              LIKE T185V-PANEL VALUE 'POAN',
      PPAR              LIKE T185V-PANEL VALUE 'PPAR',
      KDE1              LIKE T185V-PANEL VALUE 'KDE1',
      KDE2              LIKE T185V-PANEL VALUE 'KDE2',
      PDE1              LIKE T185V-PANEL VALUE 'PDE1',
      PDE2              LIKE T185V-PANEL VALUE 'PDE2',
      PKON              LIKE T185V-PANEL VALUE 'PKON',
      KOAN              LIKE T185V-PANEL VALUE 'KOAN',
      END OF PANEL.
DATA: BEGIN OF ERRTAB OCCURS 20,
       TRANS  LIKE TSTC-TCODE,
       ARBGB  LIKE T100-ARBGB,
       CLASS(1) TYPE C,
       MSGNR LIKE T100-MSGNR,
     TEXT LIKE T100-TEXT,
       TEXT(123) TYPE C,
       MSGV1 LIKE SY-MSGV1,
       MSGV2 LIKE SY-MSGV2,
       MSGV3 LIKE SY-MSGV3,
       MSGV4 LIKE SY-MSGV4,
      END OF ERRTAB.
*---- Hilfsfelder     -
DATA: PROGRAMM_AUFTRAG LIKE T185V-AGIDV VALUE 'SAPMV45A'.
DATA: LAST_DYNPRO      LIKE T185V-DYNNR,
      WLDAT            LIKE VBAK-BSTDK,
      POSNR            LIKE VBAP-POSNR,
      FIRST(1)         TYPE C VALUE 'X'.
DATA: BEGIN OF XBDCMSGCOLL OCCURS 10.
        INCLUDE STRUCTURE BDCMSGCOLL.
DATA: END OF XBDCMSGCOLL.
Terminauftrag  ( Auftragsart wird fest gesetzt !)
DATA:   BELEGNUMMER LIKE VBAK-VBELN.
DATA:   ERRORCODE LIKE SY-SUBRC.
Statuswerte fuer IDOC-Status
DATA:   BELEG_NICHT_GEBUCHT LIKE TEDS1-STATUS VALUE '51'.
DATA:   BELEG_GEBUCHT       LIKE TEDS1-STATUS VALUE '53'.
*- Direktwerte für Return_variables -
data:
    eid like bdwfretvar-wf_param value 'Error_IDOCs',
    pid like bdwfretvar-wf_param value 'Processed_IDOCs',
    apo like bdwfretvar-wf_param value 'Appl_Objects',
    ape like bdwfretvar-wf_param value 'Appl_Object'.
*- Direktwerte für Workflow_Result -
DATA: C_WF_RESULT_ERROR LIKE BDWFAP_PAR-RESULT VALUE '99999'.
thanks
karthik
DATA: C_WF_RESULT_OK    LIKE BDWFAP_PAR-RESULT VALUE '0'.

Similar Messages

  • Any function module to read all the values in Tcode-PPQD?

    Hi all
    Is there any function module to read all the values in Tcode-PPQD (Display Qualifiaction Catalog).
    and any idea what tables are involved to get these values like parent and child relationship?
    Thanks in advance.
    Murali.

    Murali,
    you can use the following..
    data: w_sobid type sobid, "Qualification ID
          w_objid type objid. "Qualification Catalog
    select objid  into w_objid
                  up to 1 rows
                  from HRP1001
                 where otype = 'QK'
                   and plvar = '01'
                   and istat = 1
                   and risgn = 'B'
                   and relat = '030'
                   and endda ge sy-datum
                   and begda le sy-datum
                   and sclas = 'Q'
                   and sobid = w_sobid.
    endselect.
    if sy-subrc eq 0.
    write: / w_objid,w_sobid.
    endif.
    Regards,
    Suresh Datti

  • Function module to read all the views of material data

    Dear all ,
           Is there any function module to read all the views of material data ?
           Like we have MATERIAL_MAINTAIN_DARK for updating all the views of material data , I need a function module to read all the views of material master.
    Thanks & Regards
    Shivanand

    Hello,
    Check these BAPI'S
    <b>BAPI_MATERIAL_DISPLAY          Display Material
    BAPI_MATERIAL_GET_DETAIL       Determine Details for a Material</b>
    Regards,
    Vasanth

  • Function Module To read all the Files in a Given UNIX directory.

    Can anyone provide me with a FUNCTION MODULE which reads all the files available in a UNIX directory?
    I have the UNIX directory given. I need to find all the files available in that particular Directory so that I can choose and process accordingly. Probably I can store all files in an Internal Table.
    Thanks in advance.
    Sunil

    Hi Nick,
    Thankyou very much for the response.
    The Function Module /SAPDMC/LSM_F4_SERVER_FILE is interactive wherein we can select only one file.
    But my requirement is I need to collect (probably in an internal table) all the files exixting in the given UNIX directory.
    Can you please find in that direction. I would be very grateful.
    Thanks.
    Sunil

  • Function module to read the directory list and also run in background

    Hi All,
    I need to read few files from a folder in the server and upload the data in the file using a BDC. This process has to happen in the background as I am going to schedule the program. I had used the function module "EPS_GET_DIRECTORY_LISTING" to list the file names, it is working properly but when I schedule the program this function module does not work, the jobs gets finished in 0 secs. I am suspecting that it is not running in back ground. Can any one suggest me the function module which runs in background to read the files or an alternate method.
    Ajeetha

    Thanks for the reply.
    Sorry, this function module is working properly, why I assumed it is not working is that the background job got completed in 0 secs which made me feel that the function module is not working. Also I am subsequently copying the file to another folder and deleting it from the source folder, actually thiese two functionalities are not working in background. which added to my conclusion that all the function modules are not working in background. I am using two methods to copy and delete files, they are
    CL_GUI_FRONTEND_SERVICES=>FILE_COPY,
    CL_GUI_FRONTEND_SERVICES=>FILE_DELETE.
    as these are not working in background, now I need to replace them with a method or function module which will run in background.
    As I have mentioned earlier, my main objective is to upload the data in the file using a bdc. If I am not able to delete the file in the source folder,  then duplicate upload will happen which I have to avoid. So, if someone could help me to find a way to delete the file will be of great help to me.
    Ajeetha

  • Function module to read the expired useful life of asset

    Hi,
    Is there a function module to read the expired useful life of asset. We are using the depriciation start date to calculate the expired useful life of asset, but the fiscal year shift and matching the calendar year with fiscal is causing the logic to give a month difference between the calculated value and the value in the asset.
    Please let me know if there is a Function module or BAPI for getting the values. Kindly provide example for the function module call too.
    Regards,
    Prabaharan.G

    Hi,
      Check the following function modules.
    AISC_CALC_EXPIRED_USEFUL_LIFE.
    Check the following link it might be of some help to you.
    Re: asset useful life
    Regards,
    Ram.

  • Can anybody send the function module to read inspection characteristics ?

    Hi friends
    can anybody send the function module to read inspection characteristics ?
    (rate routings).
    thanks in advance

    Hi,
    Use the BAPI,
    <b>BAPI_INSPCHAR_GETRESULT</b> to get the deatils.
    also look at this BAPI <b>BAPI_INSPOPER_GETCHAR</b>
    Regards
    Sudheer
    Message was edited by:
            Sudheer Junnuthula

  • Function module that can give the last value or the highest value of a key

    hi,
    Is there any function module that can give the last value or the highest value of a key feild in a z table.
    regards,
    johnson

    Hi ,
    We have  aggregate functions in SQL. Some of the functions are as follows.
    MAX(col ) Determines the maximum value of the value in the column col in the resulting set or in the current group.
    MIN( col ) Determines the minimum value of the content of the column col in the resulting set or in the current group.
    AVG(  col ) Determines the average value of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
    SUM( col ) Determines the sum of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
    COUNT( col ) Determines the number of different values in the column col in the resulting set or in the current group.
    For further details , type the function name name and press F1 for further help.
    Eg: select count(mantr) from mara into workarea where condition.
    Reward points if helpful.
    Thanks and Regards.

  • Function module names to delete the Export Datasource

    Hi Experts,
    Can anyone please let me know what function modules are while deleting the export datasource. So far in my research i have found only
    RSB1_DELETE_EXPORT_DATASOURCE. -- This fm does not deletes the export datasource, I want to know which fm is used exactly to delete the datasources.
    To delete the virtual infocubes, the fm used is RSDG_CUBE_DELETE. Similarly there must be a fm to delete the export datasource.
    Please help.
    Thanks,
    Prashant.

    Hi Reddy,
             I hope there is no specific function module to delete the entries ( as of version 4.0). So you need to code a delete statement to perform the task.
    Thanks,
    Siva.

  • Function Module to find out the release value in contract

    Dear All,
    I have to upload the contract with new accoutn assignment without changing the existing contract. For that i have to download all the existing contract data with value.
    In that case i have some issues regarding the value.
    For example : In the system old contract is created with value 1000 and the released value as 500.
    In that case i have to uload the new contract with all the details of existing contract with value of 500 (1000-500=500).
    How can i get the value (500) and from which table.Is there any functional module to find out the release value in contract.
    Thanks and regads,
    PM
    Edited by: PM on Jan 21, 2010 8:40 AM
    Edited by: PM on Jan 22, 2010 9:48 AM

    Hi
    You need to link the table VBFA and VBAK.
    For a contract you can check all the subsequent document (which you can filter whether you want to see Order / delivery / Billing) in VBFA and then from there pick the subsequent document no. and then from VBAK you can pick the Net value of these subsequent documents, and so you will have both the values (value of Contract and value in subsequent document) and you can determine the balance value.
    Regards
    Amitesh Anand

  • Function Module for calculation of the net price of a configurable material

    Hi,
    I would like to know if a function module allows to calculate the purchasing /net price of a configurable material at a vendor and at a requested delivery date before the creation of a purchasing order.
    For configurable materials, we have no PIR and no moving / standard price thus the valuation price in the PR is blank.
    I would like to fill in the field "valuation price" in the PR with the net price we can find in the PO.
    However the PR is created before the PO.
    Thanks a lot in advance for yours reply.
    regards,

    hi Pravenn,
    I don't know about these functions, but u can try anything like this:
    data:
    strdate like sy-datum value '20070901',
          enddate like sy-datum value '20070909',
          date(10),
          moddate(1).
    date = enddate - strdate + 1.
    moddate = date mod 7.
    date = date div 7.
    if moddate <> 0.
      date = date + 1.
    endif.
    write: / date.
    Regards
    Allan Cristian
    Message was edited by:
            Allan Cristian

  • Function module to retrieve all the personnel numbers in the eval path

    Hi all,
    I want to retrieve all the personnel numbers that fall in the evaluation path.
    Like if my evaluation path is "B002" ( eval path for relationship is line supervisor of ), I want a function module that retrieves all the pernrs in this wval path up to the bottom level.
    if A reports to B and B reports to C and C reports to D . I want a function module to retrieve(either positions or pernrs) C, B and A when I run it for position D.
    any help??
    regards
    Sam
    regards
    Sam

    Hi
    U can use FM  RH_STRUC_GET to get the pernr in the evaluation path
    data : IT_RESULT_TAB     TYPE STANDARD TABLE OF SWHACTOR .
                CALL FUNCTION 'RH_STRUC_GET'
                  EXPORTING
                    ACT_OTYPE  = C_OTYPE
                    ACT_OBJID  = W_POSIT
                    ACT_WEGID  = C_WEGID (relation B002 like )
                    ACT_BEGDA  = W_BEGDA
                    ACT_ENDDA  = W_BEGDA
                   ACT_TDEPTH = 1 ( depath 1, 2, etc )
                  TABLES
                    RESULT_TAB = IT_RESULT_TAB .
    Nb : Give points if it worths

  • Function module which could calculate the previous month's start date.....

    hi,
    I want a function module which could calculate the previous month's start date and end date...
    Say todays date is  like 29.05.2007(start date) it should return
    01.04.2007 and 30.04.2007...
    IS there any FM for this ... or how to go about this scenario ???
    thanks in advance
    samm

    See the below Logic :
    DATA :g_date(2) TYPE n,           " Date
          g_month(2) TYPE n,          " Month
          g_year(4) TYPE n ,          " Year
          g_bill_low(10) TYPE n,       " From date
          g_bill_high(10) TYPE n,      " To date
          g_month1(2) TYPE n,         " Month
          g_year1(4) TYPE n,          " Year
          g_date1(2) TYPE n,          " Date
          g_year2(4) TYPE n,          " Year
          g_datum LIKE sy-datum.      " System date
    RANGES : r_bdate  FOR vbrk-fkdat.             " Billing date
      g_datum = p_date + 10.
      g_month = g_datum+4(2).
      g_year = g_datum+0(4).
      IF g_month = 1.
        g_year = g_year - 1.
        g_month = 12.
        g_date = 1.
      ELSE.
        g_month = g_month - 1.
        g_date = 1.
      ENDIF.
    Passing the date to billing date-low
      CONCATENATE  g_year g_month g_date  INTO g_bill_low.
      r_bdate-low = g_bill_low.
      r_bdate-sign = 'I'.
      r_bdate-option = 'BT'.
      g_month1 = g_datum+4(2).
      g_year1 = g_datum+0(4).
      IF g_month1 = 1.
        g_year1 = g_year1 - 1.
        g_month1 = 12.
      ELSE.
        g_month1 = g_month1 - 1.
      ENDIF.
      CASE g_month1.
        WHEN 1.g_date1 = '31'.
        WHEN 3.g_date1 = '31'.
        WHEN 4.g_date1 = '30'.
        WHEN 5.g_date1 =  '31'.
        WHEN 6.g_date1 = '30'.
        WHEN 7.g_date1 = '31'.
        WHEN 8.g_date1 = '31'.
        WHEN 9.g_date1 = '30'.
        WHEN 10.g_date1 = '31'.
        WHEN 11.g_date1 = '30'.
        WHEN 12.g_date1 = '31'.
      ENDCASE.
      g_year2 = g_year1.
      IF g_month1 = 2.
        g_year2 = g_year2 MOD 4 .
        IF g_year2 = 0.
          g_date1 = 29.
        ELSE.
          g_date1 = 28.
        ENDIF.
      ENDIF.
    Passing the date to billing date-high
      CONCATENATE  g_year1  g_month1  g_date1 INTO g_bill_high.
      r_bdate-high = g_bill_high.
      APPEND r_bdate.
    Reward Points if it is helpful
    Thanks
    Seshu

  • Function Module required to convert the date coming from external system

    Hi Friends,
       I need a Function Module that would convert the incoming date from external sytem in format YYYYMMDD to the SAP system in DDMMYYYY. The External system data type for the date is Numberic. Please suggest any FM if you know.I found out many in SAP but didn't find for this requirement

    Wait a minute.  I am definetely missing something here.  You want to convert from an external format YYYYMMDD to SAP's internal format?  SAP's internal format is YYYYMMDD.
    All you should have to do is move you external date directly to your internal date.
    data: date1(8) type c value '20051225'. "Format YYYYMMDD
    data: date2 type sy-datum. "Format (YYYYMMDD)
    write: / date2.
    When you write out date2 it will be in whatever format your user profile has. 
    If you want to force the date format independent of your user profile settings during the write statement:
    write: / date2 DDMMYY.
    Message was edited by: Thomas Jung

  • Unable to create rule Error:Function Module does not meet the workflow conv

    Hi Workflow experts,
    Could any one help me with rule creation. Below is my Function Module Interface.
    ""Local Interface:
    *"  TABLES
    *"      AC_CONTAINER STRUCTURE  SWCONT OPTIONAL
    *"      ACTOR_TAB STRUCTURE  SWHACTOR OPTIONAL
    *"  EXCEPTIONS
    *"      NOBODY_FOUND
    The function module test is successful with all required conventions for workflow but while i try to create a rule with the funtion module i get the error "Function Module does not meet the workflow conventions"
    I Also have included the following in FM
    INCLUDE <cntn01>.
    Any suggestions would be helpful. Thanks in Advance,
    Imran

    Hi,
    I am not sure whether the rule accepts the optional flag. Remove the optional flag for the tables parameters and try again. According to the documentation you have implemented the right interface. It might be the issue with the tables parameter being optional.
    Hope this helps,
    Sudhi

Maybe you are looking for

  • Were I can get PGI data

    Dear Guru, I want to no from which table I can get the data of Pick Qty. When I go to VL02N Pick Qty, their I can find Structure : -  LIPSD Feild : -  PIKMG. But when I am searching in PIKGM I am not getting any data. So, will u help me to get the ta

  • I have lost my iphone4s and I would like to recovery my photos that do not share, it is possible?

    Hi, I have stollen and I would like to recovery my photos, but I think that they are not share, it is possible? That pictures are not from my backup, they were took before a backup

  • The SQL query is not executing

    Hi I have the following situation: In a project we designed our reports calling a stored procedure the exits in a MS SQL Server 200 database. The Stored Procedures works fine and when they are used in the report everything works perfectly. The report

  • I am having a issue  with my Adobe Muse cloud subscription?

    Hi, I purchased a Adobe Muse cloud subscription and when I open it up on my windows computer it keeps asking me to license my software; and that my trial period is up. How can I fix this? Best, Isaiah

  • I cannot play .avi movies in iMovie - any advice?

    Hi, I cannot play or import any of my .avi movies from my camera to imovie. I can play them in iPhoto and using Quicktime, is there any way I can edit them using iMovie? My digital camera only records in .avi. Can anyone help