Function module  to determine the credit balance or if there is an open ite

Hi All ,
Can anyone please let me is there any function module  to determine the credit balance orr if there is an open standing request / open standing request /paid but not yet refunded security deposit .
Requirement :
Purpose -This report shows a list of u201Cinactiveu201D contract accounts and the amounts to be refunded (credit balance, paid security deposit) to customers.  This report also shows any open standing requests in customersu2019 contract accounts.
Note:  SAP does not have a concept of u201Cinactiveu201D contract accounts.  All contract accounts are active in SAP.   
We do have customers who pay several months in advance (when they are out of town and donu2019t want to have their services disconnected). 
Logic to retrieve the u201Cinactiveu201D accounts:
The inactive accounts can be identified by the Move-In/Out dunning procedure. If the mov-in/out dunning procedure is not empty, that means this account has moved out and the account is inactive.
Business Logic and Flow
For each contract account
Go through each installation and check if it is disconnected
     If (one is active)
move to the next contract account
else (all is disconnected)
     check to see if there is a credit balance or if there is an open standing request
     If (credit balance)
{Display contract account, customer number and information, and credit balance for refund}
If (open standing request)
{Display contract account, customer number and information, standing request number to be closed}
If (paid but not yet refunded security deposit)
{Display contract account, customer number and information, current balance and security deposit amount}
Thanks in advance
Rahul

Hi Rahul,
To find out the credit balance relating to security deposits you can use BAPI_ACCOUNT_GETBALANCES. On execution of this BAPI with BP and Contract Account Number, it will return the net balance with different segments like open, due, credit and likewise security deposit amount.
To find out if there is any open standing request standing against the customer you can use BAPI_CTRACCONTRACTACCOUNT_GOI. You have to execute this BAPI by providing BP or Contract Account number in Main Selections  table and Main and Sub Transaction of Security Deposit Request transaction in Value Selection table. This BAPI will fetch all open items with the main and sub transactions specified and display.
Thanks
Ganesh

Similar Messages

  • Function module to find the Credit limit of a Customer based on Credit Area

    hi Experts,
                       Is there any function module to find the Credit limit of a Customer based on Credit Area.
    Regards,
    Dheepak

    hi
    try this:
      select single * from KNKK INTO zzKNKK
          where KUNNR = xkunnr and KKBER = xkkber.
    credit limit: zzKNKK-KLIMK...
    regards,darek

  • Function Module to determine the number of pages in a pdf file

    Hi All,
    Is there any standard function module to determine the number of pages in a pdf file?
    Thanks,
    Sai

    Hi unk2,
    There's no functionality in the Acrobat.com online services to do a character count. But, you could use ExportPDF to convert your PDF file to Word format, and then do your character count in Word.
    Please let us know if you need additional assistance.
    Best,
    Sara

  • Function module to determine the date for the nth weekday of the mth month

    Hey folks,
    Is there a function module which determines the date for the mth weekday of the nth month in the pth year.
    For instance, if I input 2nd thursday of the 4th month in 2008, it should return me, 04/10/2008  (MM/DD/YYYY).
    Thanks and Best Regards,
    Puja.

    Hi Ravi,
    Hadn't been able to work on this lately...You solution was quite close, but did not work for a few scenarios....I tweaked the logic a bit to take care of them as well...
    So here goes the code:
    ================================================
      DATA first_day_of_month TYPE datum.
      DATA day TYPE p.
      CONCATENATE year month '01' INTO first_day_of_month.
      CALL FUNCTION 'DAY_IN_WEEK'
        EXPORTING
          datum = first_day_of_month
        IMPORTING
          wotnr = day.
      DATA day_number TYPE numc2.
      IF day = weekday.
        IF recur = 1.
          DATA ls_date(10) TYPE c.
          CONCATENATE month '/01/' year INTO ls_date.
          CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
            EXPORTING
              date_external                  = ls_date
           IMPORTING
             date_internal                  = date.
        ELSE.
          day_number =  ( ( recur - 1 ) * 7 )  + 1.
        ENDIF.
      ELSEIF day < weekday.
        day_number = ( ( recur - 1 ) * 7 ) + ( weekday - day ) + 1.
      ELSE.
        day_number = ( ( recur - 1 ) * 7 ) + ( 7 - day ) + weekday + 1.
      ENDIF.
      IF date IS INITIAL.
        CONCATENATE year month day_number INTO date.
      ENDIF.
    ====================================
    There still could be some loopholes in this....am not sure....but it sure did seem to work for a couple of random checks that I performed.
    Brownie points to you for giving me a direction.
    Thanks,
    Puja.

  • Functional module for determining the sales tax code

    Dear all,
    Kindly help me is there any Functional module to determine the sales tax code?
    My Requirement is Based on the Country, Sales Org and Tax code Pricing should pick up automatically.
    I tried adding the same fields in the table and inserted in the access sequence and created the condition record for the same.
    Created the order but system is not able to get  the Tax code while determining the price?
    Please help ...
    Regards,
    SK

    My Requirement is Based on the Country, Sales Org and
         Tax code Pricing should pick up automatically
    but system is not able to get the Tax code while determining the price?
    Your both the above comments are contradict to each other. In the first statement, you say pricing should pick up automatically whereas, in the next statement, you say tax code is not determining.   Please indicate the requirement clearly.
    thanks
    G. Lakshmipathi

  • Need a functional module to compute the invoice balance

    Hi,
    I need to know if there is a functional module which we can use to compute the invoice balance by deducting the credit notes and the payments.

    This was not answered

  • Function module to find the fiscal periods

    Hi Guys,
    Please let me know if any of you are aware a function module which determines the fiscal periods between two dates.
    (Begin and end dates.) 
    Thanks.

    Hi Sai,
    From your post, I understood that you want to find how many periods are there between two dates, right.
    I am not sure whether there is a direct function module for this.
    But you can try this.
    Use the FM DATE_TO_PERIOD_CONVERT to get the Fiscal Year and Period from a date. You have to input the date and Fiscal variant.
    Using this you can determine the Fiscal year and Period for both the dates.
    Then you can find the difference of these two Fiscal Periods.
    This thread will be helpful for you to find the Difference of two fiscal periods
    Urgent : Difference of two fiscal period
    Hope this helps,
    Regards,
    Hari.

  • Function Module to determine due date in BI form Payment Terms

    Hi to all,
    Can any one tell me what is the Function Module to determine due date in BI, form ZTERM ( Payment Terms ).
    I am working on Accounts Receivable (AR). and need to calculate Due date.
    I shall be thankful to you for this.
    Regards
    Pavneet Rana

    Thanks For reply,
    I have to do aging for Receivables and report format is like that.
                    1 - 10      11 - 30        31 - 60         61 - 90       > 90     Notoverdue   Overdue
    North
    East
    south
    West
    According to client requirement in first 5 bucket i need to display Receivables according to aging
    and for  Notoverdue   Overdue  bucket condition is like that.
    if sy-datum - vbrk-fkdat  > 0NETDUEDATE then it is under Overdue bucket
    if sy-datum - vbrk-fkdat  < 0NETDUEDATE then it is under notOverdue bucket
    there i have created 2 DSO , one for sales which have North,East,south,West and vbrk-fkdat using 2LIS_13_VDHDR,2LIS_13_VDITM
    and other  DSO which will have 0NETDUEDATE from 0FI_AR_4 .
    for Notoverdue   Overdue how i will calculate aging at query level.
    also is 0p_keydt is variable for 0CALDAY which will take user entery and should i applied offcet, to get firts 5 bucket Receivables data for aging.
    i shall be thankful to you for this.
    Regards
    Pavneet Rana

  • Function Module to Determine Split Invoice

    Hi,
    Is there any function module to determine if the delivery orders will result into a split invoice?
    Regards,
    Mawi

    Hi ,
    Look at the following FM.
    FI_INVOICE_SPLIT
    FM_PPA_SPLIT_INVOICE          
    FI_WT_ACI_INVOICE_SPLIT
    FI_WT_INVOICE_SPLIT
    FI_WT_INVOICE_SPLIT_CIFPP
    Thanks
    Shambhu

  • 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'.

  • What is the Function MOdule that returns the fields in database table order

    Hello Folks
      I have a dynamic internal table with fields ( which are not in order). I want to display them in the order of which they are present in the database table? Is there any function module that returns the fields in database order?
    FAQ. Please search before posting your question.
    Edited by: Suhas Saha on Oct 10, 2011 10:19 PM

    Hi,
    You can use this BAPI.
    <b>BAPI_SALESORDER_GETLIST</b>
    Reward if useful.
    Regards,
    Vimal

  • Function Module to know the Acc doc no for a Material document.

    Dear Friends,
    What is the Function Module to know the Acc doc no for a Material document? Please help. Thanks in advance.
    Regards,
    RAMAN

    Hi Raman,
    I am not sure about your requirement,
    But i remember when i required the same like you i went to vrpma table to get the account document,
    I just did like a blind fold,
    as my company does all the billing accounts in the same month, my search criteria was blind.
    Also try with MKPF-XBLNR with the VBRK-XBLNR and get VBRK-VBELN
    from there goto BSEG.
    Thansk & regards,
    Dileep .C

  • CRM function module to update the attribute in the classification TAB of BP

    Hi All,
    Can any body let me know if there is any functionmodule to update the CRM function module to update the attribute in the classification TAB of BP tcode.
    I have searched a lot i get FM to update the marketing attribute and not the attributes in the classification tab.
    Thanks in Advance
    Edited by: Sharath Kumar on Dec 2, 2010 4:48 PM

    For material bom: CSAP_MAT_BOM_CREATE
    and CSAP_ORD_BOM_CREATE for Order BOM.
    Regards,
    Ravi

  • Creation of function module for updating the ztable

    Hi,
    I am sending the requirement for ceation of function module for updating the ztable.
    Requirement----
    Table Updation rule (New record)
    While creating a new record the calling function will export the following to the table handling function.
    Table field     Probable Values
    ZORDERNO------->     Sales Delivery no in case of sales orderShipment no in case of transfer order
    UNAME----
    >     User ID
    ZORDTYPE----
    >     SALEOR in case of sales orderTRANSF in case of transfer order
    ZREFDOCNO----
    >Sales Order no in case of sales orderPurchase Order no in case of transfer order
    ZREFDOCNO1----
    >Delivery no in case of transfer order
    The table handling function will calculate the following fields
    Table field     Probable Values
    ZREQNO----
    >Running serial number (incremented by 1 for each new record)
    ZREQDAT     -
    >System date
    ZREQTIME----
    >     System time
    ZSTATUS----
    >OPEN (for all new records)
    Before inserting a new record the table handling function will always check if a previous record exists for the same order / shipment no. if record exists the function will not insert a new record.
    Table Updation rule (Status Update)
    While updating a record the calling function will export the following to the table handling function.
    Table field     Probable Values
    ZORDERNO----
    >Sales order no in case of sales orderShipment no in case of transfer order
    ZSTATUS----
    >CANCEL if cancellation successfulERROR if cancellation not possible (order already processed)
    The table handling function will calculate the following fields
    Table field     Probable Values
    ZSTATDAT----
    >System date
    ZSTATTIME----
    >     System time

    Do you have to create/update new record in Ztable through Function Module ?
    or you need to write FM only for validation?
    Any how, you need to create a Program with Input values for the fields of Ztable, and for rest of fields the Value can be calculated based on input as per your requirement.
    Let me know clearly what exactly u need ?
    Regards,
    Kiran

  • Function Module that gives the names of the file in the Application Server.

    Hi Experts,
       Please give me a Function Module that gives the names of the file in the Application Server.
    Thanks,
    Debi.

    Hi,
    see these links
    http://help.sap.com/saphelp_nw04/helpdata/en/2a/fa02b7493111d182b70000e829fbfe/content.htm
    http://abaplovers.blogspot.com/2008/05/function-module-sap-logged-in-users-to.html
    http://www.saptechies.com/abap-function-modules/
    http://sap.ittoolbox.com/groups/technical-functional/sap-dev/function-module-to-get-data-and-time-of-file-576751
    thanks
    karthik

Maybe you are looking for