Problem in bapi   BAPI_PO_CREATE

Hi,
I am using Bapi BAPI_PO_CREATE To upload data in ME21.
Please send me the Sample code if possible along with the Data.
Regards
AJay

Hi,
*& Report  ZDS_BAPI_PO
REPORT  ZDS_BAPI_PO.
DATA: PO_NUM TYPE BAPIMEPOHEADER-PO_NUMBER.
DATA :WA_HEADER TYPE BAPIMEPOHEADER,
      WA_HEADERX TYPE BAPIMEPOHEADERX.
DATA: IT_ITEM TYPE TABLE OF BAPIMEPOITEM,
      IT_ITEMX TYPE TABLE OF BAPIMEPOITEMX,
      WA_ITEM TYPE  BAPIMEPOITEM,
      WA_ITEMX TYPE BAPIMEPOITEMX,
      IT_RETURN TYPE TABLE OF BAPIRET2,
      WA_RETURN TYPE BAPIRET2.
WA_HEADER-COMP_CODE = '1000 '.
WA_HEADER-DOC_TYPE = 'NB'.
WA_HEADER-ITEM_INTVL = '00001'.
WA_HEADER-VENDOR = '0000001000' .
WA_HEADER-PMNTTRMS = '0001' .
WA_HEADER-PURCH_ORG = '1000' .
WA_HEADER-PUR_GROUP = '001' .
WA_HEADER-CURRENCY = 'EUR '.
WA_HEADERX-COMP_CODE = 'X'.
WA_HEADERX-DOC_TYPE = 'X'.
WA_HEADERX-ITEM_INTVL = 'X'.
WA_HEADERX-VENDOR = 'X' .
WA_HEADERX-PMNTTRMS = 'X' .
WA_HEADERX-PURCH_ORG = 'X' .
WA_HEADERX-PUR_GROUP = 'X' .
WA_ITEM-PO_ITEM = '00001' .
WA_ITEM-MATERIAL = '100-100'.
WA_ITEM-PLANT = '1000'.
WA_ITEM-STGE_LOC = '0001'.
WA_ITEM-QUANTITY = '15.000'.
WA_ITEM-TAX_CODE = 'V0'.
WA_ITEM-ITEM_CAT = '0'.
*WA_ITEM-ACCTASSCAT = 'K'.
APPEND WA_ITEM TO IT_ITEM.
WA_ITEMX-PO_ITEM = '00001' .
WA_ITEMX-MATERIAL = 'X'.
WA_ITEMX-PLANT = 'X'.
WA_ITEMX-STGE_LOC = 'X'.
WA_ITEMX-QUANTITY = 'X'.
WA_ITEMX-TAX_CODE = 'X'.
WA_ITEMX-ITEM_CAT = 'X'.
WA_ITEMX-ACCTASSCAT = 'X'.
APPEND WA_ITEMX TO IT_ITEMX.
CALL FUNCTION 'BAPI_PO_CREATE1'
  EXPORTING
    POHEADER                     = WA_HEADER
    POHEADERX                    = WA_HEADERX
*   POADDRVENDOR                 =
*   TESTRUN                      =
*   MEMORY_UNCOMPLETE            =
*   MEMORY_COMPLETE              =
*   POEXPIMPHEADER               =
*   POEXPIMPHEADERX              =
*   VERSIONS                     =
*   NO_MESSAGING                 =
*   NO_MESSAGE_REQ               =
*   NO_AUTHORITY                 =
*   NO_PRICE_FROM_PO             =
IMPORTING
    EXPPURCHASEORDER             = PO_NUM
*   EXPHEADER                    =
*   EXPPOEXPIMPHEADER            =
TABLES
    RETURN                       = IT_RETURN
    POITEM                       = IT_ITEM
    POITEMX                      = IT_ITEMX
*   POADDRDELIVERY               =
*   POSCHEDULE                   =
*   POSCHEDULEX                  =
*   POACCOUNT                    =
*   POACCOUNTPROFITSEGMENT       =
*   POACCOUNTX                   =
*   POCONDHEADER                 =
*   POCONDHEADERX                =
*   POCOND                       =
*   POCONDX                      =
*   POLIMITS                     =
*   POCONTRACTLIMITS             =
*   POSERVICES                   =
*   POSRVACCESSVALUES            =
*   POSERVICESTEXT               =
*   EXTENSIONIN                  =
*   EXTENSIONOUT                 =
*   POEXPIMPITEM                 =
*   POEXPIMPITEMX                =
*   POTEXTHEADER                 =
*   POTEXTITEM                   =
*   ALLVERSIONS                  =
*   POPARTNER                    =
*   POCOMPONENTS                 =
*   POCOMPONENTSX                =
*   POSHIPPING                   =
*   POSHIPPINGX                  =
*   POSHIPPINGEXP                =
IF PO_NUM IS NOT INITIAL.
  WRITE:/ 'Po is generated :::::::-',PO_NUM.
ELSE.
LOOP AT IT_RETURN INTO WA_RETURN.
  write: / WA_RETURN-MESSAGE.
ENDLOOP.
endif.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
   WAIT          = 'X'
* IMPORTING
*   RETURN        =
Regards,
Dhruv Shah

Similar Messages

  • Problem in BAPI

    Hi Friends,
    I am having a problem in BAPI when i am executing the program i am getting a error message like this,
    <b>Error message:</b>
    144The field MARA-MEINS/BAPI_MARA-BASE_UOM(_ISO) is defined as a required field; it does not contain an entry   .
    any solutions to the above problem.
    I am sending the code along with this mail.
    <b>coding:</b>
    REPORT ZYC_BAPI_MATERIAL_CREATE .
    STRUCTURE DECLARATIONS *
    TABLES: BAPIMATHEAD, "Headerdata
    BAPI_MARA, "Clientdata
    BAPI_MAKT, "Material description
    BAPIRET2. "Return messages
    data : bapi_mara1 LIKE bapi_mara. "Client Data
    DATA:V_FILE TYPE STRING.
    DATA:
    BEGIN OF LSMW_MATERIAL_MASTER,
    MATNR(018) TYPE C, "Material number
    MBRSH(001) TYPE C, "Industry sector
    MTART(004) TYPE C, "Material type
    MAKTX(040) TYPE C, "Material description
    MEINS(003) TYPE C, "Base unit of measure
    END OF LSMW_MATERIAL_MASTER.
    INTERNAL TABLE DECLARATIONS *
    *to store the input data
    DATA: BEGIN OF it_matmaster OCCURS 0.
    INCLUDE STRUCTURE LSMW_MATERIAL_MASTER.
    DATA: END OF it_matmaster.
    *for material description
    DATA:BEGIN OF IT_MATERIALDESC OCCURS 0.
    INCLUDE STRUCTURE BAPI_MAKT .
    DATA:END OF IT_MATERIALDESC.
    *to return messages
    DATA:BEGIN OF IT_RETURN OCCURS 0.
    INCLUDE STRUCTURE BAPIRET2.
    DATA:END OF IT_RETURN.
    SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.
    PARAMETERS:P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B1 .
    AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    PROGRAM_NAME = SYST-CPROG
    DYNPRO_NUMBER = SYST-DYNNR
    FIELD_NAME = 'P_FILE'
    IMPORTING
    FILE_NAME = P_FILE.
    TO UPLOAD THE DATA *
    START-OF-SELECTION.
    V_FILE = P_FILE.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = V_FILE
    FILETYPE = 'ASC'
    HAS_FIELD_SEPARATOR = 'X'
    HEADER_LENGTH = 0
    READ_BY_LINE = 'X'
    DAT_MODE = ' '
    IMPORTING
    FILELENGTH =
    HEADER =
    tables
    data_tab = IT_MATMASTER
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_READ_ERROR = 2
    NO_BATCH = 3
    GUI_REFUSE_FILETRANSFER = 4
    INVALID_TYPE = 5
    NO_AUTHORITY = 6
    UNKNOWN_ERROR = 7
    BAD_DATA_FORMAT = 8
    HEADER_NOT_ALLOWED = 9
    SEPARATOR_NOT_ALLOWED = 10
    HEADER_TOO_LONG = 11
    UNKNOWN_DP_ERROR = 12
    ACCESS_DENIED = 13
    DP_OUT_OF_MEMORY = 14
    DISK_FULL = 15
    DP_TIMEOUT = 16
    OTHERS = 17
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    DATA POPULATIONS *
    LOOP AT IT_MATMASTER.
    BAPIMATHEAD-MATERIAL = IT_MATMASTER-MATNR.
    BAPIMATHEAD-IND_SECTOR = IT_MATMASTER-Mbrsh.
    BAPIMATHEAD-MATL_TYPE = IT_MATMASTER-MTART.
    BAPIMATHEAD-BASIC_VIEW = 'X'.
    refresh it_materialdesc.
    IT_MATERIALDESC-matl_desc = IT_MATMASTER-maktx.
    append IT_materialdesc.
    bapi_mara1-base_uom = 'TO'. "it_matmaster-meins.
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
    headdata = BAPIMATHEAD
    CLIENTDATA = BAPI_MARA
    CLIENTDATAX = BAPI_MARAx
    IMPORTING
    RETURN = IT_RETURN
    TABLES
    MATERIALDESCRIPTION = IT_MATERIALDESC.
    WRITE:/ IT_RETURN-TYPE,
    2 IT_RETURN-ID,
    22 IT_RETURN-NUMBER,
    25 IT_RETURN-MESSAGE.
    ENDLOOP.
    Regards,
    Dinesh

    Hi
    Basic Unit of Measure is required field in the material master
    You are not populating it in the Bapi
    populate it in the CLIENTDATA
    IT WILL SOLVE THE ISSUE.
    CLIENTDATA-BASE_UOM = it_matmaster-meins
    Reward points if useful
    Regards
    Anji

  • Problem with BAPI BAPI_REQUISITION_CREATE

    Hello,
    I have problems with BAPI BAPI_REQUISITION_CREATE. I need to create Purchase requisition for services. If I use BAPI BAPI_REQUISITION_CREATE, Purchasing requisition is created, but field NETWR in table EBNK is 0. If I create purchasing requisition manualy using transaction ME51N, field NETWR in table EBNK is filled with correct price.
    Can you pls. help me, what do I wrong in calling BAPI_REQUISITION_CREATE?
    Thanks&regards,
    Jirka

    Not sure if you got your answer or went to OSS for a resolution. But, as I was searching OSS for my issue, I came across the following note:
    Note 1498435 - BAPI_REQUISITION_CREATE: EBKN-NETWR is not updated

  • Quantity field in bapi  BAPI_PO_CREATE

    Hi ,
    What is the filed name to pass the QUANTITY in the lineitems table*(PO_ITEMS) for the Bapi BAPI_PO_CREATE
    FIleld name DISP_QUAN is not accepting the Quantity and showing the error as  ENTER QUANTITY
    when BAPI is executed.
    Regards
    Ajay

    Hai.
    check this.
    REPORT zpo_bapi_purchord_tej.
    DATA DECLARATIONS *
    TYPE-POOLS slis.
    TYPES: BEGIN OF ty_table,
    v_legacy(8),
    vendor TYPE bapimepoheader-vendor,
    purch_org TYPE bapimepoheader-purch_org,
    pur_group TYPE bapimepoheader-pur_group,
    material TYPE bapimepoitem-material,
    quantity(13),
    delivery_date TYPE bapimeposchedule-delivery_date,
    net_price(23),
    plant TYPE bapimepoitem-plant,
    END OF ty_table.
    TYPES: BEGIN OF ty_alv,
    v_legs(8),
    success(10),
    v_legf(8),
    END OF ty_alv.
    TYPES: BEGIN OF ty_alv1,
    v_legf1(8),
    v_msg(500),
    END OF ty_alv1.
    *-----Work area declarations.
    DATA: x_table TYPE ty_table,
    x_header TYPE bapimepoheader,
    x_headerx TYPE bapimepoheaderx,
    x_item TYPE bapimepoitem,
    x_itemx TYPE bapimepoitemx,
    x_sched TYPE bapimeposchedule,
    x_schedx TYPE bapimeposchedulx,
    x_commatable(255),
    x_alv TYPE ty_alv,
    x_alv1 TYPE ty_alv1,
    x_alv2 TYPE ty_alv1.
    *-----Internal table declarations.
    DATA: it_table TYPE TABLE OF ty_table,
    it_commatable LIKE TABLE OF x_commatable,
    it_item TYPE TABLE OF bapimepoitem,
    it_itemx TYPE TABLE OF bapimepoitemx,
    it_sched TYPE TABLE OF bapimeposchedule,
    it_schedx TYPE TABLE OF bapimeposchedulx,
    it_alv TYPE TABLE OF ty_alv,
    it_alv1 TYPE TABLE OF ty_alv1,
    it_alv2 TYPE TABLE OF ty_alv1.
    DATA: po_number TYPE bapimepoheader-po_number,
    x_return TYPE bapiret2,
    it_return TYPE TABLE OF bapiret2,
    v_file TYPE string,
    v_temp(8),
    v_succsount TYPE i VALUE 0,
    v_failcount TYPE i VALUE 0,
    v_total TYPE i.
    DATA: v_temp1(5) TYPE n VALUE 0.
    DATA: x_event TYPE slis_t_event,
    x_fieldcat TYPE slis_t_fieldcat_alv,
    x_list_header TYPE slis_t_listheader,
    x_event1 LIKE LINE OF x_event,
    x_layout1 TYPE slis_layout_alv,
    x_variant1 TYPE disvariant,
    x_repid2 LIKE sy-repid.
    DATA : it_fieldcat TYPE TABLE OF slis_t_fieldcat_alv.
    SELECTION-SCREEN *
    SELECTION-SCREEN BEGIN OF BLOCK v_b1 WITH FRAME.
    *-----To fetch the flat file.
    PARAMETERS: p_file TYPE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK v_b1.
    AT SELECTION-SCREEN *
    AT SELECTION-SCREEN.
    IF p_file IS INITIAL.
    MESSAGE text-001 TYPE 'E'.
    ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    *-----To use F4 help to find file path.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    program_name = syst-cprog
    dynpro_number = syst-dynnr
    IMPORTING
    file_name = p_file.
    v_file = p_file.
    START-OF-SELECTION *
    START-OF-SELECTION.
    PERFORM gui_upload.
    LOOP AT it_table INTO x_table.
    PERFORM header_details.
    v_temp = x_table-v_legacy.
    LOOP AT it_table INTO x_table WHERE v_legacy = v_temp.
    PERFORM lineitem.
    PERFORM schedule.
    ENDLOOP.
    DELETE it_table WHERE v_legacy = v_temp.
    PERFORM bapicall.
    MOVE po_number TO x_alv-success.
    APPEND x_alv TO it_alv.
    CLEAR x_alv.
    *-----To clear the item details in internal table after the operation for a header.
    REFRESH: it_item,
    it_itemx,
    it_sched,
    it_schedx.
    CLEAR: v_temp1.
    ENDLOOP.
    v_total = v_succsount + v_failcount.
    PERFORM display_alv.
    FORM GUI_UPLOAD *
    FORM gui_upload .
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = v_file
    filetype = 'ASC'
    TABLES
    data_tab = it_commatable
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17
    IF sy-subrc = 0.
    *-----To fetch the comma seperated flat file into an internal table.
    LOOP AT it_commatable INTO x_commatable.
    IF x_commatable IS NOT INITIAL.
    SPLIT x_commatable AT ',' INTO
    x_table-v_legacy
    x_table-vendor
    x_table-purch_org
    x_table-pur_group
    x_table-material
    x_table-quantity
    x_table-delivery_date
    x_table-net_price
    x_table-plant.
    APPEND x_table TO it_table.
    ENDIF.
    CLEAR x_table.
    ENDLOOP.
    ENDIF.
    ENDFORM. " gui_upload
    FORM HEADER_DETAILS *
    FORM header_details .
    MOVE 'NB' TO x_header-doc_type.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = x_table-vendor
    IMPORTING
    output = x_table-vendor
    MOVE x_table-vendor TO x_header-vendor.
    MOVE x_table-purch_org TO x_header-purch_org.
    MOVE x_table-pur_group TO x_header-pur_group.
    x_headerx-doc_type = 'X'.
    x_headerx-vendor = 'X'.
    x_headerx-purch_org = 'X'.
    x_headerx-pur_group = 'X'.
    ENDFORM. " header_details
    FORM LINEITEM *
    FORM lineitem .
    v_temp1 = v_temp1 + 10.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = v_temp1
    IMPORTING
    output = v_temp1.
    MOVE v_temp1 TO x_item-po_item.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = x_table-material
    IMPORTING
    output = x_table-material.
    MOVE x_table-material TO x_item-material.
    MOVE x_table-quantity TO x_item-quantity.
    MOVE x_table-net_price TO x_item-net_price.
    MOVE x_table-plant TO x_item-plant.
    x_itemx-po_item = v_temp1.
    x_itemx-material = 'X'.
    x_itemx-quantity = 'X'.
    x_itemx-net_price = 'X'.
    x_itemx-plant = 'X'.
    APPEND x_item TO it_item.
    APPEND x_itemx TO it_itemx.
    CLEAR: x_item, x_itemx.
    ENDFORM. " lineitem1
    FORM SCHEDULE *
    FORM schedule .
    MOVE x_table-delivery_date TO x_sched-delivery_date.
    MOVE v_temp1 TO x_sched-po_item.
    x_schedx-delivery_date = 'X'.
    x_schedx-po_item = v_temp1.
    APPEND x_sched TO it_sched.
    APPEND x_schedx TO it_schedx.
    CLEAR: x_sched, x_schedx.
    ENDFORM. " schedule
    FORM BAPICALL *
    FORM bapicall .
    CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
    poheader = x_header
    poheaderx = x_headerx
    IMPORTING
    exppurchaseorder = po_number
    TABLES
    return = it_return
    poitem = it_item
    poitemx = it_itemx
    poschedule = it_sched
    poschedulex = it_schedx.
    IF po_number IS NOT INITIAL.
    v_succsount = v_succsount + 1.
    MOVE x_table-v_legacy TO x_alv-v_legs.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    ELSE.
    v_failcount = v_failcount + 1.
    MOVE x_table-v_legacy TO x_alv-v_legf.
    MOVE x_table-v_legacy TO x_alv1-v_legf1.
    LOOP AT it_return INTO x_return.
    IF x_alv1-v_msg IS INITIAL.
    MOVE x_return-message TO x_alv1-v_msg.
    ELSE.
    CONCATENATE x_alv1-v_msg x_return-message INTO x_alv1-v_msg SEPARATED BY space.
    ENDIF.
    ENDLOOP.
    APPEND x_alv1 TO it_alv1.
    CLEAR x_alv1.
    ENDIF.
    ENDFORM. " bapicall
    FORM DISPLAY_ALV *
    FORM display_alv .
    PERFORM x_list_header.
    PERFORM build_fieldcat CHANGING x_fieldcat.
    x_repid2 = sy-repid.
    x_event1-name = 'TOP_OF_PAGE'.
    x_event1-form = 'TOP_OF_PAGE'.
    APPEND x_event1 TO x_event.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = x_repid2
    is_layout = x_layout1
    it_fieldcat = x_fieldcat
    i_callback_user_command = 'USER_COMMAND'
    i_callback_top_of_page = 'TOP_OF_PAGE'
    i_save = 'A'
    is_variant = x_variant1
    it_events = x_event
    TABLES
    t_outtab = it_alv
    EXCEPTIONS
    program_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.
    ENDFORM. " display_master_data
    FORM USER_COMMAND *
    FORM user_command USING ucomm LIKE sy-ucomm selfield
    TYPE slis_selfield.
    READ TABLE it_alv INTO x_alv INDEX selfield-tabindex.
    CLEAR : x_alv2,it_alv2[].
    LOOP AT it_alv1 INTO x_alv1 WHERE v_legf1 = x_alv-v_legf.
    x_alv2 = x_alv1.
    APPEND x_alv2 TO it_alv2 .
    ENDLOOP.
    DATA : it_fieldcat TYPE slis_t_fieldcat_alv.
    DATA : x3_fieldcat LIKE LINE OF it_fieldcat.
    CLEAR : x3_fieldcat,it_fieldcat[].
    CLEAR x3_fieldcat.
    x3_fieldcat-col_pos = '1'.
    x3_fieldcat-fieldname = 'V_LEGF1'.
    x3_fieldcat-reptext_ddic = text-111.
    x3_fieldcat-ref_tabname = 'IT_ALV2'.
    APPEND x3_fieldcat TO it_fieldcat.
    CLEAR x3_fieldcat.
    CLEAR x3_fieldcat.
    x3_fieldcat-col_pos = '1'.
    x3_fieldcat-fieldname = 'V_MSG'.
    x3_fieldcat-reptext_ddic = text-112.
    x3_fieldcat-ref_tabname = 'IT_ALV2'.
    APPEND x3_fieldcat TO it_fieldcat.
    CLEAR x3_fieldcat.
    x_layout1-colwidth_optimize = 'X'.
    x_layout1-zebra = 'X'.
    IF it_alv2[] IS NOT INITIAL.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = x_repid2
    is_layout = x_layout1
    it_fieldcat = it_fieldcat
    i_save = 'A'
    i_callback_top_of_page = 'TOP'
    is_variant = x_variant1
    it_events = x_event
    TABLES
    t_outtab = it_alv2
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    ENDIF.
    ENDFORM.
    FORM USER_COMMAND *
    FORM top.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = 'Commentry'.
    ENDFORM.
    FORM BUILD_FIELDCAT *
    FORM build_fieldcat CHANGING et_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: x1_fieldcat TYPE slis_fieldcat_alv.
    CLEAR x1_fieldcat.
    x1_fieldcat-col_pos = '1'.
    x1_fieldcat-fieldname = 'V_LEGS'.
    x1_fieldcat-reptext_ddic = text-108.
    x1_fieldcat-ref_tabname = 'IT_ALV'.
    APPEND x1_fieldcat TO et_fieldcat.
    CLEAR x1_fieldcat.
    x1_fieldcat-col_pos = '2'.
    x1_fieldcat-fieldname = 'SUCCESS'.
    x1_fieldcat-key = 'X'.
    x1_fieldcat-reptext_ddic = text-109.
    x1_fieldcat-ref_tabname = 'IT_ALV'.
    APPEND x1_fieldcat TO et_fieldcat.
    CLEAR x1_fieldcat.
    x1_fieldcat-col_pos = '3'.
    x1_fieldcat-fieldname = 'V_LEGF'.
    x1_fieldcat-key = 'X'.
    x1_fieldcat-reptext_ddic = text-110.
    x1_fieldcat-ref_tabname = 'IT_ALV'.
    APPEND x1_fieldcat TO et_fieldcat.
    CLEAR x1_fieldcat.
    ENDFORM. " build_fieldcat
    FORM BUILD_LIST_HEADER *
    FORM x_list_header.
    DATA: x_list_header1 TYPE slis_listheader.
    *-----List Header: type H
    CLEAR x_list_header1 .
    x_list_header1-typ = 'H'.
    x_list_header1-info = text-105.
    APPEND x_list_header1 TO x_list_header.
    *-----List Key: type S
    x_list_header1-typ = 'S'.
    x_list_header1-key = text-106.
    x_list_header1-info = v_total.
    APPEND x_list_header1 TO x_list_header.
    *-----List Key: Type S
    CLEAR x_list_header1 .
    x_list_header1-typ = 'S'.
    x_list_header1-key = text-107.
    x_list_header1-info = v_succsount.
    APPEND x_list_header1 TO x_list_header.
    ENDFORM. " build_list_header
    FORM TOP_OF_PAGE *
    FORM top_of_page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = x_list_header.
    ENDFORM. " TOP_OF_PAGE
    regards.
    sowjanya.b

  • Problem in BAPI  'BAPI_SALESORDER_CHANGE'.

    Hi All,
    I am facing a problem in BAPI  'BAPI_SALESORDER_CHANGE'. My requirement is as below.
    For a particular type of Sales Order i have to update all the ship-to PO.Basically in all these PO's we have to suffix
    'old'.
    I am pasting the code which I used. I am actually displaying the return message in a table.
    The message says 'Schedule Order is saved'.
    When i go and check the SO the ship-to PO is not updated.
    Also i have one more querry.
    Is thsi BAPI to be run for each item or can i collect all items in t_item_in and then call the BAPI.
    Please guide me on this.
    Thanks in Advance,
    Saket.
    LOOP AT t_vbkd INTO wa_vbkd.
    CONCATENATE wa_vbkd-bstkd_e '-' v_po INTO v_po_ref.
    t_item_in-purch_no_c    = v_po_ref.
    t_item_inx-purch_no_c   = v_po_ref.
    t_item_inx-updateflag  = 'X'.
      APPEND t_item_in.
      APPEND t_item_inx.
    *LOOP AT t_vbak INTO wa_vbak.
    v_vbeln = wa_vbkd-vbeln.
    w_headerx-updateflag = 'U'.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        SALESDOCUMENT               = v_vbeln
        ORDER_HEADER_INX            = w_headerx
      TABLES
        RETURN                      = t_return
        ORDER_ITEM_IN               = t_item_in
        ORDER_ITEM_INX              = t_item_inx.
    READ TABLE t_return WITH KEY type = 'E'.
      IF sy-subrc = 0.
        t_output-rmks = t_return-message.
      ELSE.
        t_output-rmks = t_return-message.
      ENDIF.
      READ TABLE t_vbak INTO wa_vbak
       WITH KEY vbeln = v_vbeln.
      t_output-vbeln = v_vbeln.
      t_output-auart = wa_vbak-auart.
      t_output-vkorg = wa_vbak-vkorg.
      t_output-bstkd_e_old = wa_vbkd-bstkd_e.
      t_output-bstkd_e_new = t_item_in-purch_no_c.
      APPEND t_output.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
       WAIT          = 'X'
    IMPORTING
      RETURN        =
    ENDLOOP.

    REPORT  ZSALESORDER_CHANGE MESSAGE-ID 38.
    PARAMETERS: p_vbeln TYPE vbap-vbeln OBLIGATORY, "Order Number
    p_posnr TYPE vbap-posnr OBLIGATORY, "Order Item
    p_etenr TYPE vbep-etenr OBLIGATORY, "Schedule Line
    p_reqqty TYPE bapischdl-req_qty OBLIGATORY. " Order Qty
    DATA: i_hdr TYPE bapisdh1,
    i_hdrx TYPE bapisdh1x,
    i_ret TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
    wa_ret TYPE bapiret2.
    DATA: BEGIN OF i_sched OCCURS 10.
    INCLUDE STRUCTURE bapischdl.
    DATA: END OF i_sched.
    DATA: BEGIN OF i_schedx OCCURS 10.
    INCLUDE STRUCTURE bapischdlx.
    DATA: END OF i_schedx.
    START-OF-SELECTION.
    REFRESH: i_sched, i_schedx, i_ret.
    CLEAR: i_sched, i_schedx, i_ret.
    i_hdrx-updateflag = 'U'.
    i_sched-itm_number = p_posnr.
    i_sched-sched_line = p_etenr.
    i_sched-req_qty = p_reqqty.
    i_schedx-updateflag = 'U'.
    i_schedx-itm_number = p_posnr.
    i_schedx-sched_line = p_etenr.
    i_schedx-req_qty = 'X'.
    APPEND i_sched.
    APPEND i_schedx.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = p_vbeln
    order_header_in = i_hdr
    order_header_inx = i_hdrx
    TABLES
    return = i_ret
    schedule_lines = i_sched
    schedule_linesx = i_schedx.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    LOOP AT i_ret.
    WRITE / i_ret-message.
    ENDLOOP.
    http://abap.wikiprog.com/wiki/BAPI_SALESORDER_CHANGE
    Edited by: krupa jani on Jul 30, 2009 9:22 AM

  • Problem using BAPI to create Service Confirmation in CRM

    Good afternoon all.
    I have raised this is CRM forum too, just thought it best to ask the broader ABAP community the question too.
    We are encountering a problem using a BAPI to create a transaction in CRM, specifically:
    I am trying to create a Service Confirmation (BUS2000117) in a CRM system using the BAPI BAPI_BUSPROCESSND_CREATEMULTI.
    The BAPI succeeds in creating the header of the transaction, but I cannot make the BAPI create any other data in the transaction such as partners or items.
    Just want to be sure that I am not being foolish...has anyone succeeded in using this BAPI to create an error-free Service Confirmation?
    Regards
    Nick

    I am going to pop this thread into General ABAP forum too.
    Nick

  • Problem with BAPI of Material Master creation

    Hi,
    I am creating material master(mm01) through BAPI_MATERIAL_SAVEDATA.
    Program is working fine but when i m checking in MM03 to display uploaded data through BAPI, i cant able to see material which i created to through BAPI but i can see in MARA table.
    i dont know wht is the problem ?
    can anybody let me know abt this ?

    then u are not committing the work.
    flow will be like this
    call ' BAPI'
    if return[] is initial.
    commit work.
    else.
    endif.
    Regards
    peram

  • A problem about bapi dd check

    Hi, all.
        I tried to use arfc2 to call a bapi to get PO data from R/3 in 7.1.1. So I did model binding for my component controller`s context. Then I tried to get the result from these parameters programly. But I always got dd check error.
    For example. If an attribute "A" `s data type is int. But the attribute "A" is empty in R/3, so it always returns " " to the attribue "A". Then it will raise an dd check error. The bapi which I used is BAPI_PO_GET_LIST. There are many attributes with this bapi. How can I solve this problem?
    Thanks.

    Hi,
    please check if the below link can help in your case.
    [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bc_db/~form/handler]
    Regards
    Narendra
    Edited by: Narendra Singh on Apr 3, 2009 11:54 AM

  • Sneak Preview - problems getting BAPI into VC

    Hi everybody,
    I installed Full Java Edition 2004s Release SAP NetWeaver 04s SP7 on Windows XP SP2 to test Visual Composer.
    First I defined an R/3 System (4.6 C) in portal and did the user mapping for this system. For testing the connection to R/3 with the WinGUI I generated an iView. Using this iView to logon via SSO to the R/3 system with the mapped user-id and password worked fine.
    Next step was to try out the bank example in Visual Composer. When seraching for bapis in the defined R/3 system Visual Composer got connection problems.
    In R/3 system's log I found the request of Visual Composer. My user-id was transfered well but the password apparently wasn't. The errormessage in the log said, that there are problems with user-id or password.
    After spending a lot of time with solving this problem by myself unsuccessfully I post this message and hope that anybody can help.
    Michael

    Hi Michael,
    Please make sure you followed the steps below, as I faced similar problem, for accessing R/3 System Alias and BAPI's ofcourse on Visual Composer.
    a. <b>Create a system alias from Administrator Login credentials on Portal (assume, you have done the same).</b>
    b. Usermapping done for the System Alias with proper R/3 login credentials.
    c. Now try to access the system alias created by reloging to VC and search for BAPI's.
    For the query that you have posted, hopefully this should solve your problem.

  • Problem for Bapi Call  in Integration Scenario

    Hi
    I am creating an Integration Scenario at Design time which can be used during configuration time.In the Int. Scenario, I am using a Int Process(BPM). I am making a synchronous call to BAPI from my BPM. How can this be implemented in Integration Scenario.
    So how can I send a input message from BPM to BAPI and then take further steps only after getting response from BAPI. Is there any way to define synchronous Action in Int Scenario??? And another point to be noted is that we are not using any communication channel to send the message from BPM or receive the response in BPM. We have only a receiver communication channel which receives the message for the BAPI.
    So please help in solving this problem.
    regards,
    Biranchi

    > Thanks for ur reply. I am trying to follow the suggestion given by u. U have specified that the BAPI  in R/3 system has to be inserted as an application component. But I am unable to do that. I am using IDES system for the BAPI,but in the selection screen for the Application Component we have only instances of installed product in the SLD. So how to find out the application component to be imported.
    >
    What you need to do is, first of all your import the BAPI (RFC) into XI system. (I hope you must be knowing how to import the RFC & IDOCs into XI system). Make sure this BAPI is remote-enabled under attribute TAB in R3 ---> SE37.
    Now this imported BAPI (RFC) will be used in your message interfaces and this message interface will be used inside ACTION. And then you can use this action in your Integration Secnario as mentioned in the picture above in my first reply.
    Sorry for the confusion, you need to R3 business system name rather inserting the BAPI as a business system under 3rd swim lane.
    > And another problem is that I have to create an action for in the application Component containing BAPI and then it should be connected to the action in BPM for interaction. I have created one action for this and given the BAPi as both outbound and inbound interface. Is this the proper way to do this???
    >
    As mentioned above, after you import the BAPI (RFC) in XI you can create the messge interface. There should be two Message Interfaces. One for sending the request and other for receiving the response message.
    Regards,
    Sarvesh

  • Problem regarding BAPI call from a webdynpro applications

    Hi,
      We are trying to call a BAPI in R/3 system from a webdynpro application through the standard method. But we are getting some problems in JCO settings. We already wasted so much time in solving those problems. Is there anyway where i can access BAPI from Webdynpro application.
    Rgrds,
    Anna

    Hello Anna,
      You can do it by using SAP Java Connector API's in the implementation of the Webdynpro application. You can refer to the sample programs for JCO at http://service.sap.com/connectors and download the latest version of SAP JCo in that install those files as per the installation document in the downloaded zip. The downloaded zip contains information about JCo APIs and sample programs.
    Hope this will solve your problem.
    Best Regards,
    Srinivas.

  • Problem with BAPI inputs

    Dear all,
               I need a help in webdynpro using bapi scenario
    -> my form has 6 input fields, in that 4 are drop down boxes which gets the value from respective 4 bapis.
    -> 2 input fields should be in date picker which didnt get value from bapi
    -> another table which is connected to bapi for ouput uses all the 6 fields as input
                      now my problem is, i can take the first 4 dropdown boxes values as input to grid, but i couldnt take the last 2 fields(dates) as input to it.
                      To make the field as date picker we need to create a structure in Dictionary object. There is no date picker to select from "Insert Child" option. that is if the type is date then it automatically makes the inputfield as date picker.

    Dear Lohi,
               I didnt get you what you are saying... i am not importing and Fn Module... its actually a WSDL iam importing it through WD wizards.....
                After importing it i need to pass 6 fields as input.....i have 4 fields of inputs  which are output of 4 another wsld. i can map that 4 outputs of 4 different WSDLs to input of Grid WSDL.
                 the problem here is.... another two fields those are date fields i need to send to Grid WSDL as input, if i directly create valuenodes in the context, and map to fields as input to Grid WSDL the output giving error.
                  Hope you understud my problem..... please help me out in this regard

  • Problem with bapi BAPI_BUS2054_CREATE_MULTI

    I am trying to create multiple wbs elements for a given definition
    using the bapi BAPI_BUS2054_CREATE_MULTI as per the documentation i have used BAPI_PS_INITIALIZATION
    first to initialize,then followed by BAPI_BUS2054_CREATE_MULTI  and ending with BAPI_PS_PRECOMMIT and BAPI_TRANSACTION_COMMIT
    it says the definition is o.k but its giving error with wbs element.
    that to enter all required fields.
    could any body please  tell what are all the required fields that i have to enter for it_wbs.

    Hi Aravind,
    I am having same problem. Can you pelase explain me how you solved your issue.
    Please help?
    thanks,
    Venkat.

  • Problem in bapi for vl01n

    Hi Experts,
    I have Written this below code to upload Delivery with refrence to sales orders with batch split . when i execute this program it is retuning the message  that the transfered sales order table is empty.
    If i change the document_catogy_sd = ' L '.
    then its not retuning any message  but its not creating any deliveries. please find and fix the problem in this program.
    FIELD_NAME = ' '
    IMPORTING
    FILE_NAME = L_FILE1
    IF NOT L_FILE1 IS INITIAL.
    P_FILE1 = L_FILE1.
    ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE2.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    PROGRAM_NAME = SYST-CPROG
    DYNPRO_NUMBER = SYST-DYNNR
    FIELD_NAME = ' '
    IMPORTING
    FILE_NAME = L_FILE2
    IF NOT L_FILE2 IS INITIAL.
    P_FILE2 = L_FILE2.
    ENDIF.
    START-OF-SELECTION.
    PERFORM F_UPLOAD TABLES ITAB USING P_FILE1.
    PERFORM F_UPLOAD1 TABLES ITAB1 USING P_FILE2.
    SORT ITAB1 BY VBELN.
    ITAB1[] = ITAB[] .
    LOOP AT ITAB.
    ITABL-DOCUMENT_CATEGORY_SD = 'J'.
    ITABL-DOCUMENT_NUMB = ITAB-VBELN.
    ITABL-DOCUMENT_ITEM = ITAB-ITEMNO.
    ITABL-RECEIVING_POINT = ITAB-VSTEL.
    ITABL-DATE = ITAB-VSTEL.
    ITABL-DELIVERY_DATE = ITAB-WADAT.
    ITABL-GOODS_ISSUE_DATE = ITAB-WADAT_IST.
    ITABL-LOADING_DATE = ITAB-LDDAT.
    ITABL-MAT_AVAILABIL_DATE = ITAB-MBDAT.
    ITABL-MATERIAL = ITAB-MATNR.
    ITABL-QUANTITY_SALES_UOM = ITAB-SOQTY.
    IT_FINAL-DOCUMENT_NUMB = ITAB-VBELN.
    IT_FINAL-DOCUMENT_ITEM = ITAB-ITEMNO.
    IT_FINAL-RECEIVING_POINT = ITAB-VSTEL.
    IT_FINAL-DATE = ITAB-VSTEL.
    IT_FINAL-DELIVERY_DATE = ITAB-WADAT.
    IT_FINAL-GOODS_ISSUE_DATE = ITAB-WADAT_IST.
    IT_FINAL-LOADING_DATE = ITAB-LDDAT.
    IT_FINAL-MAT_AVAILABIL_DATE = ITAB-MBDAT.
    IT_FINAL-MATERIAL = ITAB-MATNR.
    IT_FINAL-QUANTITY_SALES_UOM = ITAB-SOQTY.
    it_doc-DOCUMENT_CATEGORY_SD = 'J'.
    append it_doc.
    APPEND IT_FINAL.
    LOOP AT ITAB1 WHERE VBELN = ITAB-VBELN AND ITEMNO = ITAB-ITEMNO.
    ITABL-STGE_LOC = ITAB1-LGORT.
    ITABL-BATCH = ITAB1-CHARG.
    itabl-QUANTITY_BASE__UOM = itab1-lfimg.
    itab1-MAT_AVAILABIL_DATE = itab1-mbdat.
    IT_FINAL-STGE_LOC = ITAB1-LGORT.
    IT_FINAL-BATCH = ITAB1-CHARG.
    *it_final-lfimg = itab1-lfimg.
    APPEND IT_FINAL.
    ENDLOOP.
    CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
    EXPORTING
    DELIVERY_EXTEND =
    TECHN_CONTROL =
    TABLES
    REQUEST = IT_FINAL
    PARTNER =
    PARTNER_ADDR =
    TEXT_HEADER =
    TEXT_LINES =
    CREATEDITEMS = it_doc
    RETURN = IT_RETUN .
    EXTENSION1 =
    EXTENSION2 =
    CO_CHAR_VALUES =
    BATCH_ATTRIBUTES =
    BATCH_VALUES_CHAR =
    BATCH_VALUES_CURR =
    BATCH_VALUES_NUM =
    TOKENREFERENCE =
    WRITE: / ' ** S.T.O. HELD WITH DOCUMENT NO ** ', TEXT1.
    WRITE: / SPACE.
    *loop at iret.
    *endloop.
    LOOP AT IT_RETUN.
    WHERE TYPE = 'A'
    OR TYPE = 'E'.
    WRITE:/ IT_RETUN-TYPE, ' ', IT_RETUN-MESSAGE.
    EXIT.
    ENDLOOP.
    ENDLOOP.
    IF SY-SUBRC = 0.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    commit work and WAIT.
    ENDIF.
    *& Form f_upload
    text
    -->P_ITAB text
    -->P_P_FILE1 text
    FORM F_UPLOAD TABLES P_ITAB STRUCTURE ITAB
    USING P_P_FILE1.
    DATA: V_FILE TYPE STRING.
    V_FILE = P_P_FILE1.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    FILENAME = V_FILE
    FILETYPE = 'ASC'
    HAS_FIELD_SEPARATOR = 'X'
    TABLES
    DATA_TAB = ITAB.
    IF SY-SUBRC <> 0.
    ENDIF.
    ENDFORM. " f_upload
    *& Form f_upload1
    text
    -->P_ITAB1 text
    -->P_P_FILE2 text
    FORM F_UPLOAD1 TABLES P_ITAB1 STRUCTURE ITAB1
    USING P_P_FILE2.
    DATA: V_FILE1 TYPE STRING.
    V_FILE1 = P_P_FILE2.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    FILENAME = V_FILE1
    FILETYPE = 'ASC'
    HAS_FIELD_SEPARATOR = 'X'
    TABLES
    DATA_TAB = ITAB1.
    IF SY-SUBRC <> 0.
    ENDIF.
    ENDFORM. " f_upload1
      Thanks in Advance...
    Points Rewarded.
    Regards.
    Ravi...
    Message was edited by:
            Ravi reddy

    Hi Naveen,
    Thanks for the reply. Even after using FM QAVE_PROCESS_AUTO_UD,when i execute
    BAPI_GOODSMVT_CREATE, the same thing is happening.I am unable to see the stock deducted in QA33.
    Is there any input in the goods mvt bapi where we can provide inspection lot no since i believe that the goods mvt has to get connected with the inspection lot.

  • Hi Experts..i have a problem regarding BAPI at the time of creating the structure.

    When i create the structure for particular field it will display the message "Field name VBELN does not agree with proposed name SD_DOC for BAPI table".
    Kindly help me.
    Regards,
    Abhishek K.

    Hello Raymond,
    I had problem of creating structure for BAPI Now it is Solved .
    And Yes i have created RFC Function Module.
    But i get some problem during Activation.
    Could you help me on this?
    Code:->
    FUNCTION ZBAPI_DEMO_SD.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(FM_VBELN) TYPE  VBAP-VBELN
    *"  EXPORTING
    *"     VALUE(RETURN) TYPE  BAPIRETURN
    *"  TABLES
    *"      ZITEMDATA STRUCTURE ZBAPI_TABLE OPTIONAL
      SELECT POSNR
             MATNR
             MATKL
             PSTYV
             MEINS FROM VBAP INTO TABLE ZITEMDATA
        WHERE VBELN = FM_VBELN.
    ENDFUNCTION.
    Error: ->"Report/Program statement Missing or Program type is I (Include)".
    Regards,
    Abhishek K.

Maybe you are looking for

  • I seem to have a brick help!

    I have a P105 s6147 and it will not boot up.  Power cord and battery good, tried a new hard drive just in case and it will not boot up.  Power light lites up and thats it.  It started to not boot up a couple of weeks ago but would with a few tries. N

  • Add field in KSB1

    Hi all, I would like to know if I could add GL field (like BKPF-XBLNR) on KSB1 Report ? And if yes, how can I do it ? Best regards, Gilles.

  • Autonumber setting overwritten

    I have over 100 tables in an oracle database where each of them has a corresponding sequence generator. For each of the physical services corresponding to these tables, I have gone to the trouble of setting the autonumber property so that the corresp

  • Function RH_STRUC_GET

    Hi All, I'm using this function to get the staffing assignment. But in case I have more than one person holding position the function return only one holder.  Are there any other functions that return structure (according to root objects and evaluati

  • How to stop the generation of the trace files relate to the particular user

    Dear All, Please advice: Is it possible to stop the trace file created by a user for a particular job (sql/exp) For example : Trace files create whenever the user run the sql/exp command from his application server. This will created a huge files and