BDC or BAPI for ME51N

Dear ABAP Guru
I need help to upload data Header, Item data to ME51N
Regards
Asish

Hi Raj,
You can use BAPI BAPI_REQUISITION_CREATE to create purchase requisition.
You can use program MMWE0F01 as reference in which this BAPI is used, also you can refer BAPI's documentation.
Hope this will solve your problem.
Regards,
Brajvir
Edited by: Brajvir  Singh on Sep 15, 2008 12:37 PM

Similar Messages

  • BDC OR BAPI - FOR FB01 T-CODE

    Dear all,
    I am facing one problem for upload the data from excel to FB01 T-code..
    here my excel sheet is like this
    Doc Date Posting date Doc type Posting key GL account Amount Posting key GL account Amount
    03.04.2010     03.04.2010          40     60011     8391                          50 & GL & TAX again repeate....
    04.04.2010     04.04.2010          40     60011     5496     40     60012     2198   50 & GL & TAX
    05.04.2010     05.04.2010          40     60011     7887     40     60012     0        50 & GL & TAX
    How should i do the program.....
    plz give me any bapi program or bdc program for this type excel sheet....
    plz help me..
    Regards
    margani

    Posting FI documents is one of the more frequently discussed topics here, please search before posting. Do not expect complete solutions for requirements, always work yourself first.
    Thread locked.
    Thomas

  • BDC or BAPI for me01 and me02 please read the requirement below

    Hi Experts
    I am having one requirement ,that
    I need to write a BDC program for Source list
    My alt file is having 3 filed with
    matnr werks lifnr
    if the material no and werks are same and the lifnr is not existing then it has to add the new vendor with the material and werks to the source list
    if matnr  werks and lifnr are not existing then need to create a new source list
    flat file
    10000001 4200 0230000000
    10000001 4200 0230000000
    10000001 4200 0230000000
    10000001 4200 0230000001
    10000002 4210 0230000002
    see in this flat file I'm having two diffrent vendors
    suppose in eord table existing
    matnr , werks,lifnr
    10000001   4200 0230000000
    so nw it has to check for whether vendor is existing or not if existing nothing to do if not then it has to add the new vendor
    if matnr werks and lifnr or not existing then it has to create new source list       
    means create the vendor
    Is there any BAPI or any sample prog is thr    please provide me
    WILL GIVE YOU POINTS IMMEDIATELY
    Thanks in advance

    Hi
    You can search in SDN for regarding Table Control and also go through the below links:
    Here are some of the links
    Re: Handling The Table Control while working with BDC
    Re: how do we handle BDC table control
    Re: how to create bdc with table control
    Regards,
    Vishwa.

  • BDC or BAPI for Transaction  IFCU

    Is it possible to do a BDC for transaction IFCU.IF not is there a Bapi to put the measurment documents for an equipment

    you can try function module ITOB_CONSUMPTION_UPDATE

  • BDC or BAPI for Actual period Locking

    Hi,
    Thank You very much for reading this query.
    I have to deveop the SE38 program with a selection screen which should contain following fields.
    1) Controlling Area
    2) Fiscal period,
    3) Fiscal year
    4) Version,
    5) Actual/Plan
    6) Lock/Unlock
    7) Business transaction.
    My requirement is if user creates a variant by giving proper values and runs the job, it should lock the given the business transactions.Functionally this task will be done by functional people in OKP1 transaction code (CO-Controlling.)
    Please suggest me if any BAPI is there and shall I go ahead with BDC.
    The problem if i go with BDC is, some times user may scroll down the table control depending on the given values. So how to satisfy this condition.
    Thanks and Regards,
    K.krishna Chaitanya.

    Hi Krishna,
    I know this is an old post, but in case someone else comes across it while searching for a solution to this same problem (as I did), Sanjeev Kumar has written a document, Automate Period Opening in SAP which, among other things, discusses using report RKCOOKP1 (Set Period Locks in Batch) to set or delete period locks in controlling (OKP1). In addition to scheduling a job for RKCOOKP1 as the document demonstrates, you could also call RKCOOKP1 programmatically with SUBMIT report ... AND RETURN.
    Cheers,
    Amy

  • User Exit/BADI/BAPI for ME51n

    Hi Experts,
           My requirement is somewhat like this: I need to capture all the EBAN and EBKN data for a NEW PR created. Could you please tell me which User Exit or BADI or BAPI can be used to capture the details AFTER the SAVE button is pressed in ME51N (Create PR)? Most probably it should one of the last ones called just before insertion into the database??!!
    Thanks a lot in advance. Your input would be of great help.
    Amrita.

    Hi
    For PR creation ME51N will call BAPI_PR_CREATE.
    For more information, refer to the interface documentation: IF_EX_ME_BAPI_PR_CREATE_02
    Standard settings
    The BAdI can be used multiple times.
    There is no default implementation.
    Information about the implementation of BAdIs in the context of the Enhancement Concept is available in the SAP Library for SAP NetWeaver under BAdIs - Implementation.
    Example
    The class CL_EXM_IM_ME_BAPI_PR_CUST is available for an example implementation

  • BDC or BAPI for updating IE02

    hello all,
    i need to update description ,manufacturer, model number, part number, serial number for a given EQUIPMENT number in Transaction = IE02.
    i need to update some 200 records which are in excel sheet...
    do i need to use BDC(recording method) or do i need to use any BAPI...
    any suggestions....
    thankq....

    hi srimanta,
    my requirement is like this...
    data : BEGIN OF wa_itab,
            equnr type equnr,   "(equipment number)
            eqktu type eqktu,   "(equipment description)
            begru type begru,   "(authorization group T370B-begru)
            herst type herst,   "(manfacturer ITOB-herst)
            TYPBZ type typbz,   "(manfacturer model number itob-typbz)
            MAPAR type mapar,   "(manfacturer part number itob-mapar)
            serge type serge,   "(manfcaturer serial number itob-serge)
            END OF wa_itab.
    data : it_itab LIKE TABLE OF wa_itab.
    data : data_general type BAPI_ITOB.
    loop at it_itab into wa_itab.
    data_general-AUTHGRP = wa_itab-begru.
    data_general-MANFACTURE = wa_itab-herst.
    data_general-MANMODEL = wa_itab-typbz.
    data_general-MANPARNO = wa_itab-mapar.
    data_general-MANSERNO = wa_itab-serge.
    CALL FUNCTION 'BAPI_EQUI_CHANGE'        "BAPI to change serial number details
             EXPORTING
               EQUIPMENT         = wa_itab-equnr
               DATA_GENERAL      = data_general
               DATA_GENERALX     = L_DATA_GENX
               DATA_SPECIFIC     = L_DATA_SPECIFIC
               DATA_SPECIFICX    = L_DATA_SPECIFICX
             IMPORTING
               DATA_GENERAL_EXP  = L_1
               DATA_SPECIFIC_EXP = L_2
               RETURN            = L_3.
    what do i need to pass for(  L_DATA_GENX,  L_DATA_SPECIFIC,  L_DATA_SPECIFICX)
    is data_general is not sufficient....
    i have used BAPI_TRANSACTION_COMMIT at the end but the data is not changed ...

  • BDC or BAPI for HUP1 transaction?

    Dear All,
    I am trying record HUP1 transaction but not able to get HU number in recording.
    Even I tried BAPI_HU_CREATE for creating HU number and this BAPI creates HU number but when I saved HUP1
    the system genrate one more HU number (new HU number).
    Please Suggest me the any solution for HUP1 recording.
    Hu Number creation is done in background .
    Help will be appriciated.
    Thanks and Regards
    Steve

    Hi Steve,
    BAPI_HU_CREATE itself creates HU. You can refer the HU number genrated by this BAPI itself. I hope you are calling bapi as below:
    CALL FUNCTION 'BAPI_HU_CREATE'
                EXPORTING
                  HEADERPROPOSAL = L_WA_HU_HEAD
                IMPORTING
                  HUHEADER       = L_WA_HU_HEADER
                  HUKEY          = L_V_HU_NUMBER
                TABLES
                  ITEMSPROPOSAL  = L_I_HU_ITEM
                  RETURN         = I_HU_RETURN
                  HUITEM         = L_I_CREATE_HU.
    Here, L_V_HU_NUMBER is the HU generated.
    Thanks,
    Archana
    Edited by: Archana Pawar on Sep 29, 2010 7:47 AM

  • Where I hv to SAVE the ERROR file, got in RETURN table of BAPI for ME51N?

    Hi Experts,
    Pls. clarify one of my simple doubt that, the functional owner have been asked to create a ERROR file(has given name as PR_ERROR_FILE), for the encountered errors, while uploading the data from flat file into Data Base for Purchase requisation-ME51N tx.
    So, am thinking to upload by using a BAPI_PR_CREATE.
    1) So, I can catch the ERRORS in RETURN table, then , pls. let me  now that, Where I hv to SAVE/Create this ERROR file-PR_ERROR_FILE? Is it C drive?
    2) Is I hv to SAVE as a Flat file format?
    (the functional guy, is not availble)
    Functinal guy words are,
    For any errors that occur, those should be written out to an error file so that users can review and correct.
    The error file should be name PR_ERRORS_FILE
    thanq

    No this will be save in the aplication server only...on the given path so any one can read it and rectify the error.

  • BDC or BAPI for BAPI for Cross-Plant Configuration

    Hi,
    I am doing BDC for MM02 for Cross Plant configuration in SHDB recording I can See only 10 line item where i can give confiugaration Details.
    I am Unable to record the curser if the chrarcterstics have more than 10 lines
    Any inputs Please.
    Thanks in advance.
    Rasheed

    Screen is having only 10 lines but when you update its taking all lines of the data.

  • Error in uploding data using bapi for me51n("urgent")

    i am getting the error "error in function,000 does not exist"
    i am sending u the code & txt file plz check it out and let me know..
    REPORT  zrv_bapi_pr.
    DATA: BEGIN OF itab OCCURS 0,
                bsart(4),
               ."Purchase requisition document type
                txz01(40),
               ."Short text
                menge(13),
               ."Purchase requisition quantity
                meins(3),
               ."Purchase requisition unit of measure
                eeind LIKE bapiebanc-deliv_date,
               ."Item delivery date
                wgbez(9),
               ."Material Group
                name1(4),
               ."Plant
                ekgrp(3),
               ."Purchasing Group
                afnam(12),
               ."Name of requisitioner/requester
                bednr(10),
               ."Requirement Tracking Number
                knttp(1),
               ."Account assignment category
                sakto(10),
               ."G/L Account Number
                ps_posid(8),
               ."Work Breakdown Structure Element (WBS Element)
                editor(132),
               ."Text line
          END OF itab.
    DATA: itab_bapiebanc  LIKE bapiebanc  OCCURS 0 WITH HEADER LINE.
    DATA: itab_bapiebkn   LIKE bapiebkn   OCCURS 0 WITH HEADER LINE.
    DATA: itab_bapiebantx LIKE bapiebantx OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF errmsg OCCURS 10.
            INCLUDE STRUCTURE bapiret2.
    DATA: END OF errmsg.
    DATA: errflag.
    CALL FUNCTION 'UPLOAD'
      EXPORTING
        filename = 'C:\Documents and Settings\sap\Desktop\New Text Document (2).txt'
        filetype = 'DAT'
      TABLES
        data_tab = itab.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      EXIT.
    ENDIF.
    LOOP AT itab.
      itab_bapiebanc-doc_type       =    itab-bsart.
      itab_bapiebanc-short_text     =    itab-txz01.
      itab_bapiebanc-quantity       =    itab-menge.
      itab_bapiebanc-unit           =    itab-meins.
      itab_bapiebanc-deliv_date     =    itab-eeind.
      itab_bapiebanc-plant          =    itab-name1.
      itab_bapiebanc-pur_group      =    itab-ekgrp.
      itab_bapiebanc-preq_name      =    itab-afnam.
      itab_bapiebanc-trackingno     =    itab-bednr.
      itab_bapiebanc-mat_grp        =    itab-wgbez.
      itab_bapiebanc-acctasscat     =    itab-knttp.
      itab_bapiebkn-g_l_acct        =    itab-sakto.
      itab_bapiebkn-wbs_elem_e      =    itab-ps_posid.
      itab_bapiebantx-text_line     =    itab-editor.
      APPEND itab_bapiebkn.
      APPEND itab_bapiebanc.
      APPEND itab_bapiebantx.
    ENDLOOP.
    CALL FUNCTION 'BAPI_REQUISITION_CREATE'
      TABLES
        requisition_items              = itab_bapiebanc
        requisition_account_assignment = itab_bapiebkn
        requisition_item_text          = itab_bapiebantx
        return                         = errmsg.
    LOOP AT errmsg.
      IF errmsg-type EQ 'E'.
        WRITE:/'Error in function', errmsg-message.
        errflag = 'X'.
      ELSE.
        WRITE:/ errmsg-message.
      ENDIF.
    ENDLOOP.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    *LOOP AT itab_bapiebanc.
    WRITE:/   itab_bapiebanc-doc_type,
          itab_bapiebanc-short_text,
          itab_bapiebanc-quantity,
          itab_bapiebanc-unit ,
        itab_bapiebanc-deliv_date,
        itab_bapiebanc-plant,
        itab_bapiebanc-pur_group,
        itab_bapiebanc-preq_name,
        itab_bapiebanc-trackingno,
        itab_bapiebanc-mat_grp,
          100 itab_bapiebanc-acctasscat.
    *ENDLOOP.
    *LOOP AT itab_bapiebkn.
    WRITE:/
                 itab_bapiebkn-g_l_acct,
                 itab_bapiebkn-wbs_elem_e.
    *ENDLOOP.
    *LOOP AT itab_bapiebantx.
    WRITE:/ itab_bapiebantx-text_line.
    *ENDLOOP.
    txt file
    NB     MOTOR     2     EA     20.04.2006     18000000     0020     010     SANGEETE     J505     P     4000     J525.2.2     crompton greaves make,3 phase motor

    Hi Ravi,
    Please use FM <b>GUI_UPLOAD</b> instead of FM UPLOAD (obsolete).
    call function 'GUI_UPLOAD'
      exporting
        filename            = 'C:Documents and SettingssapDesktopNew Text Document (2).txt'
        filetype            = 'DAT'
      tables
        data_tab            = itab.
    loop at itab.
    endloop.
    I think your error is related to line item in internal table <b>itab_bapiebanc</b>. You need to increment for each loop.
    Hope this will help.
    Regards,
    Ferry Lianto

  • BAPI for FB50 tcode

    hi all,
    Can any body please give me report using BDC or BAPI for FB50 Tcode.......
    Regards,
    Imran

    hi
    List of all BAPIs
    http://www.planetsap.com/LIST_ALL_BAPIs.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sappoint.com/abap/bapiprg.pdf
    http://www.sappoint.com/abap/bapiactx.pdf
    http://www.sappoint.com/abap/bapilst.pdf
    http://www.sappoint.com/abap/bapiexer.pdf
    http://service.sap.com/ale
    http://service.sap.com/bapi
    http://www.geocities.com/mpioud/Abap_programs.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    regards
    ravish
    <b>plz dont forget to reward points if helpful</b>

  • BDC for me51n help

    hi there,
    can some one help me out with a BDC for the transaction me51n, i am not able to create a BDC for this.
    Kindly suggest.
    thanks

    using the BAPI, BAPI_REQUISITION_CREATE to create your purchase reqs. ME51N is an enjoy transaction and will not get along with BDC very well.
    For ME51N, use bapi BAPI_REQUISITION_CREATE
    See the below thread to see the example programs for this BAPI,
    Re: BAPI_REQUISITION_CREATE

  • BAPI for Transaction ME51N?

    How to devlop Purchase Requisition BAPI for Transaction ME51N?

    Hi vamshi,
    We have BAPI
    BAPI_REQUISITION_CREATE
    BAPI_PR_CREATE
    BAPI_REQUISITION_CHANGE
    BAPI_PR_CHANGE
    Please check this link
    FOR CREATING:
    http://www.erpgenie.com/abap/bapi/example.htm
    http://www.****************/Tutorials/BAPI/CustomBAPICreation2/page1.htm
    Best regards,
    raam

  • BDC / Bapi For  Post Incoming Payment (F-28)

    Hi
    Im creating BDC for F-28. But it got error coming out.
    >> It says DB05B-PSZAH(02) is not an input field.
    What I do is: First, I search for Line Item then Document Number. Then It return to basic list. Then I loop again for the second Line Item Number and Document Number.
    I can activate the first amount but cannot for the next amount and so on.
    Anybody could help me on this??
    Is there any BAPI for Post Incoming Payment (F-28)?
    Thank you.
    Regards.

    i dont think there is a BAPI for this Transaction...
    i have done a BDC on F-28 myself....pasting the code....hope it helps you....
    *******NOTE********
    the parameter in the subroutine is to see if there is a single document or multiple documents being posted.
    FORM fill_bdc_data_f-28_9005 USING p_i_mult_doc TYPE c.
    **BDC from screen 9005
      DATA : l_amt_bdc(13), l_amt_bdc_remain(13), l_amt_bdc_mult(13),
             l_amt_bdc_mult_remain(13), l_assignment(14), l_period(2),
             l_amount(13).
      CLEAR t_bdcdata.
      REFRESH t_bdcdata.
      PERFORM bdc_dynpro USING 'SAPMF05A' '0103'.
      PERFORM bdc_field USING 'BDC_OKCODE' '=AB'.   "OK CODE - doc overview
    **get user default date format and pass date in that format
      PERFORM convert_date_to_user_format USING bkpf-bldat.
      PERFORM bdc_field USING 'BKPF-BLDAT' w_date.  "cheque date
      CLEAR w_date.
      PERFORM bdc_field USING 'BKPF-BLART' i_blart.  "doc type
      PERFORM bdc_field USING 'BKPF-BUKRS' i_bukrs.  "comp code
    **get user default date format and pass date in that format
      PERFORM convert_date_to_user_format USING bkpf-budat.
      PERFORM bdc_field USING 'BKPF-BUDAT' w_date.  "posting date
      CLEAR w_date.
      l_period = sy-datum+4(2).
      PERFORM bdc_field USING 'BKPF-MONAT' l_period. "period
      PERFORM bdc_field USING 'BKPF-WAERS' 'INR'.    "currency
      PERFORM bdc_field USING 'BKPF-BKTXT' i_bankl.  "doc. hdr. text
      PERFORM bdc_field USING 'BKPF-XBLNR' i_xblnr.  "Ref. Document No.
      PERFORM bdc_field USING 'BSEG-ZUONR' i_zuonr.  "Assignment(Depot Code)
      PERFORM bdc_field USING 'RF05A-KONTO' i_bank_gl. "Bank GL acc
      PERFORM bdc_field USING 'BSEG-GSBER' i_gsber.  "Business Area
      l_amount = bseg-wrbtr.
      PERFORM bdc_field USING 'BSEG-WRBTR' l_amount. "Amount
      PERFORM bdc_field USING 'BSEG-PRCTR' ''.  "Profit Center
    **open items data
      PERFORM bdc_field USING 'RF05A-AGKOA' 'D'.     "Acc type (D=customers)
      PERFORM bdc_field USING 'RF05A-XNOPS' 'X'.     "Std OIs check box
    **end of first screen
    **document overview screen
      PERFORM bdc_dynpro USING 'SAPMF05A' '0700'.    "Overview Screen
      PERFORM bdc_field USING 'BDC_CURSOR' 'RF05A-AZEI1(01)'.     "cursor
      PERFORM bdc_field USING 'BDC_OKCODE' '/00'.     "OK CODE
      PERFORM bdc_field USING 'RF05A-NEWBS' '19'.    "posting key
      PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
      PERFORM bdc_field USING 'RF05A-NEWUM' 'B'.     "Spl GL Indicator
    **for single document selected
      CLEAR l_amt_bdc.
      IF p_i_mult_doc = ''.
    ***new screen - next line item
        PERFORM bdc_dynpro USING 'SAPMF05A' '0303'.
        PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE
    **for single document, use the bouncing amount calculated earlier
        l_amt_bdc = w_amt_ant_bouncing.
        PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc. "amount
    **due date - same as posting date on screen
    **get user default date format and pass date in that format
        PERFORM convert_date_to_user_format USING bkpf-budat.
        PERFORM bdc_field USING 'BSEG-ZFBDT' w_date.  "due date
        CLEAR w_date.
    **assignment
        CLEAR l_assignment.
        CONCATENATE t_seldoc_ant_bouncing-belnr
                    t_seldoc_ant_bouncing-gjahr INTO l_assignment.
        PERFORM bdc_field USING 'BSEG-ZUONR' l_assignment. "assignment
        PERFORM bdc_field USING 'BSEG-GSBER' i_gsber.
    **if there is some remaining amount, then go for another line item
        IF w_rem_amt_ant_bouncing > 0.
          PERFORM bdc_field USING 'RF05A-NEWBS' '15'.    "posting key
          PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
    **new screen
          PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
          PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-ZTERM'. "CURSOR
          PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE-ENTER
          l_amt_bdc_remain = w_rem_amt_ant_bouncing.
          PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_remain.
          PERFORM bdc_field USING 'BSEG-ZTERM' '0001'.
    **AGAIN
          PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
          PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-WRBTR'. "CURSOR
          PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE-SAVE
          PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_remain.
          PERFORM bdc_field USING 'BSEG-ZTERM' '0001'. "pmt term -hardcoded
          PERFORM bdc_field USING 'BSEG-SKFBT' l_amt_bdc_remain.
        ENDIF.
    **multiple documents
      ELSE.
    **initialize remaining amount to amt entered on screen
        l_amt_bdc_mult_remain = bseg-wrbtr.
        LOOP AT t_seldoc_ant_bouncing.
          IF l_amt_bdc_mult_remain > 0.
            IF bseg-wrbtr > t_seldoc_ant_bouncing-rem_amt.
              l_amt_bdc_mult = t_seldoc_ant_bouncing-rem_amt.
            ELSE.
              l_amt_bdc_mult = bseg-wrbtr.
            ENDIF.
    **remaining amt = screen amt - amt calculated above.
            l_amt_bdc_mult_remain = l_amt_bdc_mult_remain - l_amt_bdc_mult.
            PERFORM bdc_dynpro USING 'SAPMF05A' '0303'.
            PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE
            PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_mult. "amount
            PERFORM bdc_field USING 'BSEG-GSBER' i_gsber.  "Business Area
    **due date - same as posting date on screen
    **get user default date format and pass date in that format
            PERFORM convert_date_to_user_format USING bkpf-budat.
            PERFORM bdc_field USING 'BSEG-ZFBDT' w_date.  "due date
            CLEAR w_date.
    **assignment
            CLEAR l_assignment.
            CONCATENATE t_seldoc_ant_bouncing-belnr
                        t_seldoc_ant_bouncing-gjahr INTO l_assignment.
            PERFORM bdc_field USING 'BSEG-ZUONR' l_assignment. "assignment
    **posting key 19 for all but last document
            PERFORM bdc_field USING 'RF05A-NEWBS' '19'.    "posting key
            PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
            PERFORM bdc_field USING 'RF05A-NEWUM' 'B'.     "Spl GL
          ENDIF.
        ENDLOOP.
      ENDIF.
    **post remaining amount
      IF p_i_mult_doc = 'X'.
    **new screen if there is some amount left
        IF l_amt_bdc_mult_remain > 0.
    **posting key 15 with remaining amount
          PERFORM bdc_field USING 'RF05A-NEWBS' '15'.    "posting key
          PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
          PERFORM bdc_field USING 'RF05A-NEWUM' ''.     "Spl GL
    **new screen
          PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
          PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE
          PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_mult_remain.
          PERFORM bdc_field USING 'BSEG-ZTERM' '0001'. "pmt term - hardcoded
        ELSE.
    **if no amount is left, no need for a further line item
          PERFORM bdc_field USING 'RF05A-NEWBS' ''.    "posting key
          PERFORM bdc_field USING 'RF05A-NEWKO' ''. "customer
          PERFORM bdc_field USING 'RF05A-NEWUM' ''.     "Spl GL
        ENDIF.
      ENDIF.
    **clear variables
      CLEAR : l_amount, l_assignment, l_amt_bdc,
              l_amt_bdc_remain,l_amt_bdc_mult, l_amt_bdc_mult_remain.
    ENDFORM.                    " fill_bdc_data_F-28_9005

Maybe you are looking for