How to Use Bapi - " BAPI_PRICES_CONDITIONS "

Hi Gurus,
      Can any one please let us know how we can use <b>BAPI_PRICES_CONDITIONS</b> for either creating or changing Price Conditions.
Please see my code below for creating Price condition :-
Please correct it and send me the code for both <b>changing</b> and <b>creating</b> price condition.
*& Report  ZAVI_BAPI_TEST
REPORT  zavi_bapi_test.
DATA: table1 TYPE STANDARD TABLE OF bapicondct,
      table2 TYPE STANDARD TABLE OF bapicondhd,
      table3 TYPE STANDARD TABLE OF bapicondit,
      table4 TYPE STANDARD TABLE OF bapicondqs,
      table5 TYPE STANDARD TABLE OF bapicondvs,
      table6 TYPE STANDARD TABLE OF bapiret2,
      table7 TYPE STANDARD TABLE OF bapiknumhs,
      table8 TYPE STANDARD TABLE OF cnd_mem_initial,
      ret    TYPE STANDARD TABLE OF bapiret2  WITH HEADER LINE.
DATA: wtable1 TYPE bapicondct,
          wtable2 TYPE bapicondhd,
          wtable3 TYPE bapicondit,
          wtable4 TYPE bapicondqs,
          wtable5 TYPE bapicondvs,
          wtable6 TYPE bapiret2,
          wtable7 TYPE bapiknumhs,
          wtable8 TYPE cnd_mem_initial.
wtable1-table_no    = '305'.
wtable1-applicatio   = 'V'.
wtable1-cond_type  = 'ZFOR'.
wtable1-operation   = '004'.
wtable1-varkey       = '13001001EUR 000000000050068946'.
*wtable1-varkey      = '0001010000000017000000000000000096'.
wtable1-valid_to      = '99991231'.
wtable1-valid_from  = '20071017'.
wtable1-cond_no    = '0000007269'.
APPEND wtable1 TO table1.
wtable2-operation     = '004'.
wtable2-cond_no      = '0000007269'.
wtable2-created_by  = sy-uname.
wtable2-creat_date   = '20071017'.
wtable2-cond_usage = 'A'.
wtable2-table_no      = '305'.
wtable2-applicatio     = 'V'.
wtable2-cond_type    = 'ZFOR'.
wtable2-varkey         = '13001001EUR 000000000050068946'.
*wtable1-varkey        = '0001010000000017000000000000000096'.
wtable2-valid_from    = '20071017'.
wtable2-valid_to        = '99981231'.
APPEND wtable2 TO table2.
wtable3-operation      = '004'.
wtable3-cond_no       = '0000007269'.
wtable3-cond_count   = '01'.
wtable3-applicatio      = 'V'.
wtable3-cond_type     = 'ZFOR'.
wtable3-scaletype      = 'A'.
wtable3-scalebasin     = 'C'.
wtable3-scale_qty      = '1'.
wtable3-cond_p_unt   = '1'.
wtable3-cond_unit      = 'EA'.
wtable3-calctypcon    = 'C'.
wtable3-cond_value    = '444'.
wtable3-condcurr        = 'EUR'.
APPEND wtable3 TO table3.
CALL FUNCTION 'BAPI_PRICES_CONDITIONS'
EXPORTING
PI_initialmode = 'X'
PI_BLOCKNUMBER =
TABLES
   ti_bapicondct  = table1
   ti_bapicondhd  = table2
   ti_bapicondit  = table3
   ti_bapicondqs  = table4
   ti_bapicondvs  = table5
   to_bapiret2    = table6
   to_bapiknumhs  = table7
   to_mem_initial = table8
EXCEPTIONS
   update_error   = 1
   OTHERS         = 2
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
READ TABLE table6 WITH KEY type = 'E' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
  LOOP AT table6 INTO ret.
    WRITE: / ret-type, ret-message, ret-id, ret-log_no, ret-log_msg_no,
                  ret-message_v1, ret-message_v2, ret-message_v3, ret-message_v4,
                  ret-parameter,ret-row,ret-field.
  ENDLOOP.
ELSE.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*EXPORTING
WAIT =
  IMPORTING
  return = ret
ENDIF.

Please refer to this code.....
wtable1-table_no = '306'.
wtable1-applicatio = 'V'.
wtable1-cond_type = 'ZPR0'.
wtable1-operation = '009'.
wtable1-varkey = '13001001USD 000000000050068946'.
wtable1-valid_to = '99991231'.
wtable1-valid_from = '20051101'.
wtable1-cond_no = '$000000001'.
APPEND wtable1 TO table1.
wtable2-operation = '009'.
wtable2-cond_no = '$000000001'.
wtable2-created_by = sy-uname.
wtable2-creat_date = '20051022'.
wtable2-cond_usage = 'A'.
wtable2-table_no = '110'.
wtable2-applicatio = 'V'.
wtable2-cond_type = 'ZPR0'.
wtable2-varkey = '13001001USD 000000000050068946'.
wtable2-valid_from = '20051101'.
wtable2-valid_to = '99991231'.
APPEND wtable2 TO table2.
wtable3-operation = '009'.
wtable3-cond_no = '$000000001'.
wtable3-cond_count = '01'.
wtable3-applicatio = 'V'.
wtable3-cond_type = 'ZPR0'.
wtable3-scaletype = 'A'.
wtable3-scalebasin = 'C'.
wtable3-scale_qty = '1'.
wtable3-cond_p_unt = '1'.
wtable3-cond_unit = 'EA'.
wtable3-calctypcon = 'C'.
wtable3-cond_value = '454'.
wtable3-condcurr = 'USD'.
APPEND wtable3 TO table3.
CALL FUNCTION 'BAPI_PRICES_CONDITIONS'
EXPORTING
PI_initialmode = 'X'
PI_BLOCKNUMBER =
TABLES
ti_bapicondct = table1
ti_bapicondhd = table2
ti_bapicondit = table3
ti_bapicondqs = table4
ti_bapicondvs = table5
to_bapiret2 = table6
to_bapiknumhs = table7
to_mem_initial = table8
EXCEPTIONS
update_error = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
READ TABLE table6 WITH KEY type = 'E' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
loop at table6 into ret.
write: / ret-type, ret-message, ret-id, RET-LOG_NO, RET-LOG_MSG_NO,
RET-MESSAGE_V1, RET-MESSAGE_V2, RET-MESSAGE_V3, RET-MESSAGE_V4,
RET-PARAMETER,RET-ROW,RET-FIELD.
endloop.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*EXPORTING
WAIT =
IMPORTING
return = ret
ENDIF.
Re: Problem with BAPI_PRICES_CONDITIONS
Re: Sample code for  BAPI_PRICES_CONDITIONS
Re: Problem with BAPI_PRICES_CONDITIONS
Re: Sample code for  BAPI_PRICES_CONDITIONS

Similar Messages

  • Problem with Multiple record creation using BAPI BAPI_PRICES_CONDITION

    Hi,
    I am working on IS Media Sales And Distribution wherein i am using BAPI BAPI_PRICES_CONDITION for condition record creation in TCODE JC9B. I am able to create one record using this BAPI for one sales promotion but having problem while creation of multiple records for the same sales promotion wherein my internal table have multiple records. It gives me error that data in BAPICONDIT is missing.
    I am aatching followig code for reference
    BAPI have field of varkey which i am filling as combination of sales org. + distn channel + sales promotion + delivery type
    In this varkey  delivery type is changing for sales promotion Can be said that one sales promotion can have multiple delivery type .
    Am i giving the correct varkey for each itration of internal table ?
    I am attaching code for reference.
    Here loop it_cond contain one promotion and multiple delivery type.
    sales org   distn ch  promotion     delivery
    0100             01        zsalesprom   03
    0100             01        zsalesprom   z3
      LOOP AT it_cond INTO wa_cond.
    Get next condition number
          CALL FUNCTION 'NUMBER_GET_NEXT'
            EXPORTING
              nr_range_nr                   = '01'
              object                        = 'KONH'
      QUANTITY                      = '1'
      SUBOBJECT                     = ' '
      TOYEAR                        = '0000'
      IGNORE_BUFFER                 = ' '
           IMPORTING
              number                        = number
      QUANTITY                      =
      RETURNCODE                    =
    EXCEPTIONS
      INTERVAL_NOT_FOUND            = 1
      NUMBER_RANGE_NOT_INTERN       = 2
      OBJECT_NOT_FOUND              = 3
      QUANTITY_IS_0                 = 4
      QUANTITY_IS_NOT_1             = 5
      INTERVAL_OVERFLOW             = 6
      BUFFER_OVERFLOW               = 7
      OTHERS                        = 8
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    Here i am concacating varkey for each new delivery
    CLEAR : l_min,l_length,l_var.
    CONCATENATE wa_cond-vkorg wa_cond-vtweg wa_cond-wrbakt INTO l_var.
    l_length = STRLEN( l_var ).
    IF l_var+14(2) IS INITIAL.
    WRITE wa_cond-lifart TO L_VAR+14.
    l_length = STRLEN( l_var ).
    ENDIF.
    W_LINE = W_LINE + 1.
    *First table in BAPI
            wa_bapicondct-operation = '009'.
            wa_bapicondct-cond_usage = 'A'.
            wa_bapicondct-table_no = '506'.
            wa_bapicondct-applicatio = 'J0'.
            wa_bapicondct-cond_type = 'RATE'.
            wa_bapicondct-varkey = l_var.
            wa_bapicondct-valid_to = wa_cond-datbi.
            wa_bapicondct-valid_from = wa_cond-datab.
            wa_bapicondct-cond_no = number. "
            APPEND wa_bapicondct TO it_bapicondct.
    *Second table in BAPI
            wa_bapicondhd-operation = '009'.
            wa_bapicondhd-cond_no = number.
            wa_bapicondhd-cond_usage = 'A'.
            wa_bapicondhd-table_no = '506'.
           wa_bapicondhd-created_by = sy-uname.
           wa_bapicondhd-creat_date = sy-datum.
            wa_bapicondhd-applicatio = 'J0'.
            wa_bapicondhd-cond_type = 'RATE'.
            wa_bapicondhd-varkey = l_var.
            wa_bapicondhd-valid_from = wa_cond-datab.
            wa_bapicondhd-valid_to = wa_cond-datbi.
            APPEND wa_bapicondhd TO it_bapicondhd.
    *Third table in BAPI
            wa_bapicondit-operation = '009'.
            wa_bapicondit-cond_no = number.
            wa_bapicondit-cond_count = wa_cond-cond_count.
            wa_bapicondit-applicatio = 'J0'.
            wa_bapicondit-cond_type = 'RATE'.
            wa_bapicondit-calctypcon = 'C'.
           wa_bapicondit-scaletype  = 'A'.
            wa_bapicondit-cond_value = wa_cond-kbetr.
            wa_bapicondit-condcurr = wa_cond-konwa.
            wa_bapicondit-promotion = wa_cond-wrbakt.
            APPEND wa_bapicondit TO it_bapicondit.
    *Fourth table in BAPI
            wa_bapicondqs-operation = '009'.
            wa_bapicondqs-cond_no = number.
            wa_bapicondqs-cond_count = wa_cond-cond_count.
            wa_bapicondqs-currency = wa_cond-kbetr.
            wa_bapicondqs-condcurr = wa_cond-konwa.
           wa_bapicondqs-cond_unit = 'EA'.
            wa_bapicondqs-LINE_NO = W_LINE."'0001'.
            APPEND wa_bapicondqs TO it_bapicondqs.
    *Fifth table in BAPI
            wa_bapicondvs-operation = '009'.
            wa_bapicondvs-cond_no = number.
            wa_bapicondvs-cond_count = wa_cond-cond_count.
            wa_bapicondvs-currenckey = wa_cond-konwa.
            wa_bapicondvs-currenciso = wa_cond-konwa.
           wa_bapicondvs-currency = wa_cond-kbetr.
           wa_bapicondvs-condcurr = wa_cond-konwa.
           wa_bapicondvs-curren_iso = wa_cond-konwa.
           wa_bapicondvs-LINE_NO = W_LINE."'0001'.
            APPEND wa_bapicondvs TO it_bapicondvs.
            CALL FUNCTION 'BAPI_PRICES_CONDITIONS'
    EXPORTING
      PI_INITIALMODE       = ' '
      PI_BLOCKNUMBER       =
              TABLES
                ti_bapicondct        = it_bapicondct
                ti_bapicondhd        = it_bapicondhd
                ti_bapicondit        = it_bapicondit
                ti_bapicondqs        = it_bapicondqs
                ti_bapicondvs        = it_bapicondvs
                to_bapiret2          = it_bapiret2
                to_bapiknumhs        = it_bapiknumhs
                to_mem_initial       = it_cnd_mem_initial
             EXCEPTIONS
               update_error         = 1
               OTHERS               = 2
            IF sy-subrc <> 0.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            ENDIF.
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
             EXPORTING
               wait          = 'X'
    IMPORTING
      RETURN        =
            CLEAR : wa_bapicondct,wa_bapicondhd,wa_bapicondvs,wa_bapicondqs.
            CLEAR : wa_bapicondit.
          ENDLOOP.
        ENDIF.
      ENDIF.
    Kindly Suggest.
    Thanks
    Parag

    Solved By myself
    There is problem while passing data to internal table for item level

  • How to use bapi response in XI

    HI ALL,
             Can any one suggest me, how to use bapi response in XI as a sender.
    I m using bapi BAPI_BCA_BANKSTATEMENT_EXECUTE , I am executing  this bapi manually ,but want to use this BAPI RESPONSE in XI as a sender and map it with receiver.
    can i have any idea about how to do it, or can i have the idoc which is used by this bapi BAPI_BCA_BANKSTATEMENT_EXECUTE.
    THANX
    HONEY

    Hi Honey,
    Have a look at these
    -Configuring the Sender RFC Adapter - step by step
    /people/michal.krawczyk2/blog/2005/03/29/configuring-the-sender-rfc-adapter--step-by-step
    -Troubleshooting - RFC and SOAP scenarios
    /people/shabarish.vijayakumar/blog/2008/01/08/troubleshooting--rfc-and-soap-scenarios-updated-on-20042009
    -sender RFC (forum thread)
    Is it possible to use the RFC sender adapter for asynchronous calls?
    Regards,
    Sreenivas

  • How to use BAPI with Decision Dialogue

    Hi Gurus
    would you please let me know how to use BAPI with decision dialogue in guided procedure .
    I have a BAPI checking logon credentials for the user . how to use this BAPI for making decisions that is if the logon is correct then perform one process else go to logon screen again .
    Thanks in advance
    Regards Namita

    Hi Namita,
    1. Follow the steps mentioned in section <a href="http://help.sap.com/saphelp_crm50/helpdata/en/33/198141f906040de10000000a1550b0/frameset.htm">Exposing an RFC-Enabled Function Module as a Callable Object</a> to use the BAPI as a Callable Object.
    2. Follow the steps mentioned in tutorial # 93 and 93a in the CAF Tutorial Center for the decision part.
    Hope these helps.
    Nilay

  • How to use BAPI function module for maintaing product type to material

    Hi,
    Can you pls suggest me how to use BAPI Fuction module CCAP_REV_LEVEL_MAINTAIN
    for maintaining the product type for the material using change number.
    Pts will be rewarded.
    Best Regards,
    Padhy

    Hi,
    Can you pls suggest me how to use BAPI Fuction module CCAP_REV_LEVEL_MAINTAIN
    for maintaining the product type for the material using change number.
    Pts will be rewarded.
    Best Regards,
    Padhy

  • How to use Bapi

    Hi
    How to use bapis
    BAPI_COMPANYCODE_GET_PERIOD
    BAPI_CCODE_GET_FIRSTDAY_PERIOD'
    BAPI_GL_ACC_GETPERIODBALANCES'

    BAPI_COMPANYCODE_GET_PERIOD:
    To retrieve the fiscal year variant for a given date u can use the following function module
    Retrieve fiscal year and period
    The below code shows how to use function modules BAPI_COMPANYCODE_GET_PERIOD and
    DETERMINE_PERIOD to retrieve fiscal year and fiscal period for a specific date.
    *: Report: ZFISCALYR :
    *: Author: www.SAPdev.co.uk :
    *: Date : 2004 :
    *: Description: Demonstrates how to return the corresponding fiscal :
    *: year and posting period for a company code and posting :
    *: date or posting date and fiscal year variant. :
    REPORT zfiscalyr NO STANDARD PAGE HEADING.
    TABLES: ekko.
    PARAMETERS: p_bukrs TYPE ekko-bukrs,
    p_bedat TYPE ekko-bedat.
    DATA: gd_fiscalyr TYPE bapi0002_4-fiscal_year,
    gd_fiscalp TYPE bapi0002_4-fiscal_period.
    DATA: gd_fiscalyr2 TYPE T009B-BDATJ,
    gd_fiscalp2 TYPE bapi0002_4-fiscal_period.
    DATA: gd_periv TYPE t009-periv.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    get fiscal year and period - (requires date and company code)
    CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
    EXPORTING
    companycodeid = p_bukrs
    posting_date = p_bedat
    IMPORTING
    fiscal_year = gd_fiscalyr
    fiscal_period = gd_fiscalp.
    Alternative fiscal year function module
    - (requires date and fiscal year variant code from T009 table)
    gets first entry in fiscal year variant table (will need to choose
    correct one from table rather than just using first entry)
    SELECT SINGLE periv
    FROM t009
    INTO gd_periv.
    get fiscal year and period
    CALL FUNCTION 'DETERMINE_PERIOD'
    EXPORTING
    date = p_bedat
    PERIOD_IN = '000'
    version = gd_periv
    IMPORTING
    period = gd_fiscalp2
    year = gd_fiscalyr2
    EXCEPTIONS
    period_in_not_valid = 1
    period_not_assigned = 2
    version_undefined = 3
    OTHERS = 4.************************************************************************
    *END-OF-SELECTION.
    END-OF-SELECTION.
    WRITE:/ 'From function module: BAPI_COMPANYCODE_GET_PERIOD',
    / 'Fiscal year is:', gd_fiscalyr,
    / 'Fiscal period is:', gd_fiscalp.
    SKIP.
    WRITE:/ 'From function module: DETERMINE_PERIOD',
    / 'Fiscal year is:', gd_fiscalyr2,
    / 'Fiscal period is:', gd_fiscalp2.
    how to get the fiscal year
    BAPI_CCODE_GET_FIRSTDAY_PERIOD:
    CALL FUNCTION 'BAPI_CCODE_GET_FIRSTDAY_PERIOD'
    EXPORTING
    companycodeid = v_bukrs
    fiscal_period = marv-lfmon
    fiscal_year = marv-lfgja
    IMPORTING
    first_day_of_period = v_postdate
    return = i_return1.
    BAPI
    function module which could calculate the previous month's start date.....
    BAPI_GL_ACC_GETPERIODBALANCES:
    Transactions or BAPI for GL account
    Please give me reward point...

  • How to use BAPI to add a new version for a claim number in WTY transaction.

    How to use BAPI to add a new version for a claim number in WTY transaction.
    I am using  function module " BAPI_WARRANTYCLAIM_ADD_VERSION ".
    It needs to copy all contents of previous version to a new version.
    While doing so i am unable to copy fields like valic valoc etc. Any ways by which  i can copy this values.
    WTY will update PNWTYH , PNWTYV and PVWTY tables.
    Thanking you,
    Lokesh.

    Hi Vishnu,
    You can do that through EEWB. Please go through SAP Note 484597. You would get the details of using Easy Enhancement Work bench.
    Rewards point if you think this info is useful
    Regards,
    Dipender Singh

  • Will you tell me how to use BAPI "L_TO_CREATE_POSTING_CHANGE",please?

    Will you tell me how to use BAPI "L_TO_CREATE_POSTING_CHANGE" ,please?
    Is lt06 bapi "L_TO_CREATE_POSTING_CHANGE"&#65311;

    just do a where used list of the FM and see how its used in those programs.
    one of the programs where it is used = RLLQ0200
    Regards
    Raja

  • Hello !  pls give some ti[ps how to use bapi's for data uploading?

    hello !
      pls give some ti[ps how to use bapi's for data uploading?
    regards,
    Arjun

    Hi,
    See the below report extract:
    where it_data is having uploaded data.
    LOOP AT<b> it_data</b> INTO wa_data.
        line_count = sy-tabix.
        "Date Validation
        CONCATENATE wa_data-uplft_date4(4) wa_data-uplft_date2(2) wa_data-uplft_date+0(2)
        INTO wa_data-uplft_date.
        "READ TABLE it_ekko INTO wa_ekko WITH KEY lifnr = wa_data-vendor.
        LOOP AT it_ekko_temp INTO wa_ekko_temp WHERE lifnr = wa_data-vendor.
          IF wa_ekko_temp-kdatb <= wa_data-uplft_date AND wa_ekko_temp-kdate >= wa_data-uplft_date.
            MOVE-CORRESPONDING wa_ekko_temp TO wa_ekko.
            APPEND wa_ekko TO it_ekko.
          ENDIF.
        ENDLOOP.
        "IF sy-subrc = 0 AND wa_ekko-kdatb <= wa_data-uplft_date AND wa_ekko-kdate >= wa_data-uplft_date.
        LOOP AT it_ekko INTO wa_ekko.
          wa_data_header-pstng_date = wa_data-uplft_date.
          wa_data_header-doc_date = sy-datum.
          wa_data_header-bill_of_lading = wa_data-bill_of_lad.
          wa_data_header-ref_doc_no = wa_data-del_no.
          CONCATENATE wa_data-header_text1 '-'
                      wa_data-header_text2 '-'
                      wa_data-header_text3 '-'
                      wa_data-header_text4
                      into wa_data_header-HEADER_TXT.
          IF wa_data-indicator = 'Y'.
            wa_data_item-material = '000000000000200568'.
          ELSE.
            wa_data_item-material = '000000000000200566'.
          ENDIF.
          LOOP AT it_ekpo INTO wa_ekpo WHERE ebeln = wa_ekko-ebeln AND matnr = wa_data_item-material.
            "Collect Item Level Data
            wa_data_item-plant = '1000'.
            wa_data_item-stge_loc = '1001'.
            wa_data_item-move_type = '101'.
            wa_data_item-vendor = wa_data-vendor.
            wa_data-qnty = wa_data-qnty / 1000.
            wa_data_item-entry_qnt = wa_data-qnty.
            wa_data_item-po_pr_qnt = wa_data-qnty.
            wa_data_item-entry_uom = 'KL'.
            wa_data_item-entry_uom_iso = 'KL'.
            wa_data_item-orderpr_un = 'KL'.
            wa_data_item-orderpr_un_iso = 'KL'.
            wa_data_item-no_more_gr = 'X'.
            wa_data_item-po_number = wa_ekpo-ebeln.
            wa_data_item-po_item = wa_ekpo-ebelp.
            wa_data_item-unload_pt = wa_data-unload_pt.
            wa_data_item-mvt_ind = 'B'.
            APPEND wa_data_item TO it_data_item.
            CLEAR wa_data_item.
          ENDLOOP.
          CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
            EXPORTING
              goodsmvt_header = wa_data_header
              goodsmvt_code   = goodsmvt_code
              testrun         = 'X'
            TABLES
              goodsmvt_item   = it_data_item
              return          = return.
          READ TABLE return INTO wa_return WITH KEY type = 'S'.
          IF sy-subrc <> 0.
            DESCRIBE TABLE return LINES sy-tfill.
            IF sy-tfill = 0.
              CALL FUNCTION <b>'BAPI_GOODSMVT_CREATE'</b>   
            EXPORTING
                  goodsmvt_header = wa_data_header
                  goodsmvt_code   = goodsmvt_code
                  testrun         = ' '
                TABLES
                  goodsmvt_item   = it_data_item
                  return          = return.
              CALL FUNCTION <b>'BAPI_TRANSACTION_COMMIT'</b>
               EXPORTING
                 WAIT          = 'X'
              IMPORTING
                RETURN        =
            ENDIF.
          ENDIF.
          LOOP AT return INTO wa_return.
            WRITE: 'Messsage TYPE  ', wa_return-type,
                  /,'ID  ', wa_return-id,
                  /, 'Number  ', wa_return-number,
                  /, 'Message  ', wa_return-message,
                  /, 'Long Text  ', wa_return-message_v1,
                                    wa_return-message_v2,
                                    wa_return-message_v3,
                                    wa_return-message_v4,
                 /, 'Failed at line', line_count.
          ENDLOOP.
          CLEAR: wa_ekko, wa_ekpo, wa_data, it_data_item[], wa_data_header.
        ENDLOOP.
    Reward if useful!

  • HOW TO USE BAPI   BAPI_BILLINGDOC_CREATEMULTIPLE

    HI  ALL:
         I  want to create billing num. in t-code 'VF01'. It is just to input a delivery num.
    then press zhe 'save' button.
         How to use the bapi  BAPI_BILLINGDOC_CREATEMULTIPLE, I mean which
    variable  should be given.  Is there any examples.
         THANKS FIRST.

    Hi,
    Following is the documentation provided by SAP in the BAPI transaction:
    Functionality
    This method can be used to create billing documents.
    As input parameters, you are expected to enter information on the items to be processed in the table BILLING_DATA_IN. This data is processed and produces a batch of billing documents. You also have the option of transferring information for entry in the input structure CREATOR_DATA_IN. If this information is already determined, this is transferred into each billing document header. You can also enter optional conditions for the individual items to be processed in the input table CONDITION_DATA_IN, as well as means of payment information in the table CCARD_DATA_IN.
    This method can be used in the simulation run (TESTRUN = 'X') and also in the update run including the update (TESTRUN = ' '). Both execution variants deliver errors that may have occurred back to the output table RETURN. Information on successful processing is sent back in the output table SUCCESS. This output table delivers the document numbers of the billing documents created in particular.
    Notes
    Required entries :
    BILLING_DATA_IN-SALESORG
    BILLING_DATA_IN-DISTR_CHAN
    BILLING_DATA_IN-DIVISION
    BILLING_DATA_IN-DOC_TYPE
    BILLING_DATA_IN-ORDBILLTYP
    BILLING_DATA_IN-SOLD_TO
    BILLING_DATA_IN-ITEM_CATEG
    BILLING_DATA_IN-REQ_QTY
    BILLING_DATA_IN-SALES_UNIT
    BILLING_DATA_IN-CURRENCY
    If a material is billed for which a material master needs to be
    determined (BILLING_DATA_IN-NO_MATMAST = ' '), you must make the
    following entries :
    BILLING_DATA_IN-PLANT
    BILLING_DATA_IN-MATERIAL
    If, on the other hand, a material is billed for which no material
    master is to be determined (BILLING_DATA_IN_NO_MATMAST = 'X'), you
    must make the following entries :
    BILLING_DATA_IN-COUNTRY
    BILLING_DATA_IN-MATERIAL
    BILLING_DATA_IN-TAXCL_1MAT
    COMMIT control :
    In the update run (TESTRUN = ' ') the update is carried out by COMMIT
    WORK as part of the method available.
    I guess using this, you will be able to populate the required things to create the billing documents.
    Thanks
    Vijay

  • How to use BAPI get out system language as Chinese?

    hi, expert,
    i use BAPI get R3 sytem data,but BAPI get data as English,i want get R3 system Chinese data.i set language property value ZH in Model porpery,but BAPI always get english data.
    how to solve this problem?
    thanks

    Hi Jun,
    has you read the following wiki entries:
    <a href="https://wiki.sdn.sap.com/wiki/display/VC/WrongLanguage">https://wiki.sdn.sap.com/wiki/display/VC/WrongLanguage</a>
    <a href="https://wiki.sdn.sap.com/wiki/display/VC/LanguageMapping">https://wiki.sdn.sap.com/wiki/display/VC/LanguageMapping</a>
    Best Regards,
    Marcel

  • How to use BAPI in program

    Hi
    i have some data in the Legacy file and i have to update in SAP. For that I have to use BAPI, which is ME_DIRECT_INPUT_SOURCE_LIST  in the program not in LSMW.
    so i have to  use
    Function ME_INITIALIZE_SOURCE_LIST to initialize the structures and tables
    Function ME_DIRECT_INPUT_SOURCE_LIST to enter the data (see data mapping below)
    Function ME_POST_SOURCE_LIST_NEW to save the source list.
    But i don't know how to use this in the program.
    Please help me to solve this problem.

    Please check this FM - IDOC_INPUT_SRCLST, atleast you will one rough idea about mentioned FM's

  • How to use BAPI to receive goods instead of MB01(move type 101)

    I'd like to use BAPI_GOODSMVT_CREATE to receive goods,
    (from OEM factory ),
    but it can't deduct Bill Of Material AUTO,like packing materials when receive goods,
    or is there any BAPI to deduct packing materials?
    how?
    thanks,experts!
    Edited by: MF Z on Dec 1, 2008 6:18 AM

    I want a BAPI which can deduct BOM(like carton,envelope  ) automatically ,
    Is there any way to use BAPI to receive goods?
    thanks for all reply!

  • How to use BAPI Program for change workcenter in co02?

    Hi  Abapers.
           Anybody please tell me how to change the workcenter in CO02 using BAPI Programe.
          Please give me sample of this.
           I will give urs reward of points.
    Thanks
    Regards,
    S.Muthu.

    Hi,
    Use the Function module CR_WORKCENTER_UPDATE
    for workcenter change.
    It is an update function module so you have to call it in update mode with a COMMIT statement to trigger it.
    CALL FUNCTION CR_WORKCENTER_UPDATE IN UPDATE TASK
    exporting...
    imporing..
    COMMIT WORK.
    Note: only after the commit statement the function module will be called in update mode.
    Regards,
    Raj.

  • How to use BAPI BAPI_PROJECTSTOCK_PRICE_CHANGE

    Dear Sir,
    Kindly help me about as how to use the BAPI "BAPI_PROJECTSTOCK_PRICE_CHANGE" . Kindly give the sample code for using this BAPI please .
    Regards
    Sonia

    For basic information on BAPIs, refer
    [http://www.sapnet.ru/m/list_BAPI.html]

Maybe you are looking for