Invoice Upload Program in FB50

Hi Experts,
   I need to develop an invoice upload program for transaction code FB50. The data will be from an Excel file.
   As I'm new to program in accounting, is there anyone has sample code?
   I'm not sure what function module to use to save the invoice.
   Hope someone can help me. Many thanks in advance.

Hi Sam,
     It generally depends on what sort of postings you are doing.
You can refer to following code, it is for the posting of invoices.
    Document Header
           wa_document_header-comp_code  = c_company_2001.
    One time vendor
     Concatenate the text and account number and pass it as a line item text
     Check for the Payee name and use vendor number accordingly
     Check if amount value is more than '0'
     Vendor line item
     GL Account line item
     Get currency details for vendor line item
     Get currency details for GL Account line item
     Pass suitable posting key
     Pass suitable posting key
             When posting amount is less than zero
     Vendor line item
     Get currency details for vendor line item
     Get currency details for GL Account line item
     GL Account line item
     Pass suitable posting key
     Pass suitable posting key
     Check if one time vendor data is available
     Call the BAPI 'BAPI_ACC_DOCUMENT_POST' to create the invoices
      Check if bapi return table is intial
     Maintain a error log with all BAPI returned messages
     Get only error\abort messages into error table
     check if flag has been enabled
     Check for the message type in the return table and
     if it is success then commit the transaction.
     Concatenate the message text and refund id into a variable
     append success messge to the error table
     Refresh the internal tables
     Clear the work areas and variables
         LOOP AT it_record INTO wa_record.
              wa_document_header-username   = sy-uname.
              wa_document_header-comp_code  = v_compcode.
              wa_document_header-doc_date   = wa_record-bkpf_bldat.
              wa_document_header-pstng_date = sy-datum.
              wa_document_header-doc_type   = v_doctype.
              wa_document_header-ref_doc_no = wa_record-bkpf_xblnr.
              wa_customercpd-name       = wa_record-bsec_name1.
              wa_customercpd-name_2     = wa_record-bsec_name2.
              wa_customercpd-postl_code = wa_record-bsec_pstlz.
              wa_customercpd-city       = wa_record-bsec_ort01.
              wa_customercpd-country    = v_country.
              wa_customercpd-street     = wa_record-bsec_stras.
              wa_customercpd-tax_no_1   = wa_record-bsec_stcd1.
              wa_customercpd-tax_no_2   = wa_record-bsec_stcd2.
              wa_customercpd-region     = wa_record-bsec_regio.
              CONCATENATE text-008 wa_record-bseg_sgtxt INTO v_item_text              " Refund for Acc no
                                                        SEPARATED BY space.
              IF wa_record-bsec_name1 = c_name_heap.
                v_vendor_no = v_vendor_heap.
              ELSE.
                v_vendor_no = v_vendor_onetime.
              ENDIF.
              IF wa_record-bseg_wrbtr GT 0.
                wa_acc_payable-itemno_acc = c_itemno_1.
                wa_acc_payable-vendor_no  = v_vendor_no.
                wa_acc_payable-item_text  = v_item_text.
                APPEND wa_acc_payable TO it_acc_payable.
                CLEAR: wa_acc_payable.
                wa_accountgl-itemno_acc = c_itemno_2.
                wa_accountgl-gl_account = v_glaccount.
                wa_accountgl-item_text  = v_item_text.
                APPEND wa_accountgl TO it_accountgl.
                CLEAR: wa_accountgl.
                wa_currency_amount-itemno_acc  = c_itemno_1.
                wa_currency_amount-currency    = c_currency_usd .
                wa_currency_amount-amt_doccur  = - ( wa_record-bseg_wrbtr ).
                APPEND wa_currency_amount TO it_currency_amount.
                CLEAR: wa_currency_amount.
                wa_currency_amount-itemno_acc  = c_itemno_2.
                wa_currency_amount-currency    = c_currency_usd .
                wa_currency_amount-amt_doccur  = wa_record-bseg_wrbtr.
                APPEND wa_currency_amount TO it_currency_amount.
                CLEAR: wa_currency_amount.
                wa_extension2-structure   = c_structure.
                wa_extension2-valuepart1  = c_itemno_1.
                wa_extension2-valuepart2  = c_newbs_31.          " Credit indicator( Vendor side )
                APPEND wa_extension2 TO it_extension2.
                CLEAR: wa_extension2.
                wa_extension2-structure   = c_structure.
                wa_extension2-valuepart1  = c_itemno_2.
                wa_extension2-valuepart2  = c_newbs_40.          " Debit indicator( GL Account side )
                APPEND wa_extension2 TO it_extension2.
                CLEAR: wa_extension2.
              ELSE.
                wa_acc_payable-itemno_acc = c_itemno_1.
                wa_acc_payable-vendor_no  = v_vendor_no.
                wa_acc_payable-item_text  = v_item_text.
                APPEND wa_acc_payable TO it_acc_payable.
                CLEAR: wa_acc_payable.
                wa_currency_amount-itemno_acc  = c_itemno_1.
                wa_currency_amount-currency    = c_currency_usd .
                wa_currency_amount-amt_doccur  = wa_record-bseg_wrbtr.
                APPEND wa_currency_amount TO it_currency_amount.
                CLEAR: wa_currency_amount.
                wa_currency_amount-itemno_acc  = c_itemno_2.
                wa_currency_amount-currency    = c_currency_usd .
                wa_currency_amount-amt_doccur  = - ( wa_record-bseg_wrbtr ).
                APPEND wa_currency_amount TO it_currency_amount.
                CLEAR: wa_currency_amount.
                wa_accountgl-itemno_acc = c_itemno_2.
                wa_accountgl-gl_account = v_glaccount.
                wa_accountgl-item_text  = v_item_text.
                APPEND wa_accountgl TO it_accountgl.
                CLEAR: wa_accountgl.
                wa_extension2-structure   = c_structure.
                wa_extension2-valuepart1  = c_itemno_1.
                wa_extension2-valuepart2  = c_newbs_21.          " Debit indicator( Vendor side )
                APPEND wa_extension2 TO it_extension2.
                CLEAR: wa_extension2.
                wa_extension2-structure   = c_structure.
                wa_extension2-valuepart1  = c_itemno_2.
                wa_extension2-valuepart2  = c_newbs_50.          " Credit indicator( GL Account side )
                APPEND wa_extension2 TO it_extension2.
                CLEAR: wa_extension2.
              ENDIF.
              IF wa_customercpd IS NOT INITIAL.
                CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
                  EXPORTING
                    documentheader = wa_document_header
                    customercpd    = wa_customercpd
                  TABLES
                    accountgl      = it_accountgl
                    accountpayable = it_acc_payable
                    currencyamount = it_currency_amount
                    return         = it_return
                    extension2     = it_extension2.
                IF it_return IS NOT INITIAL.
                  LOOP AT it_return INTO wa_return WHERE type = c_msgtype_e OR
                                                         type = c_msgtype_a.
                    CONCATENATE wa_return-message text-013 wa_record-bkpf_xblnr INTO v_msg_text
                                                           SEPARATED BY space.
                    MOVE v_msg_text TO wa_return-message.
                    APPEND wa_return TO it_error.
                    CLEAR: wa_return,
                           v_msg_text.
                    f_error_ind = c_true.
                  ENDLOOP.
                  IF f_error_ind EQ c_true.
                    EXIT.
                  ELSE.
                    DESCRIBE TABLE it_return LINES v_tabix.
                    READ TABLE it_return INDEX v_tabix INTO wa_return.
                    IF sy-subrc = 0.
                      v_total_amount = ABS( wa_record-bseg_wrbtr ) + v_total_amount.    " Total posting amount
                      CONCATENATE wa_return-message text-013 wa_record-bkpf_xblnr INTO v_msg_text
                                                             SEPARATED BY space.
                      MOVE v_msg_text TO wa_return-message.
                      APPEND wa_return TO it_success.
                      CLEAR: wa_return,
                             v_msg_text,
                             v_tabix.
                    ENDIF.
                  ENDIF.
                ENDIF.
              ELSE.
                wa_return-type     = c_msgtype_e.
                wa_return-message  = text-009.                   " One time vendor details are not found
                APPEND wa_return TO it_error.
                CLEAR: wa_return.
                EXIT.
              ENDIF.
              REFRESH: it_return,
                       it_acc_payable,
                       it_currency_amount,
                       it_accountgl,
                       it_extension2.
              CLEAR: wa_document_header,
                     wa_customercpd,
                     wa_record,
                     v_vendor_no,
                     v_item_text.
            ENDLOOP.
Sam, before making the postings directly, try using 'BAPI_ACC_DOCUMENT_CHECK' so that
you will get to mo
I hope, it will be helpful to you.
If you want any more help, get back to me.
Regards,
Jallu

Similar Messages

  • Fail safe logic needed for purchase order upload program

    Hello all,
    i am working on creating PO's by reading data from a text file. I need to implement fail safe logic in it, which is to make sure this program uploads all the records in the text file successfully. For example, i have 1000 records in my text file and while running the upload program if the program times out while creating the 500th PO or if SAP is down at that time, then we have 499 PO's created and 501 yet to be created. But if we run the same program again, we will generate duplicate PO's for 499 again. I want to avoid this kind of problem.
    How do i implement this idea?
    Kindly guide me on this.
    Thanks.

    Ok ..
    Then I would suggest you use Application Log to keep the success and error messages of PO processing.
    You can check trsnaction SLG0 and create your own application log object.
    Then you need to use FMs BAL_LOG_* to crate and add messages to it.
    This way you will have a facility to check as which of your records are converted to PO for a run.
    In case SAP gets down in between , still you can find the details using Xn SLG1 and then accordingly remove the records from your file which are already converted to PO.
    Thanks,
    Ram

  • Existing Function modules or Standard upload Programs

    Hi,
    Can any one tell, Are there any Function modules or Standard upload programs exists for following transactions:
    Creating production version(C223)
    Creating Master recipe(C201)
    Creation Apportionment Structure(C202)
    Creation BOM Allocation(CS08)
    (This all tcodes comes under Production planning.)
    Thanks in advance.

    Hi Vanitha,
    Check this
    for C223
    CM_FV_PROD_VERS_MAINTAIN
    CM_FV_PROD_VERS_SAVE
    CM_FV_PROD_VERS_SAVE_ALL
    CY01_ORDER_MODIFY_PROD_VERSION
    For C201
    C2_CU_RECIPE_EXCLUDE_CREATE
    CONTROL_RECIPE_CREATE
    For C202
    APPOINTMENT_GRP_CREATE
    APPOINTMENT_CREATE
    APPOINTMENT_GENERATE
    APPOINTMENT_GENERATE_2
    For CS08
    CSAP_MAT_BOM_ALLOC_CREATE
    Hope it helps...
    Lokesh
    pls. reward appropriate points
    Message was edited by: Lokesh Aggarwal

  • Invoice validation program error:Could not find operating unit options

    Dear Team,
    Once my Payables Open Interface Import program successfully completed, I am trying to running invoice validation program which is ended with warning as bellow,
    (Bulk CALCULATE) START SYSDATE 17-DEC-2012 04:04:19
    Could not find operating unit options
    Encountered unexpected error: User-Defined Exception
    (Bulk CALCULATE) END SYSDATE 17-DEC-2012 04:04:23
    and invoice placing into Dist Variance hold,
    my interface program placed data in to based tables (ap_invoices_all and lines_all ) but distributions are not getting generating. Can you please do help me.
    Find attached excel sheet for ur references.
    Thanks
    Sathiya

    Make sure the library (pll file) is in the path indicated by your FORMS60_PATH in the registry.
    Hope that helps,
    Karim.

  • Error in AR - Auto Invoice Import Program

    Hi,
    Please help me out for AR - Auto Invoice Import Program.
    When i am running Auto Invoice Import Program in UAT instance then its getting completed but with error and error is not reflecting in RA_INTERFACE_ERRORS_ALL table.
    Initially when i ran Interface Program in CRP instance then the program was successfull, but in UAT instance it is giving error,
    The Log is as follows, Its a big log but to get an idea please find the few starting lines of the same.
    Regards,
    Sitesh
    org parameter (raamai) = ~91~
    raassc()+ Current system time is 02-APR-2012 01:42:57
    org parameter (raassc) character = ~91~
    org parameter (raassc) numeric = ~91~
    raassc()- Current system time is 02-APR-2012 01:42:57
    raagsp()+ Current system time is 02-APR-2012 01:42:57
    raagsp()- Current system time is 02-APR-2012 01:42:57
    raaini()+ Current system time is 02-APR-2012 01:42:57
    raaapx()+ Current system time is 02-APR-2012 01:42:57
    raaapx()- Current system time is 02-APR-2012 01:42:57
    raagbo()+ Current system time is 02-APR-2012 01:42:57
    Dumping data fetched from RA_BATCH_SOURCES
    batch_source_id = 1141
    batch_source_name = Export Entry
    auto_trx_numbering_flag = N
    copy_doc_number_flag = N
    cust_trx_type_rule = I
    sold_customer_rule = R
    bill_customer_rule = R
    bill_address_rule = R
    bill_contact_rule = N
    ship_customer_rule = R
    ship_address_rule = R
    ship_contact_rule = N
    memo_reason_rule = R
    term_rule = I
    invoicing_rule_rule = R
    accounting_rule_rule = R
    unit_of_measure_rule = R
    agreement_rule = R
    inventory_item_rule = R
    fob_point_rule = S
    ship_via_rule = S
    invalid_lines_rule = R
    salesperson_rule = I
    sales_credit_type_rule = I
    accounting_flexfield_rule = R
    invalid_tax_rate_rule = R
    rev_acc_allocation_rule = P
    gl_date_period_rule = R
    create_clearing_flag = N
    derive_date_flag = Y
    sales_credit_rule = P
    sales_territory_rule = R
    receipt_method_rule = R
    customer_bank_account_rule = R
    related_document_rule = R
    memo_line_rule = R
    allow_sales_credit_flag = Y
    receipt_handling_option = N
    allow_duplicate_trx_num_flag = N
    raagbo()- Current system time is 02-APR-2012 01:42:57
    raaggi()+ Current system time is 02-APR-2012 01:42:57
    raagixpfx = 0
    raagixtpf = 0
    raagixddf = 1
    raagixacf = 0
    raagixagd = 0
    raagixatn = 0
    raagixadn = 0
    raagixcte = 0
    raagixdfd =
    raagixctc = 1683960112
    raagixrmx = T
    raagixfdx = 02-APR-12
    raagixbix =
    raagixbsi = 1141
    raagixbnx = Export Entry
    raagixoix = 91
    raagixrix = 3584119
    raagixpix = 20428
    raagixpai = 222
    raagixuix = 1458
    raagixunx = EMS
    raagixanx = AR
    raagixlul = 2968171
    raagixasc = 1
    raagixrho = N
    raagixrsf = 0
    raagixcbf = 0
    raagixuax = 1
    raagixsnf = 0
    raagixtao = 1
    raagixptf = 1
    raagixstf = 0
    raagixrfi = 0
    raagixtac = 0
    raagixcai = 50388
    raagixsbi = 2022
    raagixcpr = 2
    raagixmau =
    raagixmlx = 3
    raagixmbx = 99999999
    raagixafp = Account
    raagixifp = Item
    raagixtfp = Sub-branch
    Argbdf = 1
    Argddo = -9999
    raaggi()- Current system time is 02-APR-2012 01:42:57
    raaseb()+ Current system time is 02-APR-2012 01:42:57
    raaseb()- Current system time is 02-APR-2012 01:42:57
    arcdsu()+ Current system time is 02-APR-2012 01:42:57
    arcdsu() error level: 3 array size: 99999999 insert array size: 99999999
    arcdsu() Use Invoice Accounting For Credit Memo: Y
    arcdsu()- Current system time is 02-APR-2012 01:42:57
    raaini()- Current system time is 02-APR-2012 01:42:57
    raapft()+ Current system time is 02-APR-2012 01:42:57
    raagtr()+ Current system time is 02-APR-2012 01:42:57
    crb->raaucrpn = RAXTRX
    crb->raaucrcr = 3584119
    crb->raaucrnt = 0
    crb->raaucrml = 3
    raagtr()- Current system time is 02-APR-2012 01:42:57
    raamil()+ Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raacrf()+ Current system time is 02-APR-2012 01:42:57
    raacrf()- Current system time is 02-APR-2012 01:42:57
    raacrf()+ Current system time is 02-APR-2012 01:42:57
    raacrf()- Current system time is 02-APR-2012 01:42:57
    raacrf()+ Current system time is 02-APR-2012 01:42:57
    raacrf()- Current system time is 02-APR-2012 01:42:57
    raacrf()+ Current system time is 02-APR-2012 01:42:57
    raacrf()- Current system time is 02-APR-2012 01:42:57
    raacrf()+ Current system time is 02-APR-2012 01:42:57
    raacrf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raacrf()+ Current system time is 02-APR-2012 01:42:57
    raacrf()- Current system time is 02-APR-2012 01:42:57
    raacrf()+ Current system time is 02-APR-2012 01:42:57
    raacrf()- Current system time is 02-APR-2012 01:42:57
    raacrf()+ Current system time is 02-APR-2012 01:42:57
    raacrf()- Current system time is 02-APR-2012 01:42:57
    raacrf()+ Current system time is 02-APR-2012 01:42:57
    raacrf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    raaasf()+ Current system time is 02-APR-2012 01:42:57
    raaasf()- Current system time is 02-APR-2012 01:42:57
    UPDATE RA_INTERFACE_LINES
    SET REQUEST_ID = :b1,
    LAST_UPDATE_DATE = sysdate,
    LAST_UPDATED_BY = :b2,
    LAST_UPDATE_LOGIN = :b3,
    SET_OF_BOOKS_ID = NVL(SET_OF_BOOKS_ID, :b4),
    ORG_ID = NVL(ORG_ID, :b5),
    TRX_DATE = TRUNC(TRX_DATE),
    GL_DATE = TRUNC(GL_DATE),
    ORIGINAL_GL_DATE = TRUNC(GL_DATE),
    CONVERSION_DATE = TRUNC(CONVERSION_DATE),
    PURCHASE_ORDER_DATE = TRUNC(PURCHASE_ORDER_DATE),
    RULE_START_DATE = TRUNC(RULE_START_DATE),
    RULE_END_DATE = TRUNC(RULE_END_DATE),
    SALES_ORDER_DATE = TRUNC(SALES_ORDER_DATE),
    SHIP_DATE_ACTUAL = TRUNC(SHIP_DATE_ACTUAL),
    CUSTOMER_TRX_ID = NULL,
    INTERFACE_LINE_ID = NVL(INTERFACE_LINE_ID, RA_CUSTOMER_TRX_LINES_S.NEXTVAL)
    WHERE NVL(INTERFACE_STATUS, '~') != 'P'
    AND (REQUEST_ID IS NULL OR REQUEST_ID IN (3584119))
    AND BATCH_SOURCE_NAME = 'Export Entry'
    AND TRX_NUMBER = 'E512000002' AND LINK_TO_LINE_ATTRIBUTE1 IS NULL
    AND LINK_TO_LINE_ATTRIBUTE2 IS NULL
    AND LINK_TO_LINE_ATTRIBUTE3 IS NULL
    AND LINK_TO_LINE_ATTRIBUTE4 IS NULL
    AND LINK_TO_LINE_ATTRIBUTE5 IS NULL
    AND LINK_TO_LINE_ATTRIBUTE6 IS NULL
    AND LINK_TO_LINE_ATTRIBUTE7 IS NULL
    AND LINK_TO_LINE_ATTRIBUTE8 IS NULL
    AND LINK_TO_LINE_ATTRIBUTE9 IS NULL
    AND LINK_TO_LINE_ATTRIBUTE10 IS NULL
    AND LINK_TO_LINE_ATTRIBUTE11 IS NULL
    AND LINK_TO_LINE_ATTRIBUTE12 IS NULL
    AND LINK_TO_LINE_ATTRIBUTE13 IS NULL
    AND LINK_TO_LINE_ATTRIBUTE14 IS NULL
    AND LINK_TO_LINE_ATTRIBUTE15 IS NULL

    Hi Pk,
    in log file i found the below:
    arcdsu() error level: 3 array size: 99999999 insert array size: 99999999
    and
    raaafs()+ Current system time is 02-APR-2012 01-42-57
    Failed to allocate memory for memptr
    Error calling raaafs()
    Error calling raaffc()
    Error calling raaaui()
    is it related to memory size????????
    let me know
    Regards,
    SItesh

  • Download and upload program

    Hello to everybody,
    I'm looking for a standard program that can download and upload program' source codes. I found the program REPTRAN (in SAP release 6.0) that can only download the source code (with the include as well), but i didn't find the upload one.
    So, does anyone knows if exist a standard program that can download source codes (comprensive of include) and upload it as well?
    Thanks and bye..

    Hi,
    Here is code which read the Programs & download:
    Here Just pass the itab "SOURCE" into WS_DOWNLOAD.
    function zuplt01f_tr.
    *"*"Local interface:
    *"  IMPORTING
    *"     REFERENCE(PROGRAM_NAME) TYPE  SYREPID
    *"  TABLES
    *"      SOURCE
      data: f(240) type c,
            g type i,
            h(72) type c,
            low type i   .
      read report program_name into source . " state 'A'.
      describe table source  lines count.
    endfunction.
    Raja T

  • HI Masters , I need information for file upload program in web dynpro java

    Hi masters,
           i need some inforamtion and documentation on file upload program in web dynpro java

    Hi surya,
    You can follow this procedure to upload the file
    i) Take One Context Attribute named as "D1" of Type "binary".
    ii) Take one FileUpload UI Element in the Layout Tab.
    iii) Bind FileUpload UI Element's data Property to the taken Context Attribute. Here it is "D1".
    iv) Take one Button UI Element in the Layout Tab named "Upload" and in the Action of that Button write the following Code.
    v) The following code Generates one Folder in the Server & inside that Folder given file is Uploaded.
    File ff=new File("FolderXYZ"); // Creates One Folder with the given Name ( Here Folder name is "FolderXYZ")
    ff.mkdir();
    try
    byte b[]=null;
    IWDAttributeInfo objAttinfo=null;
    IWDModifiableBinaryType binType=null;
    File f=null;
    FileOutputStream fos=null;
    if(wdContext.currentContextElement().getD1()!=null)
    b=wdContext.currentContextElement().getD1();
    objAttinfo=wdContext.getNodeInfo().getAttribute(IPrivateAttachView.IContextElement.D1);
    binType=(IWDModifiableBinaryType)objAttinfo.getModifiableSimpleType();
    f=new File(ff.getName()+"
    "+binType.getFileName());
    fos=new FileOutputStream(f);
    fos.write(b);
    fos.flush();
    fos.close();
    objMessageManager.reportSuccess("File uploaded to server");
    } catch (Exception e)
    objMessageManager.reportException("Unable to upload file to server, error is:"+e,false);
    return;
    The Uploaded file is stored in the folder & that folder is stored in the Server's following Path.
    <Your Server>\c$\usr\sap\J2E\JC00\j2ee\cluster\server0
    You can access your Uploaded file from the following Path
    <Your Server>\c$\usr\sap\J2E\JC00\j2ee\cluster\server0\FolderXYZ
    Regards
    Sagar Ingalwar

  • Automating Cash Journal Posting using inbound proxy interface and upload program

    Hi Experts,
    I have a requirement where in cash journal posting needs to be carried out automatically by an inbound interface on a periodic basis and at the start during cut over an upload program needs to be used to upload beg balance data . For this purpose I have used BAPI_CASHJOURNALDOC_CREATE to save cash journal entries along with BAPI TRANSACTION COMMIT.
    Once the Data is successfully saved I am using FM FCJ_GET_DATA_FOR_SCREEN to get prerequisite data for the FM FCJ_POST_ALL which is used by the Standard cash journal program internally to post the saved data. ( I got this by debugging the standard transaction and both FMs are not yet released )
    The issues I am facing is that the the FM FCJ_POST_ALL does not always post the data it behaves in random fashion i.e some times it posts the entries where as sometimes it does not post the entries.
    I have tried using commit work after the FM but that also does not result in consistent behavior of the program. One more issue is the i am not allowed to use commit work in a an inbound proxy so how do i proceed ?
    I am attaching the code for further analysis:
    DATA: LIT_TCJ_TRANS_NAMES TYPE TABLE OF TCJ_TRANS_NAMES,
             LWA_TCJ_TRANS_NAMES TYPE TCJ_TRANS_NAMES,
             LV_WAIT             TYPE BAPITA-WAIT VALUE '1',
             LV_RECORD_NO        TYPE SY-TABIX.
       DATA : LIT_POSTING        TYPE STANDARD TABLE OF ISCJ_POSTINGS,
              LIT_WTAX_ITEMS     TYPE STANDARD TABLE OF TCJ_WTAX_ITEMS,
              LIT_SPLIT_POSTINGS TYPE STANDARD TABLE OF ISCJ_POSTINGS,
              LIT_CPD            TYPE STANDARD TABLE OF TCJ_CPD.
       DATA: LV_BEG_BALANCE      TYPE CJAMOUNT,
             LV_TOTAL_RECEIPTS   TYPE CJAMOUNT,
             LV_TOTAL_PAYMENTS   TYPE CJAMOUNT,
             LV_TOTAL_CHECKS     TYPE CJAMOUNT,
             LV_RUN_BALANCE      TYPE CJAMOUNT,
             LV_RUN_CASH_BALANCE TYPE CJAMOUNT,
             LV_NUMB_OF_REC      TYPE I,
             LV_NUMB_OF_PAYM     TYPE I,
             LV_NUMB_OF_CHECKS   TYPE I.
       DESCRIBE TABLE GIT_CJ LINES GV_TOTAL_RECORDS.
       SELECT MANDT COMP_CODE TRANSACT_NUMBER LANGU TRANSACT_NAME LONG_TEXT
          FROM TCJ_TRANS_NAMES
          INTO TABLE LIT_TCJ_TRANS_NAMES
          WHERE LANGU = GC_EN.
       IF SY-SUBRC <> 0.
         MESSAGE 'No Business Transaction maintained for Company Code in this client'(016) TYPE GC_I.
         LEAVE LIST-PROCESSING.
       ENDIF.
       DESCRIBE TABLE GIT_CJ LINES GV_TOTAL_RECORDS.
       LOOP AT GIT_CJ INTO GWA_CJ.
         LV_RECORD_NO = SY-TABIX.
         CLEAR: GS_HEADER_BAPI,
                GS_CJ_KEY,
                GWA_ITEMS.
         REFRESH: GIT_ITEMS,
                  GIT_RETURN.
         GS_HEADER_BAPI-COMP_CODE    = GWA_CJ-BUKRS.
         GS_HEADER_BAPI-CAJO_NUMBER  = GWA_CJ-CJNR.
         GS_HEADER_BAPI-CURRENCY     = GC_PHP.
         CLEAR LWA_TCJ_TRANS_NAMES.
         READ TABLE LIT_TCJ_TRANS_NAMES INTO LWA_TCJ_TRANS_NAMES WITH KEY COMP_CODE     = GWA_CJ-BUKRS
                                                                          LANGU         = GC_EN
                                                                          TRANSACT_NAME = GWA_CJ-BTNAM.
         IF SY-SUBRC = 0.
           GWA_ITEMS-TRANSACT_NUMBER = LWA_TCJ_TRANS_NAMES-TRANSACT_NUMBER.
           GWA_ITEMS-P_RECEIPTS        = GWA_CJ-CJRAT.
           GWA_ITEMS-TAX_CODE          = GWA_CJ-TXCOD.
           GS_HEADER_BAPI-BP_NAME      = GWA_CJ-BPNAM.
           GWA_ITEMS-POSITION_TEXT     = GWA_CJ-POTXT.
           CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
               INPUT  = GWA_CJ-LIFNR
             IMPORTING
               OUTPUT = GWA_ITEMS-VENDOR_NO.
           CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
               INPUT  = GWA_CJ-KUNNR
             IMPORTING
               OUTPUT = GWA_ITEMS-CUSTOMER.
           PERFORM SUB_DATE_FROMAT_BAPI  CHANGING  GWA_CJ-BLDAT
                                                   GS_HEADER_BAPI-DOC_DATE.
           PERFORM SUB_DATE_FROMAT_BAPI  CHANGING   GWA_CJ-BUDAT
                                                    GS_HEADER_BAPI-PSTNG_DATE.
           GS_HEADER_BAPI-REF_DOC_NO   = GWA_CJ-XBLNR.
           GS_HEADER_BAPI-ALLOC_NMBR   = GWA_CJ-ALLNO.
           CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
               INPUT  = GWA_CJ-KOSTL
             IMPORTING
               OUTPUT = GWA_ITEMS-COSTCENTER.
           CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
               INPUT  = GWA_CJ-PRCTR
             IMPORTING
               OUTPUT = GWA_ITEMS-PROFIT_CTR.
           APPEND GWA_ITEMS TO GIT_ITEMS.
           CALL FUNCTION 'BAPI_CASHJOURNALDOC_CREATE'
             EXPORTING
               HEADER              = GS_HEADER_BAPI
             IMPORTING
               COMPANY_CODE        = GS_CJ_KEY-COMP_CODE
               CASH_JOURNAL_NUMBER = GS_CJ_KEY-CAJO_NUMBER
               FISCAL_YEAR         = GS_CJ_KEY-FISC_YEAR
               CASH_JOURNAL_DOC_NO = GS_CJ_KEY-POSTING_NUMBER
             TABLES
               ITEMS               = GIT_ITEMS
               RETURN              = GIT_RETURN.
           IF GIT_RETURN IS NOT INITIAL.
             READ TABLE GIT_RETURN INTO GWA_RETURN WITH KEY TYPE = GC_E.
             IF SY-SUBRC <> 0.
               CLEAR GWA_CJ_S.
               MOVE-CORRESPONDING GS_CJ_KEY TO GWA_CJ_S.
               CLEAR GWA_RETURN.
               READ TABLE GIT_RETURN INTO GWA_RETURN WITH KEY TYPE = GC_S.
               IF SY-SUBRC = 0.
                 MOVE GWA_RETURN-MESSAGE TO GWA_CJ_S-MSG.
                 CLEAR GWA_RETURN.
                 READ TABLE GIT_RETURN INTO GWA_RETURN WITH KEY TYPE = GC_I.
                 IF SY-SUBRC = 0.
                   CLEAR GWA_CJ_E.
                   CONCATENATE GWA_RETURN-MESSAGE GWA_CJ_S-MSG INTO GWA_CJ_E-MSG SEPARATED BY GC_PIPE_FORMAT.
                   MOVE-CORRESPONDING GS_HEADER_BAPI TO GWA_CJ_E.
                   GWA_CJ_E-POSTING_NUMBER = LV_RECORD_NO.
                   APPEND GWA_CJ_E TO GIT_CJ_E.
                   GV_ERROR_RECORDS = GV_ERROR_RECORDS + GC_1.
                 ELSE.
                   IF P_TEST NE GC_X.
                     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
                       EXPORTING
                         WAIT = LV_WAIT.
                     REFRESH:LIT_POSTING        ,
                             LIT_WTAX_ITEMS     ,
                             LIT_SPLIT_POSTINGS ,
                             LIT_CPD            .
                     CLEAR: LV_BEG_BALANCE      ,
                            LV_TOTAL_RECEIPTS   ,
                            LV_TOTAL_PAYMENTS   ,
                            LV_TOTAL_CHECKS     ,
                            LV_RUN_BALANCE      ,
                            LV_RUN_CASH_BALANCE ,
                            LV_NUMB_OF_REC      ,
                            LV_NUMB_OF_PAYM     ,
                            LV_NUMB_OF_CHECKS   .
                     CALL FUNCTION 'FCJ_GET_DATA_FOR_SCREEN'
                       EXPORTING
                         I_COMP_CODE            = GS_CJ_KEY-COMP_CODE
                         I_CAJO_NUMBER          = GS_CJ_KEY-CAJO_NUMBER
                         I_DISPLAY_PERIOD_LO    = GS_HEADER_BAPI-PSTNG_DATE
                         I_DISPLAY_PERIOD_HI    = GS_HEADER_BAPI-PSTNG_DATE
                       IMPORTING
                         E_BEGINNING_BALANCE    = LV_BEG_BALANCE
                         E_RUNNING_BALANCE      = LV_RUN_BALANCE
                         E_RUNNING_CASH_BALANCE = LV_RUN_CASH_BALANCE
                         E_TOTAL_RECEIPTS       = LV_TOTAL_RECEIPTS
                         E_TOTAL_REC_NUMBER     = LV_NUMB_OF_REC
                         E_TOTAL_PAYMENTS       = LV_TOTAL_PAYMENTS
                         E_TOTAL_PAYM_NUMBER    = LV_NUMB_OF_PAYM
                         E_TOTAL_CHECKS         = LV_TOTAL_CHECKS
                         E_TOTAL_CHECKS_NUMBER  = LV_NUMB_OF_CHECKS
                       TABLES
                         E_POSTINGS             = LIT_POSTING
                         E_WTAX_ITEMS           = LIT_WTAX_ITEMS
                         E_SPLIT_POSTINGS       = LIT_SPLIT_POSTINGS
                         E_CPD                  = LIT_CPD.
                     CALL FUNCTION 'FCJ_POST_ALL'
                       EXPORTING
                         I_COMP_CODE               = GS_CJ_KEY-COMP_CODE
                         I_CAJO_NUMBER             = GS_CJ_KEY-CAJO_NUMBER
                         I_CURRENCY                = GS_HEADER_BAPI-CURRENCY
                         I_TYP                     = 'R'
                         I_DISPLAY_PERIOD_LO       = GS_HEADER_BAPI-PSTNG_DATE
                         I_DISPLAY_PERIOD_HI       = GS_HEADER_BAPI-PSTNG_DATE
    *              IMPORTING
    *                E_ERROR_NUMBER            =
                       TABLES
                         ITCJ_POSTINGS             = LIT_POSTING
                         ITCJ_WTAX_ITEMS           = LIT_WTAX_ITEMS
                         ITCJ_SPLIT_POSTINGS       = LIT_SPLIT_POSTINGS
                         ITCJ_CPD                  = LIT_CPD
                       CHANGING
                         P_BEG_BALANCE             = LV_BEG_BALANCE
                         P_TOTAL_RECEIPTS          = LV_TOTAL_RECEIPTS
                         P_TOTAL_PAYMENTS          = LV_TOTAL_PAYMENTS
                         P_TOTAL_CHECKS            = LV_TOTAL_CHECKS
                         P_RUN_BALANCE             = LV_RUN_BALANCE
                         P_RUN_CASH_BALANCE        = LV_RUN_CASH_BALANCE
                         P_NUMB_OF_REC             = LV_NUMB_OF_REC
                         P_NUMB_OF_PAYM            = LV_NUMB_OF_PAYM
                         P_NUMB_OF_CHECKS          = LV_NUMB_OF_CHECKS.
                     COMMIT WORK.
                   ENDIF.
                   APPEND GWA_CJ_S TO GIT_CJ_S.
                   GV_SUCCESS_RECORDS = GV_SUCCESS_RECORDS + GC_1.
                   CLEAR GWA_CJ_S.
                 ENDIF.
               ENDIF.
             ELSE.
               CLEAR GWA_CJ_E.
               MOVE-CORRESPONDING GS_HEADER_BAPI TO GWA_CJ_E.
               MOVE GWA_RETURN-MESSAGE TO GWA_CJ_E-MSG.
               GWA_CJ_E-POSTING_NUMBER = LV_RECORD_NO.
               APPEND GWA_CJ_E TO GIT_CJ_E.
               GV_ERROR_RECORDS = GV_ERROR_RECORDS + GC_1.
             ENDIF.
           ENDIF.
         ELSE.
           GWA_RETURN-MESSAGE = 'Transaction Name does not correspond to any Transaction Number'(017).
           CLEAR GWA_CJ_E.
           MOVE-CORRESPONDING GS_HEADER_BAPI TO GWA_CJ_E.
           MOVE GWA_RETURN-MESSAGE TO GWA_CJ_E-MSG.
           GWA_CJ_E-POSTING_NUMBER = LV_RECORD_NO.
           APPEND GWA_CJ_E TO GIT_CJ_E.
           GV_ERROR_RECORDS = GV_ERROR_RECORDS + GC_1.
         ENDIF.
       ENDLOOP.
    ENDFORM.                    " SUB_BAPI_CALL

    Hi Experts,
    I have a requirement where in cash journal posting needs to be carried out automatically by an inbound interface on a periodic basis and at the start during cut over an upload program needs to be used to upload beg balance data . For this purpose I have used BAPI_CASHJOURNALDOC_CREATE to save cash journal entries along with BAPI TRANSACTION COMMIT.
    Once the Data is successfully saved I am using FM FCJ_GET_DATA_FOR_SCREEN to get prerequisite data for the FM FCJ_POST_ALL which is used by the Standard cash journal program internally to post the saved data. ( I got this by debugging the standard transaction and both FMs are not yet released )
    The issues I am facing is that the the FM FCJ_POST_ALL does not always post the data it behaves in random fashion i.e some times it posts the entries where as sometimes it does not post the entries.
    I have tried using commit work after the FM but that also does not result in consistent behavior of the program. One more issue is the i am not allowed to use commit work in a an inbound proxy so how do i proceed ?
    I am attaching the code for further analysis:
    DATA: LIT_TCJ_TRANS_NAMES TYPE TABLE OF TCJ_TRANS_NAMES,
             LWA_TCJ_TRANS_NAMES TYPE TCJ_TRANS_NAMES,
             LV_WAIT             TYPE BAPITA-WAIT VALUE '1',
             LV_RECORD_NO        TYPE SY-TABIX.
       DATA : LIT_POSTING        TYPE STANDARD TABLE OF ISCJ_POSTINGS,
              LIT_WTAX_ITEMS     TYPE STANDARD TABLE OF TCJ_WTAX_ITEMS,
              LIT_SPLIT_POSTINGS TYPE STANDARD TABLE OF ISCJ_POSTINGS,
              LIT_CPD            TYPE STANDARD TABLE OF TCJ_CPD.
       DATA: LV_BEG_BALANCE      TYPE CJAMOUNT,
             LV_TOTAL_RECEIPTS   TYPE CJAMOUNT,
             LV_TOTAL_PAYMENTS   TYPE CJAMOUNT,
             LV_TOTAL_CHECKS     TYPE CJAMOUNT,
             LV_RUN_BALANCE      TYPE CJAMOUNT,
             LV_RUN_CASH_BALANCE TYPE CJAMOUNT,
             LV_NUMB_OF_REC      TYPE I,
             LV_NUMB_OF_PAYM     TYPE I,
             LV_NUMB_OF_CHECKS   TYPE I.
       DESCRIBE TABLE GIT_CJ LINES GV_TOTAL_RECORDS.
       SELECT MANDT COMP_CODE TRANSACT_NUMBER LANGU TRANSACT_NAME LONG_TEXT
          FROM TCJ_TRANS_NAMES
          INTO TABLE LIT_TCJ_TRANS_NAMES
          WHERE LANGU = GC_EN.
       IF SY-SUBRC <> 0.
         MESSAGE 'No Business Transaction maintained for Company Code in this client'(016) TYPE GC_I.
         LEAVE LIST-PROCESSING.
       ENDIF.
       DESCRIBE TABLE GIT_CJ LINES GV_TOTAL_RECORDS.
       LOOP AT GIT_CJ INTO GWA_CJ.
         LV_RECORD_NO = SY-TABIX.
         CLEAR: GS_HEADER_BAPI,
                GS_CJ_KEY,
                GWA_ITEMS.
         REFRESH: GIT_ITEMS,
                  GIT_RETURN.
         GS_HEADER_BAPI-COMP_CODE    = GWA_CJ-BUKRS.
         GS_HEADER_BAPI-CAJO_NUMBER  = GWA_CJ-CJNR.
         GS_HEADER_BAPI-CURRENCY     = GC_PHP.
         CLEAR LWA_TCJ_TRANS_NAMES.
         READ TABLE LIT_TCJ_TRANS_NAMES INTO LWA_TCJ_TRANS_NAMES WITH KEY COMP_CODE     = GWA_CJ-BUKRS
                                                                          LANGU         = GC_EN
                                                                          TRANSACT_NAME = GWA_CJ-BTNAM.
         IF SY-SUBRC = 0.
           GWA_ITEMS-TRANSACT_NUMBER = LWA_TCJ_TRANS_NAMES-TRANSACT_NUMBER.
           GWA_ITEMS-P_RECEIPTS        = GWA_CJ-CJRAT.
           GWA_ITEMS-TAX_CODE          = GWA_CJ-TXCOD.
           GS_HEADER_BAPI-BP_NAME      = GWA_CJ-BPNAM.
           GWA_ITEMS-POSITION_TEXT     = GWA_CJ-POTXT.
           CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
               INPUT  = GWA_CJ-LIFNR
             IMPORTING
               OUTPUT = GWA_ITEMS-VENDOR_NO.
           CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
               INPUT  = GWA_CJ-KUNNR
             IMPORTING
               OUTPUT = GWA_ITEMS-CUSTOMER.
           PERFORM SUB_DATE_FROMAT_BAPI  CHANGING  GWA_CJ-BLDAT
                                                   GS_HEADER_BAPI-DOC_DATE.
           PERFORM SUB_DATE_FROMAT_BAPI  CHANGING   GWA_CJ-BUDAT
                                                    GS_HEADER_BAPI-PSTNG_DATE.
           GS_HEADER_BAPI-REF_DOC_NO   = GWA_CJ-XBLNR.
           GS_HEADER_BAPI-ALLOC_NMBR   = GWA_CJ-ALLNO.
           CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
               INPUT  = GWA_CJ-KOSTL
             IMPORTING
               OUTPUT = GWA_ITEMS-COSTCENTER.
           CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
               INPUT  = GWA_CJ-PRCTR
             IMPORTING
               OUTPUT = GWA_ITEMS-PROFIT_CTR.
           APPEND GWA_ITEMS TO GIT_ITEMS.
           CALL FUNCTION 'BAPI_CASHJOURNALDOC_CREATE'
             EXPORTING
               HEADER              = GS_HEADER_BAPI
             IMPORTING
               COMPANY_CODE        = GS_CJ_KEY-COMP_CODE
               CASH_JOURNAL_NUMBER = GS_CJ_KEY-CAJO_NUMBER
               FISCAL_YEAR         = GS_CJ_KEY-FISC_YEAR
               CASH_JOURNAL_DOC_NO = GS_CJ_KEY-POSTING_NUMBER
             TABLES
               ITEMS               = GIT_ITEMS
               RETURN              = GIT_RETURN.
           IF GIT_RETURN IS NOT INITIAL.
             READ TABLE GIT_RETURN INTO GWA_RETURN WITH KEY TYPE = GC_E.
             IF SY-SUBRC <> 0.
               CLEAR GWA_CJ_S.
               MOVE-CORRESPONDING GS_CJ_KEY TO GWA_CJ_S.
               CLEAR GWA_RETURN.
               READ TABLE GIT_RETURN INTO GWA_RETURN WITH KEY TYPE = GC_S.
               IF SY-SUBRC = 0.
                 MOVE GWA_RETURN-MESSAGE TO GWA_CJ_S-MSG.
                 CLEAR GWA_RETURN.
                 READ TABLE GIT_RETURN INTO GWA_RETURN WITH KEY TYPE = GC_I.
                 IF SY-SUBRC = 0.
                   CLEAR GWA_CJ_E.
                   CONCATENATE GWA_RETURN-MESSAGE GWA_CJ_S-MSG INTO GWA_CJ_E-MSG SEPARATED BY GC_PIPE_FORMAT.
                   MOVE-CORRESPONDING GS_HEADER_BAPI TO GWA_CJ_E.
                   GWA_CJ_E-POSTING_NUMBER = LV_RECORD_NO.
                   APPEND GWA_CJ_E TO GIT_CJ_E.
                   GV_ERROR_RECORDS = GV_ERROR_RECORDS + GC_1.
                 ELSE.
                   IF P_TEST NE GC_X.
                     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
                       EXPORTING
                         WAIT = LV_WAIT.
                     REFRESH:LIT_POSTING        ,
                             LIT_WTAX_ITEMS     ,
                             LIT_SPLIT_POSTINGS ,
                             LIT_CPD            .
                     CLEAR: LV_BEG_BALANCE      ,
                            LV_TOTAL_RECEIPTS   ,
                            LV_TOTAL_PAYMENTS   ,
                            LV_TOTAL_CHECKS     ,
                            LV_RUN_BALANCE      ,
                            LV_RUN_CASH_BALANCE ,
                            LV_NUMB_OF_REC      ,
                            LV_NUMB_OF_PAYM     ,
                            LV_NUMB_OF_CHECKS   .
                     CALL FUNCTION 'FCJ_GET_DATA_FOR_SCREEN'
                       EXPORTING
                         I_COMP_CODE            = GS_CJ_KEY-COMP_CODE
                         I_CAJO_NUMBER          = GS_CJ_KEY-CAJO_NUMBER
                         I_DISPLAY_PERIOD_LO    = GS_HEADER_BAPI-PSTNG_DATE
                         I_DISPLAY_PERIOD_HI    = GS_HEADER_BAPI-PSTNG_DATE
                       IMPORTING
                         E_BEGINNING_BALANCE    = LV_BEG_BALANCE
                         E_RUNNING_BALANCE      = LV_RUN_BALANCE
                         E_RUNNING_CASH_BALANCE = LV_RUN_CASH_BALANCE
                         E_TOTAL_RECEIPTS       = LV_TOTAL_RECEIPTS
                         E_TOTAL_REC_NUMBER     = LV_NUMB_OF_REC
                         E_TOTAL_PAYMENTS       = LV_TOTAL_PAYMENTS
                         E_TOTAL_PAYM_NUMBER    = LV_NUMB_OF_PAYM
                         E_TOTAL_CHECKS         = LV_TOTAL_CHECKS
                         E_TOTAL_CHECKS_NUMBER  = LV_NUMB_OF_CHECKS
                       TABLES
                         E_POSTINGS             = LIT_POSTING
                         E_WTAX_ITEMS           = LIT_WTAX_ITEMS
                         E_SPLIT_POSTINGS       = LIT_SPLIT_POSTINGS
                         E_CPD                  = LIT_CPD.
                     CALL FUNCTION 'FCJ_POST_ALL'
                       EXPORTING
                         I_COMP_CODE               = GS_CJ_KEY-COMP_CODE
                         I_CAJO_NUMBER             = GS_CJ_KEY-CAJO_NUMBER
                         I_CURRENCY                = GS_HEADER_BAPI-CURRENCY
                         I_TYP                     = 'R'
                         I_DISPLAY_PERIOD_LO       = GS_HEADER_BAPI-PSTNG_DATE
                         I_DISPLAY_PERIOD_HI       = GS_HEADER_BAPI-PSTNG_DATE
    *              IMPORTING
    *                E_ERROR_NUMBER            =
                       TABLES
                         ITCJ_POSTINGS             = LIT_POSTING
                         ITCJ_WTAX_ITEMS           = LIT_WTAX_ITEMS
                         ITCJ_SPLIT_POSTINGS       = LIT_SPLIT_POSTINGS
                         ITCJ_CPD                  = LIT_CPD
                       CHANGING
                         P_BEG_BALANCE             = LV_BEG_BALANCE
                         P_TOTAL_RECEIPTS          = LV_TOTAL_RECEIPTS
                         P_TOTAL_PAYMENTS          = LV_TOTAL_PAYMENTS
                         P_TOTAL_CHECKS            = LV_TOTAL_CHECKS
                         P_RUN_BALANCE             = LV_RUN_BALANCE
                         P_RUN_CASH_BALANCE        = LV_RUN_CASH_BALANCE
                         P_NUMB_OF_REC             = LV_NUMB_OF_REC
                         P_NUMB_OF_PAYM            = LV_NUMB_OF_PAYM
                         P_NUMB_OF_CHECKS          = LV_NUMB_OF_CHECKS.
                     COMMIT WORK.
                   ENDIF.
                   APPEND GWA_CJ_S TO GIT_CJ_S.
                   GV_SUCCESS_RECORDS = GV_SUCCESS_RECORDS + GC_1.
                   CLEAR GWA_CJ_S.
                 ENDIF.
               ENDIF.
             ELSE.
               CLEAR GWA_CJ_E.
               MOVE-CORRESPONDING GS_HEADER_BAPI TO GWA_CJ_E.
               MOVE GWA_RETURN-MESSAGE TO GWA_CJ_E-MSG.
               GWA_CJ_E-POSTING_NUMBER = LV_RECORD_NO.
               APPEND GWA_CJ_E TO GIT_CJ_E.
               GV_ERROR_RECORDS = GV_ERROR_RECORDS + GC_1.
             ENDIF.
           ENDIF.
         ELSE.
           GWA_RETURN-MESSAGE = 'Transaction Name does not correspond to any Transaction Number'(017).
           CLEAR GWA_CJ_E.
           MOVE-CORRESPONDING GS_HEADER_BAPI TO GWA_CJ_E.
           MOVE GWA_RETURN-MESSAGE TO GWA_CJ_E-MSG.
           GWA_CJ_E-POSTING_NUMBER = LV_RECORD_NO.
           APPEND GWA_CJ_E TO GIT_CJ_E.
           GV_ERROR_RECORDS = GV_ERROR_RECORDS + GC_1.
         ENDIF.
       ENDLOOP.
    ENDFORM.                    " SUB_BAPI_CALL

  • Customer Invoice Upload Tool - Can't get extension fields to populate

    In the documentation for the customer invoice upload documentation, it says to get the tag for your extension field in the Customer Invoice XML Output. No issues there. But when I add the extension field to the XML for the Customer Invoice Request Service Interface, the field never populates in the generated invoice request. Note that I cannot create a new XML Upload Service interface as a workaround because this is a 3.5 customer system
    The extension fields are in a different namespace from the Request Service Interface, so I've tried the two methods below to populate my Advertiser extension field. I've had no luck with either. Here's some sample XML from the beginning of the file. The files are also attached. Any help is appreciated.
    [ I also posted on the SCN where I  attached the test files.|http://scn.sap.com/thread/3237936]
    Method 1
    <?xml version="1.0"?>
    <CustomerInvoiceRequestRequest>
    <MessageHeader>
    <CreationDateTime/>
    </MessageHeader>
    <CustomerInvoiceRequest actionCode="04" reconciliationPeriodCounterValue="1">
    <BaseBusinessTransactionDocumentID>EXT_100001_TALINV</BaseBusinessTransactionDocumentID>
    <BaseBusinessTransactionDocumentTypeCode>29</BaseBusinessTransactionDocumentTypeCode>
    <ProposedInvoiceDate>2012-09-16</ProposedInvoiceDate>
    <Name>hhhc</Name>
    <ReferenceBusinessTransactionDocumentID>100001</ReferenceBusinessTransactionDocumentID>
    <Advertiser xmlns="http://sap.com/xi/AP/CustomerExtension/BYD/A03DP">
    <EXTAdvertiser00163E027E021ED1BFDF09124EFF4876_002>JUDSON</EXTAdvertiser00163E027E021ED1BFDF09124EFF4876_002>
    </Advertiser>
    <BusinessProcessVariantType>
    <BusinessProcessVariantTypeCode>1</BusinessProcessVariantTypeCode>
    <MainIndicator>true</MainIndicator>
    </BusinessProcessVariantType>
    Method 2
    <?xml version="1.0"?>
    <CustomerInvoiceRequestRequest>
    <MessageHeader>
    <CreationDateTime/>
    </MessageHeader>
    <CustomerInvoiceRequest actionCode="04" reconciliationPeriodCounterValue="1">
    <BaseBusinessTransactionDocumentID>EXT_100002_TALINV</BaseBusinessTransactionDocumentID>
    <BaseBusinessTransactionDocumentTypeCode>29</BaseBusinessTransactionDocumentTypeCode>
    <ProposedInvoiceDate>2012-09-16</ProposedInvoiceDate>
    <Name>hhhc</Name>
    <ReferenceBusinessTransactionDocumentID>100002</ReferenceBusinessTransactionDocumentID>
    <n1:EXTAdvertiser00163E027E021ED1BFDF09124EFF4876_002 xmlns:n1="http://sap.com/xi/AP/CustomerExtension/BYD/A03DP">JUDSON</n1:EXTAdvertiser00163E027E021ED1BFDF09124EFF4876_002>
    <BusinessProcessVariantType>
    <BusinessProcessVariantTypeCode>1</BusinessProcessVariantTypeCode>
    <MainIndicator>true</MainIndicator>
    </BusinessProcessVariantType>

    Hi Judson,
    Thanks for sharing this answer, i am also facing the same issue. But here in my case i have extension field in Items nodes and also got the xml node from customer invoice xml, like below but when i process the xml it adds invoice request but dont maps th "test" nodes data to that extended column.
    <n1:test_0LIGMSME2T388H1SZMFGTNHGN_Y38WD8BTY xmlns:n1="http://0008768412-one-off.sap.com/Y38WD8BTY_">test data</n1:test_0LIGMSME2T388H1SZMFGTNHGN_Y38WD8BTY>
    Could you please suggest what i am missing.

  • Shopping Cart needs to be Held Status when created from Upload Program

    Hi All,
    Shopping Cart is created from Custom Upload Program. In Upload Program, we used BBP_PD_SC_CREATE, BBP_PD_SC_UPDATE, BBP_PD_SC_SAVE and BBP_PD_SC_COMMIT.
    Once the Shopping Cart is created from this upload program, I want ot put Shopping Cart as Helad Status.
    I exported the parameter I_PARK as 'X' in BBP_PD_SC_CREATE and BBP_PD_SC_UPDATE. But it is not working i.e., the SRM system is not keeping the Shopping Cart as Held Status.
    Scenario:
    I am uploading the Shopping Cart Items (Shopping Cart creation) on behalf of my manager. My manager has to approve Shopping Cart.
    If shopping cart is created maually and Shopping cart value is within the spending limit, work flow is not triggered approval proceess. If I am creating shopping cart behalf of some one, I am adding the approver manually while creating.
    When ever we create shopping cart through custom upload program, the shopping cart needs to be approved by the Requestor (my manager, to cross check shopping cart items). So I want to park the Shopping Cart and I want to add Approver as my manager.
    Please suggest me or guide me to get the solution for my issue.
    Thanks,
    Sudarsan
    Edited by: KOYYA SUDARSANA NAIDU on Nov 14, 2008 9:12 PM

    Completed

  • Need to create a mass upload program for appraisal document creation for multiple employee

    Hi Expertise,
    I need to create a mass upload program for appraisal document creation for manager and his multiple employee
    at a time using tcode appcreate.
    Please help me out.
    Best regards,
    Priyaranjan

    Hi Priyaranjan,
    I think you can take the abap'ers help in creating the program. But u need to provide them the exact functionality and the required specifications in creating the appraisal document.
    Even tcode also u can get it prepared by Abap'ers.
    Thanks and Regards
    Balaji

  • Need to create a mass upload program for appraisal document creation for multiple employee in abap hr

    Hi Expertise,
    I need to create a mass upload program for appraisal document creation for manager and his multiple employee
    at a time using tcode appcreate.
    Please help me out.
    Best regards,
    Priyaranjan

    Hi,
    I have done appraisal document creation for bulk using txt file.
    this fm used for single for creation in standard tcode (phap_prepare):  'WZ_HRHAP_0DOC_WZ01_START'.
    So create ztcode  usinh this fm for single form then record BDC for this tcode and called this tcode in that bdc for bulk creation .
    While recording for single I have used manual option instead of automatic .

  • Transaction Code - Upload Program

    Dear All,
    Please help.
    Like wise we can assign a T code to a BDC program for using it as upload program.
    Please tell me can a T code be assigned to an upload program done through LSMW
    & how...???
    Regards
    Dhananjay

    Hello,
    you can create a templete for uploading the data using LSMW and create as a program and assign a transaction code to it. But all you require is ABAP help.
    Prase

  • Help on Shopping Cart Upload Program

    Hi All,
    I am trying develop a program for uploading Shopping Carts from EXCEL Spread Sheet.
    I have gone through the following thread. But still I am facing the problems:
    /message/3082168#3082168 [original link is broken]
    Procedure 1: I developed program with 'BBP_PD_SC_CREATE_EXTERNAL', I got the following erros
    Shopping Cart Upload Program
    00001 E 008
    No account assignment exists. Enter an account assignment
                         000000
    00001 E 047
    Please specify Account Assignment by selecting "Known" radio button for
                         000000 Please specify Account Assignment by selecting "Known" radio button for
    00001 E 247
    Plant for follow-on document missing
                         000000
    Procedure 2: I used BBP_PD_SC_CREATE. I am getting the following Errors:
    Shopping Cart Upload Program
    A
    Interface data contains errors
    A
    Interface data contains errors
    A
    Interface data contains errors
    A
    No data found
    A
    No data found
    A
    The document does not exist. Check entries
    A
    Incorrect interface data for set PDDEP in method C
    A
    Incorrect interface data for set PDDYN in method C
    A
    Incorrect interface data for set PDFRT in method C
    A
    Incorrect interface data for set PDHCF in method C
    A
    Incorrect interface data for set PDORG in method C
    A
    Incorrect interface data for set PDTAX in method C
    A
    Incorrect interface data for set PDTOL in method C
    A
    Incorrect interface data for set PDWGT in method C
    E
    Enter at least one item or one limit
    Procedure 1 Sample Program:
    DATA: i_basket        TYPE TABLE OF bbp_basket_ext_device,
          i_basket_back   TYPE TABLE OF bbp_basket_back,
          i_basket_errors TYPE TABLE OF bbp_oci_errors.
    DATA: w_basket        TYPE bbp_basket_ext_device,
          w_basket_back   TYPE bbp_basket_back,
          w_basket_errors TYPE bbp_oci_errors.
    PARAMETERS: p_user TYPE sy-uname DEFAULT 'REQUESTER'.
    CLEAR w_basket.
    w_basket-basket_name = 'Test Shopping Cart'.
    w_basket-line = '00001'.
    w_basket-description = 'Mat Desc New'.
    w_basket-quantity = 1.
    w_basket-unit = 'EA'.
    w_basket-price = 10.
    w_basket-priceunit = 1.
    w_basket-currency = 'USD'.
    w_basket-vendor = '0000301300'.
    w_basket-category_id = 'L03621101'.
    APPEND w_basket TO i_basket.
    CALL FUNCTION 'BBP_PD_SC_CREATE_EXTERNAL'
      EXPORTING
        user_name     = p_user
      TABLES
        basket        = i_basket
        basket_back   = i_basket_back
        basket_errors = i_basket_errors
      EXCEPTIONS
        not_saved     = 1
        OTHERS        = 2.
    IF sy-subrc EQ 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    LOOP AT i_basket_back INTO w_basket_back.
      WRITE:/ w_basket_back-basket, w_basket_back-basket_number.
    ENDLOOP.
    LOOP AT  i_basket_errors INTO w_basket_errors.
      WRITE:/ w_basket_errors-line,
              w_basket_errors-type,
              w_basket_errors-code,
              w_basket_errors-message,
              w_basket_errors-log_no,
              w_basket_errors-log_msg_no,
              w_basket_errors-message_v1,
              w_basket_errors-message_v2,
              w_basket_errors-message_v3,
              w_basket_errors-message_v4.
    ENDLOOP.
    Procedure 2 Sample Program:
    DATA: v_header_guid  TYPE crmd_orderadm_h-guid,
          v_item_guid    TYPE crmd_orderadm_h-guid,
          v_account_guid TYPE crmd_orderadm_h-guid,
          v_partner_guid TYPE crmd_orderadm_h-guid,
          v_orgdata_guid TYPE crmd_orderadm_h-guid.
    DATA: i_messages TYPE TABLE OF bbp_pds_messages,
          i_item     TYPE TABLE OF bbp_pds_sc_item_d,
          i_account  TYPE TABLE OF bbp_pds_acc,
          i_partner  TYPE TABLE OF bbp_pds_partner,
          i_orgdata  TYPE TABLE OF bbp_pds_org.
    DATA: w_header   TYPE bbp_pds_sc_header_ic,
          w_e_header TYPE bbp_pds_sc_header_d,
          w_messages TYPE bbp_pds_messages,
          w_item     TYPE bbp_pds_sc_item_d,
          w_account  TYPE bbp_pds_acc,
          w_partner  TYPE bbp_pds_partner,
          w_orgdata  TYPE bbp_pds_org.
    CLEAR i_messages.
    v_header_guid  = 1.
    v_item_guid = 2.
    v_account_guid = 3.
    v_partner_guid = 4.
    v_orgdata_guid = 5.
    *header-guid = 1.
    *item-parent = 1.
    *item-guid = 2.
    *accounting-guid = 3.
    *accounting-p_guid = item-guid.
    *partner-partner_guid = 4.
    *partner-p_guid = item-guid.
    *organization-guid = 5.
    *organization-p_guid = item-guid.
    *I_HEADER
    CLEAR w_header.
    w_header-guid = v_header_guid.
    w_header-object_id  = 'BUS2121'.
    w_header-description = 'Test SC Upload'.
    w_header-currency = 'GBP'.
    w_header-process_type = 'SHC'.
    w_header-posting_date = sy-datum.
    *I_ITEM
    * DELIV_DATE, PRODUCT_TYPE, LOGSYS_FI, BE_CO_CODE.
    CLEAR w_item.
    w_item-guid = v_item_guid.
    w_item-parent = v_header_guid.
    w_item-number_int = '0000000001'.
    w_item-number_ext = '0000000000'.
    w_item-product = '45ACB1298F870099000000000A8E0327'.
    w_item-description = 'Lay Main <=180'.
    w_item-category = 'FC888C591C4CFC4081AE49F48750CBAB'.
    w_item-category_id = 'L03621101'.
    w_item-ext_quote_item = '0000000000'.
    w_item-quantity = 1.
    w_item-unit = 'EA'.
    w_item-ordered_prod = '/EC_1A001'.
    w_item-price = 2.
    w_item-price_unit = 1.
    w_item-gross_price = 2.
    w_item-currency = 'USD'.
    w_item-del_datcat = 1.
    w_item-deliv_date = sy-datum.
    w_item-product_type = '01'.
    w_item-logsys_fi = 'DEVCLNT100'.
    w_item-be_log_system = 'SRDCLNT100'.
    *w_item-be_stge_loc = 'MAIN'.
    w_item-be_plant = '1020'.
    *w_item-be_move_type = '281'.
    w_item-be_pur_group = '50002754'.
    w_item-be_pur_org = '50000040'.
    w_item-be_co_code = '1020'.
    w_item-be_doc_type = 'ECPO'.
    APPEND w_item TO i_item.
    *I_ACCOUNT
    CLEAR w_account.
    w_account-guid = v_account_guid.
    w_account-p_guid = v_item_guid.
    w_account-distr_perc = 100.
    w_account-acc_no = '0001'.
    w_account-acc_cat = 'OR'.
    *w_account-SRC_GUID 00000000000000000000000000000000
    w_account-g_l_acct = '0000621101'.
    *w_account-BUS_AREA VTRS
    w_account-cost_ctr = ' 0000012061'.
    w_account-sdoc_item = '000000'.
    w_account-sched_line = '0000'.
    w_account-co_area = 'EXEL'.
    *w_account-profit_ctr = 'NM01'.
    *w_account-PROF_SEGM 0000000000
    *w_account-CMMT_ITEM 500411060
    *w_account-FUNDS_CTR 6589
    APPEND w_account TO i_account.
    *I_PARTNER
    CLEAR w_partner.
    w_partner-partner_guid = v_partner_guid.
    w_partner-p_guid  = v_item_guid.
    w_partner-partner_fct = '00000016'.
    w_partner-partner_no = '48ED292BF5193C52E1000000AC1D061F'.
    w_partner-addr_type = '3'.
    w_partner-addr_origin = 'A'.
    w_partner-addr_no = '0000011078'.
    w_partner-partner_id = '0000000941'.
    APPEND w_partner TO i_partner.
    CLEAR v_partner_guid.
    CLEAR w_partner.
    w_partner-partner_guid = v_partner_guid.
    w_partner-p_guid  = v_item_guid.
    w_partner-partner_fct = '00000020'.
    w_partner-partner_no = '4896D1636F351467E1000000AC1D061F'.
    w_partner-addr_type = '3'.
    w_partner-addr_origin = 'A'.
    w_partner-addr_no = '0000011078'.
    w_partner-partner_id = '0000000941'.
    APPEND w_partner TO i_partner.
    CLEAR v_partner_guid.
    CLEAR w_partner.
    w_partner-partner_guid = v_partner_guid.
    w_partner-p_guid  = v_item_guid.
    w_partner-partner_fct = '00000027'.
    w_partner-partner_no = 'B106B75848BC9B4584C8A1C1EB89EC94'.
    w_partner-addr_type = '1'.
    w_partner-addr_origin = 'B'.
    w_partner-addr_no = '0000015958'.
    w_partner-partner_id = '0000000915'.
    APPEND w_partner TO i_partner.
    *I_ORGDATA
    CLEAR w_orgdata.
    w_orgdata-guid = v_orgdata_guid.
    w_orgdata-p_guid  = v_item_guid.
    w_orgdata-proc_org_resp_id = '50002754'.
    w_orgdata-proc_group_id = '50002754'.
    w_orgdata-proc_org_id = '50000040'.
    APPEND w_orgdata TO i_orgdata.
    CALL FUNCTION 'BBP_PD_SC_CREATE'
      EXPORTING
        i_ref_guid = v_header_guid
        i_park     = 'X'
        i_save     = 'X'
        i_header   = w_header
      IMPORTING
        e_header   = w_e_header
      TABLES
        i_item     = i_item
        i_account  = i_account
        i_partner  = i_partner
        i_orgdata  = i_orgdata
        e_messages = i_messages.
    LOOP AT i_messages INTO w_messages .
      WRITE:/ w_messages-msgty,
    *  w_messages-msgid,
    *  w_messages-msgno,
      w_messages-message
    *  w_messages-msgv1,
    *  w_messages-msgv2,
    *  w_messages-msgv3,
    *  w_messages-msgv4
    ENDLOOP
    Thanks a lot in advance to help me out this.
    Please send if you have code to complete this to sudarsan.srm at gmail (gmail id - sudarsan.srm)
    Best Regards,
    Sudarsan

    Hi All,
    I forgot to mention SRM Version. I am working on SRM 4.0.
    Thanks,
    Best Regards,
    Sudarsan

  • Bapi FM upload program

    Hi All,
    I am doing bapi fm upload program, when i run the program it shows the short dump error,
    i debug this program, the cursor is not move after tansaction_commit,
    it shows the FM: ps_commit. it s not run successfully,
    any one help for this error,
    (  CALL FUNCTION 'BAPI_PS_PRECOMMIT'                                                                " CALL FUNCTION MODULE
                  TABLES
                       ET_RETURN       = lt_ret2.
              CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'                                                          " CALL FUNCTION MODULE
                   EXPORTING
                      WAIT          = 'X'.)
    Thanks for advance help.
    Amudha

    Hi,
    You can delete a project definition using the BAPI "BAPI_BUS2001_DELETE". You must enter the name of the project definition that is to be deleted in "I_PROJECT_DEFINITION". Before the project definition is deleted, the following is checked:
    the project definition is deleted in the document tables. If the project has WBS elements, these are also deleted. If the project has other objects such as networks, activities and so on, the BAPI terminates and an error message is displayed. These must be deleted beforehand. The BAPI does not delete these automatically. The project definition is deleted as soon as a LUW (Logical Unit of Work) has been completed with the BAPI BAPI_PS_PRECOMMIT and COMMIT WORK. Only one project or one WBS element from a project can be processed at a time in one LUW. You cannot delete temporary objects. This means that if you create a project in an LUW, you cannot delete it immediately after creating it. You can delete it using this BAPI only after you physically create the project using the BAPIs "BAPI_PS_PRECOMMIT" and "COMMIT WORK".
    REgards,
    Nandha

Maybe you are looking for

  • HT1926 this copy of itunes is corrupted or not installed correctly. please reinstall itunes

    I have just updated itunes and have received the error 'this copy of itunes is corrupted or not installed correctly.  Please re-install itunes' whenever I try to open it.  I have read a number of replies to other people asking the same question, but

  • WebCenter/ADF Bounded Task Flow Permissions 11.1.1.4

    Hello All, I'm seeing some strange behavior related to permission on bounded task flows within a WebCenter Portal Application created with the 11.1.1.4 WC extensions. I created a bounded task flow and added a view activity and a return activity to it

  • E-recruitment - Role based restrictions on Active Queries - High Priority

    Requirement - Do we have an option to restrict the queries in recruiter 'active queries list' (work center) based on roles. for example: Restricted recriter should not be allowed to view Back ground checks query. and Talent Groups query. Version - E-

  • Purpose of root.sh

    hey!!! can u guys plz tell\ me what is the purpose of running root.sh? what are the files created by root.sh after its running as root user..? thanx

  • Problem with Adobe Document Server and MSS PCR's

    Hello gurus, We are implementing ESS and MSS on ERP 2005, and our technical team is having lots of problems to make ADS work. Apparently the problem is that the ADS is not actually supported by SAP for 64-bit servers. But I need to configure MSS PCR'