Create quality notification using bapis

Hi all
i want to create quality notification(QM01) using bapi. I know bapi - BAPI_QNOTIFICAT_CREATE can be used to create that.  Using this i can create basic quality notifcation.But if you  go to transaction QM1, there are two more tabs  -  validity datetask and materialquantitydelivery date. How to populate these two tabs. Is any other bapi need for the same?

I had to create a notification and fill Material , batch , product cat,Disposition , Reference , priority ,department , coding, description
I had a reference notification and i used the foll code to create new noti.
        SELECT SINGLE zzprdcat zzdispos zzdivisn qwrnum refnum
                      priok qmcod qmkat qmtxt qmgrp objnr INTO
                (gs_qmel-zzprdcat, gs_qmel-zzdispos, gs_qmel-zzdivisn,
                       gs_qmel-qwrnum, gs_qmel-refnum, gs_qmel-priok,
                       gs_qmel-qmcod, gs_qmel-qmkat, gs_qmel-qmtxt,
                       gs_qmel-qmgrp, gs_qmel-objnr)
                              FROM qmel WHERE qmnum = gs_qmel1-qmnum.
        SELECT SINGLE parnr INTO (ihpa-parnr) FROM ihpa
                                    WHERE objnr = gs_qmel-objnr
                                    AND   parvw = 'AB'.
        PERFORM bdc_dynpro      USING 'SAPLIQS0' '0200'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RIWO00-QMART'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'RIWO00-QMART'
                                       c_qmart.
        PERFORM bdc_dynpro      USING 'SAPLIQS0' '7200'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=10\TAB02'.
        PERFORM bdc_field       USING 'VIQMEL-MATNR'
                                       gs_mseg-ummat.
        PERFORM bdc_field       USING 'VIQMEL-CHARG'
                                       gs_mseg-umcha.
        PERFORM bdc_field       USING 'VIQMEL-ZZPRDCAT'
                                       gs_qmel-zzprdcat.
        PERFORM bdc_field       USING 'VIQMEL-ZZDIVISN'
                                       gs_qmel-zzdivisn.
        PERFORM bdc_field       USING 'VIQMEL-ZZDISPOS'
                                       gs_qmel-zzdispos.
        PERFORM bdc_field       USING 'VIQMEL-QWRNUM'
                                       gs_qmel-qwrnum.
        PERFORM bdc_field       USING 'VIQMEL-REFNUM'
                                       gs_qmel-refnum.
        PERFORM bdc_field       USING 'VIQMEL-PRIOK'
                                       gs_qmel-priok.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'DIIHPA-I_PARNR'.
        PERFORM bdc_field       USING 'DIIHPA-I_PARNR'
                                       ihpa-parnr.
        PERFORM bdc_field       USING 'RQM02-PARNR_VERA'
                                       sy-uname.
        PERFORM bdc_dynpro      USING 'SAPLIQS0' '7200'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'VIQMEL-QMCOD'.
        PERFORM bdc_field       USING 'VIQMEL-QMGRP'
                                       gs_qmel-qmgrp.
        PERFORM bdc_field       USING 'VIQMEL-QMCOD'
                                       gs_qmel-qmcod.
        PERFORM bdc_field       USING 'RIWO00-HEADKTXT'
                                       gs_qmel-qmtxt.
        PERFORM bdc_dynpro      USING 'SAPLIQS0' '7200'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=BUCH'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'VIQMEL-QMCOD'.
        PERFORM bdc_field       USING 'VIQMEL-QMGRP'
                                       gs_qmel-qmgrp.
        PERFORM bdc_field       USING 'VIQMEL-QMCOD'
                                       gs_qmel-qmcod.
        PERFORM bdc_field       USING 'RIWO00-HEADKTXT'
                                       gs_qmel-qmtxt.
        CALL TRANSACTION 'QM01' USING bdcdata
                        MODE gc_mode
                        MESSAGES INTO messtab .
Thanks

Similar Messages

  • Creating Quality Notification via BAPI

    I am attempting to create a quality notification using BAPI_QUALNOT_CREATE but am running into an issue.  I need the ability to link the inspection lot number to the quality notification but I do not see a field for inspection lot in any of the BAPI segments.  When i record results using defect codes in SAP, the quality notification that is created has the inspection lot linked to it (in the reference object tab).  As there another field within the BAPI that i can use to pass the inspection lot number??
    Thanks in advance...

    Brock,
    Thanks for the response.  I have attempted to use the FM you suggested but still am not having much luck.  After I feed the required data to the FM, I am prompted with the error message u201CNo quality notification type maintained for inspection lot type.u201D  However in SPRO, under Quality Management -> Quality Inspection -> Inspection Lot Creation -> Maintain Inspection Types, the notification type is defined for each of the inspection types I am using.  Is there any additional configuration I may be missing?  Thanks againu2026
    Harm

  • Create Quality Notification

    Hi,
    I want to create quality notification  and print the same in a report.
    there is a BAPI , which is not useful in my case, as i have to give batch, order,matnr, long text etc fields.
    can anybody give some FM to create a QNotification.
    and I want to print the notification from the program.
    How to print the notification from the program.
    Regards,
    K.K

    Hi,
    BAPIs for quality notifications
    BAPI_QNOTIFICAT_CREATE Create Quality Notification
    BAPI_QNOTIFICAT_GETCATALPROFIL Determine Catalog Profile for Quality Notification
    BAPI_QNOTIFICAT_GETKEYFIGURES Determines Existing Quality Notifications
    BAPI_QNOTIFICAT_GETLISTFORCUST Select Quality Notifications for a Customer
    BAPI_QNOTIFICAT_GETMATLISTFCUS Select a Customer Material List for Quality Notifications
    Use the one that matches ur requirement.
    Regards,
    Ramya

  • Planner group is not updated in service notification using BAPI

    Hi,
    Planner group is not updated in service notification using BAPI BAPI_ALM_ORDER_MAINTAIN.
    I have written the below code, but planner group is not updated in the service notification.
    Please advice which parameters do i need to pass to update planner group in the service notification.
              wa_methods-refnumber      = '000001'.
              wa_methods-objecttype     = 'PARTNER'.
              wa_methods-method         = 'CREATE'.
              wa_methods-objectkey      = wa_subscr1-aufnr.
              APPEND wa_methods TO i_methods.
              wa_methods-refnumber      = '000002'.
              wa_methods-objecttype     = 'HEADER'.
              wa_methods-method         = 'CREATE'.
              wa_methods-objectkey      = wa_subscr1-aufnr.
              APPEND wa_methods TO i_methods.
              wa_methods-refnumber      = '000000'.
              wa_methods-objecttype     = ' '.
              wa_methods-method         = 'SAVE'.
              APPEND wa_methods TO i_methods.
              REFRESH i_partner.
              CLEAR wa_partner.
              wa_partner-orderid        = wa_subscr1-aufnr.
              wa_partner-partn_role     = 'VW'.
              wa_partner-partn_role_old = ''.
              wa_partner-partner        = wa_subscr1-parnr.
              wa_partner-partner_old    = ''.
              APPEND wa_partner TO i_partner.
              REFRESH i_planrgrp.
              CLEAR wa_planrgrp.
              wa_planrgrp-orderid        = wa_subscr1-aufnr.
              wa_planrgrp-plangroup      = wa_subscr1-ingpr.
              APPEND wa_planrgrp TO i_planrgrp.
              REFRESH i_planrgrp_up.
              CLEAR wa_planrgrp_up.
              wa_planrgrp_up-orderid     = wa_subscr1-aufnr.
              wa_planrgrp_up-plangroup   = 'X'.
              APPEND wa_planrgrp_up TO i_planrgrp_up.
    *----Change order details with Technician name
              CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
                TABLES
                  it_methods   = i_methods
                  it_header    = i_planrgrp
                it_header_up = i_planrgrp_up
                  it_partner   = i_partner
                  return       = i_return.
    Thanks & regards,
    Krishna

    Try this way
    CALL FUNCTION 'BAPI_SERVNOT_CREATE'
    EXPORTING
    * EXTERNAL_NUMBER =
    notif_type = 'S3'
    notifheader = ls_notif_h
    * TASK_DETERMINATION = ' '
    * SENDER =
    * ORDERID =
    IMPORTING
    NOTIFHEADER_EXPORT = ls_notif_e
    TABLES
    * NOTITEM =
    * NOTIFCAUS =
    * NOTIFACTV =
    * NOTIFTASK =
    * NOTIFPARTNR =
    * LONGTEXTS =
    * KEY_RELATIONSHIPS =
    return = lt_return
    * IF lt_return IS INITIAL.                                               " <<< Comment this lie
    read table  lt_return into ls_return with key type = 'E'. " << Change
    if sy-subrc ne 0.                                                             " << Change
    COMMIT WORK AND WAIT.
    write: / ls_notif_e-NOTIF_NO.
    ELSE.
    LOOP AT lt_return INTO ls_return.
    WRITE:/ 'errors'.
    * ls_return.
    ENDLOOP.
    endif.

  • Problem in customer address while creating service notification using IW51

    Hi Experts,
    I am trying to create a BDC recording for creating Service Notification using transaction IW51. I have done the recording as follows. On the First screen I am entering notification type. Then on the next screen I am entering the Sold to party  and its address by clicking on the icon besides it. After that i enter Functional location, equipment, priority and req end date and save it.  When I am running this recording after transferring it to a progam , somehow the address disappears for the newly created notification. I am not able to figure out the reason. Kindly guide me.
    Thanks,
    Sonal

    I assume you have tried this with update mode = 'A'-all and watched it actually work correctly?  May I ask why the BDC instead of BAPI?  Is it because you're creating a new partner?  If so, are you pressing save on that partner creation?

  • QM01 - Add Production Order field to Create Quality Notification

    Hi all SDNers,
    I have searched and found many threads related to my question BUT I'm new to this and I don't know how to implement in detail.
    Would you please guide me step by step adding a field into a standard TCode?
    My requirement is to add the Production Order field (VIQMEL-FERTAUFNR) to the Create Quality Notification (QM01) Tcode under the 1st screen in Reference Documents section of the Reference Objects tab.
    The program is SAPMQM00 and screen number is 3011.
    Thanks,
    Khanh

    Hi all,
    I used the screen number 0140 in program SAPLQM03 as the initial screen before creating Notification type Q2.
    Use SPRO:
    Quality Management --> Quality Notifications --> Notification Creation --> Notification Type
    --> Define Screen Templates --> Define Initial Screens
    Then use Function Module QM03_CREATE_QMEL_WITH_WINDOW and screen 0140 above to configure.
    Hope this will help others.
    Regards,
    Khanh

  • Steps to create Quality Notification

    Hi,
    Can anyone let me know the steps involved and the process to create Quality Notification.
    Regards,
    Ram

    Hi ,
    Ram hope this helps you in creating the QN .
    <b>Creating a quality notification</b>:
    1.Choose Logistics-> Quality management -> Quality notification->  Create.
    2.Enter the notification type and then choose Enter.
    <b>Notification types:</b>
    Q1 - Customer complaint
    Q2 - Complaint against vendor
    Q3 - Internal problem
    Another dialog box may be displayed before the notification is created, depending on how the quality notifications were customized. If a dialog box is displayed, you may have to enter additional reference information (for example, a material, sales order or delivery).
    <b>Creating a user-specific quality notification</b>
    1.Choose Logistics -> Quality management -> Quality notification -> Create.
    2.Enter the notification type and then choose Enter.
    To be able to create a user-specific notification, you must specify a user-specific notification type that has been predefined in Customizing.
    <b>Creating a quality notification with reference</b>
    1.Choose Logistics -> Quality management -> Quality notification-> Create.
    2.Enter the notification type.
    3.Enter the number of the notification you want use as a copy model and choose Enter
    To reduce the amount of data that you need to enter, you can use an existing quality notification as a copy model. You can use any notification type as a copy model, regardless of the notification type for the new notification.
    When you save the new quality notification, the notification you used as a copy model is saved at the same time in the notification. This means that you can later select the quality notifications that were created using certain references.
    <b>Changing a quality notification</b>
    1.Choose Logistics-> Quality management -> Quality notification -> Change.
    2.Enter the number of the notification you want to change and choose Enter.
    Make the necessary changes to the notification and then save the data
    If you have further queries please do write .
    cheers
    kp

  • Unable to capture error message while creating an SO using bapi

    Hi,
    Can anybody suggest how to capture the error message while creating a SO using BAPI.
    I have developed a customeized BAPI and using the BDC format to create the SO.
    Note: i am using a call transaction method for the BDC.
    I am sending the message into message1.
    but i am unable to send the same into an internal table
    shyam.

    Hi Shyam
    If my understanding is correct, you are performing BDC process within the customized BAPI...
    And you want to collect the messages from BDC to an internal table and pass to the output.
    Proceed as below:
    1. While calling BDC, use CALL TRANSACTION .... with addition: <b>MESSAGES INTO itab</b>. The structure of itab should be like <b>BDCMSGCOLL</b>.
    2. Now the messages will be collected in ita.
    3. Prepare the messages using FM: <b>FORMAT_MESSAGE</b>
    4. Collect to the returning table.
    Hope this helps...
    Though i could not understand the reason of creating a BDC within BAPI, you can opt for loading orders via BAPI's like: BAPI_SALESORDER_CREATEFROMDAT1 or BAPI_SALESORDER_CREATEFROMDAT2.
    Kind Regards
    Eswar

  • Error while Creating WBS element using BAPI 'BAPI_BUS2054_CREATE_MULTI'

    Hi Expert,
    I've a requirement to create WBS elements using BAPI. And I am using BAPIs in the following manner.
    CALL FUNCTION 'BAPI_PS_INITIALIZATION'
      CALL FUNCTION 'BAPI_BUS2054_CREATE_MULTI'
        EXPORTING
          i_project_definition = g_pdwbs
      TABLES
        it_wbs_element             = it_wbs_element
       et_return                  = it_return
      EXTENSIONIN                =
      EXTENSIONOUT               =
        CALL FUNCTION 'BAPI_PS_PRECOMMIT'
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    When I do so I am getting the below errors. Please suggest.
    "Individual check for creating the object WBS Element C-497082 required ".
    "Individual check for creating the object WBS Element C-497082-0001 required".
    Please suggest how to correct this error. 
    <REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>
    Edited by: Alvaro Tejada Galindo on Aug 18, 2008 5:25 PM

    I am getting the same error, but I cannot figure it out how to detect it and fix it.  Will you please share your solution?
    Thanks,

  • Error while creating activity by using BAPI

    Hi,
    While creating activity by using BAPI Im getting error as follows,
    Start processing of refference object handle generated.
    Integrity rule a d0008 broken
    business partner with function from vbkakom not vbpakom
    Integrity rule a d0008 broken
    edit all incomplete field .
    Please help me for solving this issue.
    Regards,
    Suresh

    Not received any proper reply Closing the issue.

  • Create Excise invoice(J1IIN) document while creating billing document using bapi BAPI_BILLINGDOC_CREATEMULTIPLE

    Dear Experts,
    My scenario is:
    We have batch split scenario, where the parent line item of billing document has 0 quantity and its subsequent item (item with batch number) holds actual quantity data.
    When we create billing document using VF01 against delivery document, system creates billing document along with excise invoice document (J1IIN Document). And in excise document contain same number of line items that of billing document. Please see the below attachment: 
    Biiling document screen shot:
    While creating billing document, the J1IIN Document created automatically. Below is the screen-shot for the same.
    Now the issue is:
    When we create billing document using BAPI: BAPI_BILLINGDOC_CREATEMULTIPLE system creating only billing document and not creating excise invoice document.
    When we create excise document manually using J1IIN the zero quantity line items are excluded in excise invoice document.
    Please see the below screen-shot for the same; The z quantity line items are missing.
    We want excise document to be created while creating billing document using BAPI BAPI_BILLINGDOC_CREATEMULTIPLE. Or is there any other BAPI for the same purpose.
    Customization is also maintained for creating excise invoice document automatically.
    Regards,
    Rajesh Sadula.

    HI
      Pricing will be carried basing on the pricing
    procedure.
    Case1: Prices will be carried out automatically if
    necessary condition records are maintained for the
    condition type.
      For this you can go to Sales Order-> Item Conditions
    In the screen you can click on command button Analysis,
    which gives you the list of condition types associated
    to the pricing procedure. By clicking on the condition
    type you can know the action that has taken place.
    Case2: Manually forcing prices for Items.
      To do this, you have to populate ORDER_CONDITIONS_IN &
    ORDER_CONDITIONS_INX. Also note to identify the item
    numbers, you manually pass the item number for each item
    in the sales order, use the same item number for
    populating conditions.
      Parameters required:
    ORDER_CONDITIONS_IN:
      ITM_NUMBER, COND_TYPE, COND_VALUE, CURRENCY
    ORDER_CONDITIONS_INX:
      ITM_NUMBER, COND_TYPE, UPDATEFLAG, COND_VALUE,CURRENCY.
       Hope the above info helps you. Do revert back if you
    need more info.
    Kind Regards
    Eswar

  • Setting user specific contract data while creating sales order using BAPI

    Hi all,
    I am creating sales order using BAPI - BAPI_SALESORDER_CREATEFROMDAT2.
    Now my problem is that there is no structure for contract data (i.e. VEDA), system automatically set contract data using customization values.
    I am doing some validations on cotract data in MV45AFZZ which fails, because these validations are performed on standard values, user specific values r not set.
    How to handle this issue, your small clue may help a lot.
    Regards,
    S@meer

    HI
      Pricing will be carried basing on the pricing
    procedure.
    Case1: Prices will be carried out automatically if
    necessary condition records are maintained for the
    condition type.
      For this you can go to Sales Order-> Item Conditions
    In the screen you can click on command button Analysis,
    which gives you the list of condition types associated
    to the pricing procedure. By clicking on the condition
    type you can know the action that has taken place.
    Case2: Manually forcing prices for Items.
      To do this, you have to populate ORDER_CONDITIONS_IN &
    ORDER_CONDITIONS_INX. Also note to identify the item
    numbers, you manually pass the item number for each item
    in the sales order, use the same item number for
    populating conditions.
      Parameters required:
    ORDER_CONDITIONS_IN:
      ITM_NUMBER, COND_TYPE, COND_VALUE, CURRENCY
    ORDER_CONDITIONS_INX:
      ITM_NUMBER, COND_TYPE, UPDATEFLAG, COND_VALUE,CURRENCY.
       Hope the above info helps you. Do revert back if you
    need more info.
    Kind Regards
    Eswar

  • Creating sales order using bapi

    while creating sales order using bapi serial no is added in dat but its not saving.
    plz reply

    Hi
    See tha sample code for sales order creation
    SALES ORDER INPUT CREATION.
    PARAMETERS: p_auart TYPE auart OBLIGATORY.
    PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    PARAMETERS: p_spart TYPE vtweg OBLIGATORY.
    PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
    PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
    *ITEM
    PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
    PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
    PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    PARAMETERS: p_itcat TYPE pstyv OBLIGATORY.
    DATA DECLARATIONS.
    DATA: v_vbeln LIKE vbak-vbeln.
    DATA: header LIKE bapisdhead1.
    DATA: headerx LIKE bapisdhead1x.
    DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
    DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
    DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
    DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
    WITH HEADER LINE.
    DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
    WITH HEADER LINE.
    HEADER DATA
    header-doc_type = p_auart.
    headerx-doc_type = 'X'.
    header-sales_org = p_vkorg.
    headerx-sales_org = 'X'.
    header-distr_chan = p_vtweg.
    headerx-distr_chan = 'X'.
    header-division = p_spart.
    headerx-division = 'X'.
    headerx-updateflag = 'I'.
    PARTNER DATA
    partner-partn_role = 'AG'.
    partner-partn_numb = p_sold.
    APPEND partner.
    partner-partn_role = 'WE'.
    partner-partn_numb = p_ship.
    APPEND partner.
    ITEM DATA
    itemx-updateflag = 'I'.
    item-itm_number = '000010'.
    itemx-itm_number = 'X'.
    item-material = p_matnr.
    itemx-material = 'X'.
    item-plant = p_plant.
    itemx-plant = 'X'.
    item-target_qty = p_menge.
    itemx-target_qty = 'X'.
    item-target_qu = 'EA'.
    itemx-target_qu = 'X'.
    item-item_categ = p_itcat.
    itemx-item_categ = 'X'.
    APPEND item.
    APPEND itemx.
    Fill schedule lines
    lt_schedules_in-itm_number = '000010'.
    lt_schedules_in-sched_line = '0001'.
    lt_schedules_in-req_qty = p_menge.
    APPEND lt_schedules_in.
    Fill schedule line flags
    lt_schedules_inx-itm_number = '000010'.
    lt_schedules_inx-sched_line = '0001'.
    lt_schedules_inx-updateflag = 'X'.
    lt_schedules_inx-req_qty = 'X'.
    APPEND lt_schedules_inx.
    Call the BAPI
    CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
    EXPORTING
    sales_header_in = header
    sales_header_inx = headerx
    IMPORTING
    salesdocument_ex = v_vbeln
    TABLES
    return = return
    sales_items_in = item
    sales_items_inx = itemx
    sales_schedules_in = lt_schedules_in
    sales_schedules_inx = lt_schedules_inx
    sales_partners = partner.
    Check the return table.
    LOOP AT return WHERE type = 'E' OR type = 'A'.
    EXIT.
    ENDLOOP.
    IF sy-subrc = 0.
    WRITE: / 'Error in creating document'.
    ELSE.
    COMMIT WORK AND WAIT.
    WRITE: / 'Document ', v_vbeln, ' created'.
    ENDIF.
    after that check in the table VBAP whether serial number is cretaed or not
    Reward points if useful
    Regards
    Anji

  • HOW TO CREATE PURCHASE ORDER USING BAPI

    HI FRIENDS,
    I HAVE URGENT REQUIREMNT ,TO CREATE PURCHASE ORDER USING BAPI.PLS HELP ON THIS.
    UR'S
    RAVI

    Hi
    See the sample code and do accordingly
    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
    Reward points if useful
    Anji

  • To create shipment order using BAPI

    hi,
    i know the bapi_shipment_create is the bapi ,i have to useto create shipment order but the structures & the fields inside that bapi is unfamiliar to me.so i need some samples so that i can follow.
    1)i want to know which structures , i have to use & what r the fields of that structures, i have to pass so that a shipment order will be created.
    that means,  what r the fields of that bapi i have to use to crete a complete shipment order?plz suggest.
    can anyone send me some sample code for creating shipment order using bapi?
    Thanks & Regards

    It will take to provide Examples
    First analyse it BAPI Explorer.
    Go for the documentation
    Go for the test runs in tools tabstrip and in that identify the mandatory fields.
    If u know the transaction go for the shipment order creation for test run to identify mandatory fields.
    build the structures as it is in the bapi fm

Maybe you are looking for

  • Safari hangs and crashes

    I've owned a MPB for 13 months and for 13 months it's been nothing but headaches. I know that to other Mac users this sounds negative because Apple products are cool, but my experience with my MPB has been nothing but negative. I've written to the Cu

  • Mouse not working properly

    mouse is not working properly.  everything was fine in the store but as soon as i got home the mouse was not working

  • Posting From IE11 in Windows 8.1

    I've put up a couple of test systems on the Windows 8.1 Preview, both Pro and Enterprise editions. Just testing to see how the forum interacts with Internet Explorer 11.  So far so good - I have been able to log in and see things looking pretty much

  • Is it possible to show live and vod in one stream?

    hello i am playing here with fms i want to make a sort of home tv-channel i have created ".swf-tv_set" for the end user wich connects to my server the question is: what techniques should i use (on server-side maybe) to control what type of data (live

  • Extension of warrenty for 2 years

    i would like to extend warrenty period for 2 years for my HP Lapton from now.  what is theproceedure for extension.  Pl let me know urgently. rk kumar 9443009712