Service fields problem in BAPI_PO_CREATE1 function

hi all,
I have a problem when I use BAPI_PO_CREATE1 to create a Purchasing order.
I want to create a service PO in the system ( R3 4.6C ) .  I have the data from our key user and I can create PO sucessfully manually. But when using BAPI, It alway occurs a error.
I use POSERVICE Structure, But i have NO idea about which field is MUST, Is there anyone have an example about these service PO??
Any suggestion is helpful and thanks in advance.
Regards
Ned

hi,
WELCOME TO SDN.
use this program for creating service po's using bapi.
*& Report  ZMM_PO_CREATE1                                              *
REPORT  ZMM_PO_CREATE1                          .
data : POHEADER like BAPIMEPOHEADER occurs 0 with header line,
       POHEADERX like BAPIMEPOHEADERX occurs 0 with header line,
       POITEM like BAPIMEPOITEM occurs 0 with header line,
       POITEMX like BAPIMEPOITEMX occurs 0 with header line,
       POESLLC like BAPIESLLC occurs 0 with header line,
       POACCOUNT like BAPIMEPOACCOUNT occurs 0 with header line,
       POACCOUNTX like BAPIMEPOACCOUNTX occurs 0 with header line,
       POCONDHEADER like BAPIMEPOCONDHEADER occurs 0 with header line,
       POCONDHEADERX like BAPIMEPOCONDHEADERX occurs 0 with header line,
       POCOND like BAPIMEPOCOND occurs 0 with header line,
       RETURN like BAPIRET2 occurs 0 with header line.
data : po_no(10).
data : begin of it_head occurs 0,
       ref(10),
       bsart like ekko-bsart,
       lifnr like ekko-lifnr,
       ekorg like ekko-ekorg,
       ekgrp like ekko-ekgrp,
       bukrs like ekko-bukrs,
       verkf like ekko-verkf,
       telf1 like ekko-telf1,
       ihrez like ekko-ihrez,
       unsez like ekko-unsez,
       kdatb(10),
       kdate(10),
       end of it_head.
data : begin of it_det occurs 0,
       ref(10),
       knttp like ekpo-knttp,
       pstyp like ekpo-pstyp,
       txz01 like ekpo-txz01,
       matkl like ekpo-matkl,
       werks like ekpo-werks,
       afnam like ekpo-afnam,
       ktext1 like esll-ktext1,
       srvpos like esll-srvpos,
       frmval1 like esll-frmval1,
       frmval2 like esll-frmval2,
       menge like esll-menge,
       kostl like eskn-kostl,
       sakto like eskn-sakto,
       zzcode like eskn-zzcode,
       kbetr like konv-kbetr,
       end of it_det.
data : c_col1 TYPE i VALUE '0001',
       c_col2 TYPE i VALUE '0002',
       c_col3 TYPE i VALUE '0003',
       c_col4 TYPE i VALUE '0004',
       c_col5 TYPE i VALUE '0005',
       c_col6 TYPE i VALUE '0006',
       c_col7 TYPE i VALUE '0007',
       c_col8 TYPE i VALUE '0008',
       c_col9 TYPE i VALUE '0009',
       c_col10 TYPE i VALUE '0010',
       c_col11 TYPE i VALUE '0011',
       c_col12 TYPE i VALUE '0012',
       c_col13 TYPE i VALUE '0013',
       c_col14 TYPE i VALUE '0014',
       c_col15 TYPE i VALUE '0015',
       c_col16 TYPE i VALUE '0016'.
data : v_currentrow type i,
       v_currentrow1 type i.
data : itab_head like ALSMEX_TABLINE occurs 0 with header line,
       itab_det like ALSMEX_TABLINE occurs 0 with header line.
data : file_head type RLGRAP-FILENAME,
       file_item type RLGRAP-FILENAME.
file_head = 'C:\Documents and Settings\Desktop\head.xls'.
file_item = 'C:\Documents and Settings\Desktop\item.xls'.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
  EXPORTING
    filename                      = file_head
    i_begin_col                   = 1
    i_begin_row                   = 1
    i_end_col                     = 12
    i_end_row                     = 50
  tables
    intern                        = itab_head
EXCEPTIONS
  INCONSISTENT_PARAMETERS       = 1
  UPLOAD_OLE                    = 2
  OTHERS                        = 3
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 'ALSM_EXCEL_TO_INTERNAL_TABLE'
  EXPORTING
    filename                      = file_item
    i_begin_col                   = 1
    i_begin_row                   = 1
    i_end_col                     = 16
    i_end_row                     = 50
  tables
    intern                        = itab_det
EXCEPTIONS
  INCONSISTENT_PARAMETERS       = 1
  UPLOAD_OLE                    = 2
  OTHERS                        = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF itab_head[] IS INITIAL.
   WRITE:/ 'No Header Data  Exists '.
   STOP.
ELSE.
sort itab_head by row col.
read table itab_head index 1.
v_currentrow = itab_head-row.
loop at itab_head.
if itab_head-row ne v_currentrow.
   APPEND it_head.
   v_currentrow = itab_head-row.
   ENDIF.
CASE itab_head-col.
        WHEN  c_col1.
          it_head-ref = itab_head-value.
        WHEN  c_col2.
          it_head-bsart = itab_head-value.
        WHEN c_col3.
          it_head-lifnr = itab_head-value.
        WHEN c_col4.
          it_head-ekorg = itab_head-value.
        WHEN c_col5.
          it_head-ekgrp = itab_head-value.
        WHEN c_col6.
          it_head-bukrs = itab_head-value.
        WHEN c_col7.
          it_head-verkf = itab_head-value.
        WHEN c_col8.
          it_head-telf1 = itab_head-value.
        WHEN c_col9.
          it_head-ihrez = itab_head-value.
        WHEN c_col10.
          it_head-unsez = itab_head-value.
        WHEN c_col11.
          it_head-kdatb = itab_head-value.
        WHEN c_col12.
          it_head-kdate = itab_head-value.
ENDCASE.
ENDLOOP.
APPEND it_head.
CLEAR it_head.
ENDIF.
IF itab_det[] IS INITIAL.
   WRITE:/ 'No Item Data  Exists '.
   STOP.
ELSE.
sort itab_det by row col.
read table itab_det index 1.
v_currentrow1 = itab_det-row.
loop at itab_det.
if itab_det-row ne v_currentrow1.
   APPEND it_det.
   v_currentrow1 = itab_det-row.
   ENDIF.
CASE itab_det-col.
        WHEN  c_col1.
          it_det-ref = itab_det-value.
        WHEN  c_col2.
          it_det-knttp = itab_det-value.
        WHEN c_col3.
          it_det-pstyp = itab_det-value.
        WHEN c_col4.
          it_det-txz01 = itab_det-value.
        WHEN c_col5.
          it_det-matkl = itab_det-value.
        WHEN c_col6.
          it_det-werks = itab_det-value.
        WHEN c_col7.
          it_det-afnam = itab_det-value.
        WHEN c_col8.
          it_det-srvpos = itab_det-value.
        WHEN c_col9.
          it_det-ktext1 = itab_det-value.
        WHEN c_col10.
          it_det-frmval1 = itab_det-value.
        WHEN c_col11.
          it_det-frmval2 = itab_det-value.
        WHEN c_col12.
          it_det-menge = itab_det-value.
        WHEN c_col13.
          it_det-kostl = itab_det-value.
        WHEN c_col14.
          it_det-sakto = itab_det-value.
        WHEN c_col15.
          it_det-zzcode = itab_det-value.
        WHEN c_col16.
          it_det-kbetr = itab_det-value.
ENDCASE.
ENDLOOP.
APPEND it_det.
CLEAR it_det.
ENDIF.
loop at it_head.
poheader-doc_type = it_head-bsart.
poheader-vendor = it_head-lifnr.
poheader-purch_org = it_head-ekorg.
poheader-pur_group = it_head-ekgrp.
poheader-comp_code = it_head-bukrs.
poheader-sales_pers = it_head-verkf.
poheader-telephone = it_head-telf1.
poheader-REF_1 = it_head-ihrez.
poheader-OUR_REF = it_head-unsez.
poheader-VPER_START = it_head-kdatb.
poheader-VPER_END = it_head-kdate.
loop at it_det where ref = it_head-ref.
  poitem-acctasscat = it_det-knttp.
  poitem-item_cat = it_det-pstyp.
  poitem-short_text = it_det-txz01.
  poitem-matl_group = it_det-matkl.
  poitem-plant = it_det-werks.
  poitem-PREQ_NAME = it_det-afnam.
  POESLLC-SERVICE = it_det-srvpos.
  POESLLC-SHORT_TEXT = it_det-ktext1.
  POESLLC-FORM_VAL1 = it_det-frmval1.
  POESLLC-FORM_VAL2 = it_det-frmval2.
  POESLLC-QUANTITY = it_det-menge.
  POACCOUNT-COSTCENTER = it_det-kostl.
  POACCOUNT-GL_ACCOUNT = it_det-sakto.
  POCONDHEADER-COND_TYPE = 'R000'.
  POCONDHEADER-COND_VALUE = it_det-kbetr.
endloop.
endloop.
poheaderx-doc_type = 'X'.
poheaderx-vendor = 'X'.
poheaderx-purch_org = 'X'.
poheaderx-pur_group = 'X'.
poheaderx-comp_code = 'X'.
poheaderx-sales_pers = 'X'.
poheaderx-telephone = 'X'.
poheaderx-REF_1 = 'X'.
poheaderx-OUR_REF = 'X'.
poheaderx-VPER_START = 'X'.
poheaderx-VPER_END = 'X'.
poitemx-acctasscat = 'X'.
poitemx-item_cat = 'X'.
poitemx-short_text = 'X'.
poitemx-matl_group = 'X'.
poitemx-plant = 'X'.
poitemx-PREQ_NAME = 'X'.
*POESLLCx-SHORT_TEXT = 'X'.
POACCOUNTx-COSTCENTER = 'X'.
POACCOUNTx-GL_ACCOUNT = 'X'.
POCONDHEADER-cond_type = 'X'.
CALL FUNCTION 'BAPI_PO_CREATE1'
  EXPORTING
    poheader                     = poheader
   POHEADERX                    = poheaderx
  POADDRVENDOR                 =
  TESTRUN                      =
  MEMORY_UNCOMPLETE            =
  MEMORY_COMPLETE              =
  POEXPIMPHEADER               =
  POEXPIMPHEADERX              =
  VERSIONS                     =
  NO_MESSAGING                 =
  NO_MESSAGE_REQ               =
  NO_AUTHORITY                 =
  NO_PRICE_FROM_PO             =
IMPORTING
   EXPPURCHASEORDER             = po_no
  EXPHEADER                    =
  EXPPOEXPIMPHEADER            =
TABLES
   RETURN                       = return
   POITEM                       = poitem
   POITEMX                      = poitemx
  POADDRDELIVERY               =
  POSCHEDULE                   =
  POSCHEDULEX                  =
   POACCOUNT                    = poaccount
  POACCOUNTPROFITSEGMENT       =
   POACCOUNTX                   = poaccountx
   POCONDHEADER                 = pocondheader
   POCONDHEADERX                = pocondheaderx
  POCOND                       =
  POCONDX                      =
  POLIMITS                     =
  POCONTRACTLIMITS             =
   POSERVICES                   = poesllc
  POSRVACCESSVALUES            =
  POSERVICESTEXT               =
  EXTENSIONIN                  =
  EXTENSIONOUT                 =
  POEXPIMPITEM                 =
  POEXPIMPITEMX                =
  POTEXTHEADER                 =
  POTEXTITEM                   =
  ALLVERSIONS                  =
  POPARTNER                    =
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
   WAIT          =
IMPORTING
   RETURN        =
if sy-subrc = 0.
loop at return.
write return-MESSAGE_V1.
write po_no.
endloop.
endif.

Similar Messages

  • ITSM Service Request - Assigning Categories - Using Function Module

    Hi,
    We are trying to create an ITSM service request ticket from ECC, based on a workflow and its logic. I am calling a remote function module which will contain the logic as explained below.
    I am creating a CRM ITSM service request(incident) ticket using function module CRM_ICSS_SRVREQ_CREATE.
    The ticket is created but some of the fields that I need to populate in the transaction do not have an interface in this function module. I want to specify the category 1, category 2 and category 3.
    I tried function module CRM_ORDER_MAINTAIN but I am unable to find the interface where I can populate this particular data. The component used here is btcategories/categories.
    Can anyone suggest where this particular data needs to be populated.
    Thanks,
    Abdullah

    Hi Abdulla
    What parameter did you set for "Reported By" and "Message Processor" in the FM CRM_ICSS_SRVREQ_CREATE. I am having a lot of problems regarding this. Can you please help?
    Thanks
    Saumyendra

  • Adhoc query - length of service fields

    Hi all,
    I have question regarding the length of service fields in adhoc query (Actions infotype data fields PNP database).
    When I select these fields I get different results according to reporting period; if i select a keydate then the service is calculated according to this date, but if I select a reporting period, then the service is calculated according to the start date of the reporting period.
    Is this expected behaviour? Please let me know how this can be coded to reference the end date of the reporting period.
    many thanks

    Hi,
    Please check OSS notes 333517 and 357093. Both notes, though from 2000, contain detailed functionality and recommendation around u201Clength of serviceu201D.
    Hope this helps.
    Donnie

  • Problem in  using function module parameters in abap program

    i want to use the coding present in on one of the function module 'AS_API_INFOSTRUC_FIND'  i got the problem using the function module parameters in my abap program.
    these are the parameters inside fm
    ""Lokale Schnittstelle:
    *"       IMPORTING
    *"             VALUE(I_FIELDCAT) TYPE  AIND_FCAT
    *"             VALUE(I_FIELDS) TYPE  TABLE OPTIONAL
    *"             VALUE(I_OBLIGATORY_FIELDS) TYPE  TABLE OPTIONAL
    *"       EXPORTING
    *"             VALUE(E_INFOSTRUC) TYPE  AIND_DESC
    *"             REFERENCE(E_ALL_FIELDS) TYPE  TABLE
    *"             REFERENCE(E_MATCHING_FIELDS) TYPE  TABLE
    *"       EXCEPTIONS
    *"              NO_INFOSTRUC_FOUND
    i want to declare     E_ALL_FIELDS  parameter    in my abap program,
    i have declared as 
    data: E_ALL_FIELDS TYPE TABLE.
    but   the system throws error that
    'type of field 'TABLE'  is generic .no table line has been specified'.
    i want to use it in my abap program how can i declare in my abap program .

    You have to declare the table using any specific type.
    The type table in the FM is generic so you can pass any type you need.
    For instance:
    TYPES: BEGIN OF ty_fields,
             fieldname LIKE dfies-fieldname,
           END OF ty_fields,
    TYPES: TY_T_GLU1              LIKE GLU1                     OCCURS 0,
           ty_t_fields            type ty_fields                occurs 0.
      DATA: lt_info_struct_fields TYPE ty_t_fields WITH HEADER LINE,
            lt_matching_fields    TYPE ty_t_fields WITH HEADER LINE.
        CALL FUNCTION 'AS_API_INFOSTRUC_FIND'
             EXPORTING
                  i_fieldcat         = ft_fieldcat-fieldcat
                  i_fields           = ft_fields_filled[]
             IMPORTING
                  e_infostruc        = lv_info_struct_name
                  e_all_fields       = lt_info_struct_fields[]
                  e_matching_fields  = lt_matching_fields[]
             EXCEPTIONS
                  no_infostruc_found = 1.

  • Problem using LIKE function

    Hi Guyz,
    I am having small problem using LIKE function . The problem is I am using LIKE function in the WHERE clause
    to compare a column to a particular value, which gets this value from the front end. If the user has a single quote in the string he entered then the LIKE function is not working because of the single quote. Is there any way I can escape the single quote like we escape '%' and '_'.
    Thankyou.

    Mod_plsql supports bind variables, as do almost all front-end tools that deal with Oracle (and most other databases). I do not code mod pl/sql myself, but others here do, and I see bind variables in their code all the time (if I don't, they hear from me :-)).
    If you pass a bind variable, the quote problem goes away. As far as I know (which is not very far), you should be able to take the string with the quote directly from your input field, bind it to the variable in your query and have no problems.
    I suspect that the reson you are having issues is that you are just gluing strings together to create a sql statement. this is the wrong approach.
    The java term for what you are looking for is prepared statement, I'm not sure what the equivalent is i mod plsql, but that should give you a start.
    John

  • Problem facing in Function module.

    Hi friends,
    Happy New year to all.
    I am facing the problem while crating Function module.
    As my requirement:
    I need to call this Function module in SAP-BW application area. I am creating this in BW side(SE37).
    The intenal table which i am passing to the function module will vary. The structure is not constant.
    Data is flowing from one table(source table) to another table(Destination table) . In BW if we want to refer the data in source table in START ROUTINE while loading, we use SOURCE_PACKAGE internal table.
    1) I am passing Source_package internal table as ITAB_SOURCE_PACKAGE. (this source_package strucute also not canstant, it will vary)
    2) passing second internal table as ITAB1, this structure also vary. I will declare this structure before calling the function module.
    In Function module Table tab i given as
    PARAMETER       TYPE           Associated Type
    ITAB1                   LIKE           ANY     
    ITAB_SOURCE_PACK   LIKE      ANY
    In Import tab:
    SOURCEINFOOBJECT           pass value
    In source code i written as
    DATA: WA_SOURCE_PACK like line of ITAB_SOURCE_PACK.
    DATA: WA_ITAB1 like line of ITAB1.
    LOOP AT ITAB_SOURCE_PACK INTO WA_SOURCE_PACK.
      READ TABLE ITAB1 WITH KEY SOURCEINFOOBJECT = WA_SOURCE_PACK-SOURCEINFOOBJECT
      INTO WA_ITAB1.
      IF SY-SUBRC NE  0.
        WA_ITAB1-SOURCEINFOOBJECT = WA_SOURCE_PACK-SOURCEINFOOBJECT.
        INSERT WA_ITAB1 INTO TABLE ITAB1.
      ENDIF.
    ENDLOOP.
    (Note: this is piece of code)
    While checking i am getting as error
    Field "ANY" is unknown. It is neither in one of the specified tablesnor defined by a "DATA" statement. "DATA" statement. "DATA" statement.
    For this what i need to do.
    As i am not very good in ABAP, pls help me.
    Thanks & Regard
    MRK

    Hi,
    u have to do like this..decalre itab1 and ITAB_SOURCE_PACK in the tables parameter...
    so change like this
    In Function module Table tab do like this
    PARAMETER TYPE Associated Type
    ITAB1
    ITAB_SOURCE_PACK
    In Import tab:
    SOURCEINFOOBJECT pass value
    In source code i written as
    DATA: WA_SOURCE_PACK type ITAB_SOURCE_PACK.
    DATA: WA_ITAB1 type ITAB1.
    LOOP AT ITAB_SOURCE_PACK INTO WA_SOURCE_PACK.
    READ TABLE ITAB1 WITH KEY SOURCEINFOOBJECT = WA_SOURCE_PACK-SOURCEINFOOBJECT
    INTO WA_ITAB1.
    IF SY-SUBRC NE 0.
    WA_ITAB1-SOURCEINFOOBJECT = WA_SOURCE_PACK-SOURCEINFOOBJECT.
    INSERT WA_ITAB1 INTO TABLE ITAB1.
    ENDIF.
    ENDLOOP.
    Regards,
    Nagaraj

  • Problem in executing function module: ERROR_IN_PDO: ERROR_IN_PDO

    Hi all,
    I am getting an error I can't solve until now.. Who can help?
    The Default Trace in the EP 7.0/NWA gives the following information:
    Severity:  Error
    Message: Problem in executing function module:[date]:com.sap.mw.jco.JCO$AbapException: (126) ERROR_IN_PDO: ERROR_IN_PDO
    Category:  /uwl/service
    Location:  com.sap.netweaver.bc.uwl.core.connect.abap.FunctionModuleActionHandler
    Application:  sap.com/tcwddispwda
    The UWL connection tests are correct! So, who can help!
    There is nothing to find in sap notes or sdn forum
    Best regards,
    G. Leurs

    Hi john,
    I am also facing hte same issue.
    when the user is trying to approve the Compleated shopping cart from  the button availble in  the UWL preview , I am getting the below error.
    Exception type:com.sap.netweaver.bc.uwl.connect.ConnectorException Message:Wed Aug 25 12:16:52 CEST 2010 (Connector) :com.sap.netweaver.bc.uwl.connect.ConnectorException:Wed Aug 25 12:16:52 CEST 2010 (Connector) :com.sap.mw.jco.JCO$AbapException:ERROR_IN_PDO
    we are not passing any ABAP role from teh SRM system.
    it would be great if you can share  your views regarding this.
    Raji

  • DATE FIELD PROBLEMS - URGENT

    I´m having trouble with FormsCentral.
    My form is running about 8 months with no problems.
    Yesterday people started to complain that the system doesn´t accept any date.
    That means the date field restricts date entries, from date dd/mm/aaaa (brazilian format) to another dd/mm/aaaa, but every date that users input in, is considered by the system as invalid, even it´s a correct and valid date right between the interval specified!
    I need Help Urgent!!!
    I depend on these forms to finish the payrol service from here.
    Thanks
    I´ll be waiting.
    Maurício Galletti
    Message was edited by: SNOWMAUSS
    It look like the system accepts just dates starting from the date of today.
    I´m testing.
    Please help.
    Thanks
    Message was edited by: SNOWMAUSS
    It looks like the system have some problem just with the date 20/10/2013?!
    I´ve fixed the problem change the interval from 20/10/2013 to another date  and used  21/10/2013 to another date and it works!
    But I think something is wrong with the 20/10/2013 date?!
    To reproduce the erros just create a new form with date feature with this exaclty configurations and the bug appears:
    I´ll keep waiting
    Message was edited by: SNOWMAUSS

    Hi
    I´ve concluded that the problem persist if the date interval starts at the
    specific date "20/10/2013". Don´t know why?!
    Look at the screen capture above, you aks for
    Thanks a lot
    image: Imagem inline 1
    Maurício P. Galletti
    Contador
    [email protected]
    ( 55 11 3331-5567
    www.cadt.com.br
    2013/10/29 Genevieve Laroche <[email protected]>
       Re: DATE FIELD PROBLEMS - URGENT  created by Genevieve Laroche<http://forums.adobe.com/people/Genevieve+Laroche>in
    FormsCentral - View the full discussion<http://forums.adobe.com/message/5797083#5797083

  • Problem with BAPI_SALESORDER_CHANGE function module

    I know lot of posts have been done about problems with this function module. However I was not able to find the answer to my problem. Hence posting a new thread
    I have the following code which changes the reason rejection (if required to 'ZF') and also updates the sales order quantity.
    The code works absolutely fine as long as the PGI date of the order item is either today or in the future. However if the PGI date of the order item is in the past. I get an error in the t_return table with error type 'E' saying 'PGI date is in the past hence could not update the item'.
    If I try to update the same order quantity in VA02 for the item with PGI date in the past it does so without any problem.
    Can someone please suggest what the problem might be. Or if there is some other way I can update the quantity. (I dont want to use BDC)
    FORM change_sales_order_item USING value(r_rtb_posnrs) TYPE zpsd_ztsdrtb_ro_track
                                 CHANGING r_return TYPE type_t_bapiret2.
      DATA: v_order_header_in TYPE bapisdh1,
      v_order_header_inx TYPE bapisdh1x,
      t_schedule_lines TYPE bapischdl OCCURS 0 WITH HEADER LINE,
      t_schedule_linesx TYPE bapischdlx OCCURS 0 WITH HEADER LINE,
      v_temp_rtb_vbeln TYPE vbeln,
      v_temp_rtb_posnr TYPE posnr,
      wa_old_rtb_posnrs TYPE ztsdrtb_ro_track,
      t_item_in TYPE bapisditm OCCURS 0 WITH HEADER LINE,
      t_item_inx TYPE bapisditmx OCCURS 0 WITH HEADER LINE,
      v_rtb_old_vbeln TYPE zrtbvbeln,
      v_rtb_old_posnr TYPE zrtbposnr,
      v_ro_old_vbeln TYPE zrovbeln,
      v_ro_old_posnr TYPE zroposnr,
      v_rtb_count TYPE i,
      v_next_row_index TYPE i,
      v_update_order_flg TYPE char1, "Update the sales order flag
      v_rtb_record_counter TYPE i,
      v_original_vbeln TYPE vbeln,
      t_bapiret TYPE STANDARD TABLE OF bapiret2.
      FIELD-SYMBOLS: <wa_r_rtb_posnrs> TYPE ztsdrtb_ro_track,
                     <wa_r_rtb_posnr_next> TYPE ztsdrtb_ro_track.
      CONSTANTS: c_updateflag TYPE bapisditmx-updateflag VALUE 'U'.
      v_order_header_inx-updateflag = 'U'.
    Get rid of the duplicate records for the same RTB order. Just use
    the last record quantity in the internal table
      LOOP AT r_rtb_posnrs ASSIGNING <wa_r_rtb_posnrs>.
        v_rtb_record_counter = v_rtb_record_counter + 1.
        <wa_r_rtb_posnrs>-seqnr = v_rtb_record_counter.
      ENDLOOP.
      SORT r_rtb_posnrs DESCENDING BY zrtbvbeln zrtbposnr seqnr zrtbconsumedflg.
      DELETE ADJACENT DUPLICATES FROM r_rtb_posnrs COMPARING zrtbvbeln zrtbposnr.
      DESCRIBE TABLE r_rtb_posnrs LINES v_rtb_count.
      v_rtb_record_counter = 0.
      v_update_order_flg = space.
      LOOP AT r_rtb_posnrs ASSIGNING <wa_r_rtb_posnrs>.
        v_rtb_record_counter = v_rtb_record_counter + 1.
        v_update_order_flg = space.
    Popluate the item quantity update flags for schedule lines
        t_schedule_linesx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
        t_schedule_linesx-sched_line = '0001'.
        t_schedule_linesx-updateflag = c_updateflag.
        t_schedule_linesx-req_qty = 'X'.
        APPEND t_schedule_linesx.
        CLEAR t_schedule_linesx.
    *Item (Order QQuantity Field to be changed "KWMENG")
        t_schedule_lines-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
        t_schedule_lines-sched_line = '0001'.
        t_schedule_lines-req_qty = <wa_r_rtb_posnrs>-zrtbchgqty.
        APPEND t_schedule_lines.
        CLEAR t_schedule_lines.
    If fully consumed then set the rejection flag
        IF <wa_r_rtb_posnrs>-zrtbconsumedflg = 'X'.
          t_item_inx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
          t_item_inx-updateflag = 'X'.
          t_item_inx-reason_rej = 'X'.
          APPEND t_item_inx.
          CLEAR t_item_inx.
          t_item_in-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
          t_item_in-reason_rej = 'ZF'.
          APPEND t_item_in.
          CLEAR t_item_in.
        ELSE.
          t_item_inx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
          t_item_inx-updateflag = 'X'.
          t_item_inx-reason_rej = 'X'.
          APPEND t_item_inx.
          CLEAR t_item_inx.
          t_item_in-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
          t_item_in-reason_rej = ' '.
          APPEND t_item_in.
          CLEAR t_item_in.
        ENDIF.
    If you have reached the last line of the RTB intern table update the sales order
    *Index pointing to the next row
        v_next_row_index = v_rtb_record_counter + 1.
        IF v_rtb_record_counter = v_rtb_count.
          v_update_order_flg = 'X'.
        ELSEIF v_rtb_record_counter < v_rtb_count.
    Get the next row data
          READ TABLE r_rtb_posnrs INDEX v_next_row_index ASSIGNING <wa_r_rtb_posnr_next>.
          IF sy-subrc = 0.
            IF <wa_r_rtb_posnrs>-zrtbvbeln <> <wa_r_rtb_posnr_next>-zrtbvbeln.
              v_update_order_flg = 'X'.
            ENDIF.
          ENDIF.
        ELSE.
          v_update_order_flg = space.
        ENDIF.
    update the rtb orders with quantities and the rejection flag (if required)
        IF v_update_order_flg = 'X'.
          CALL FUNCTION 'BAPI_SALESORDER_CHANGE' STARTING NEW TASK 'SOUPDATE'
            PERFORMING callbk_bapi_salesorder_change ON END OF TASK
            EXPORTING
              salesdocument    = <wa_r_rtb_posnrs>-zrtbvbeln
              order_header_in  = v_order_header_in
              order_header_inx = v_order_header_inx
            TABLES
              return           = t_return
              schedule_lines   = t_schedule_lines
              schedule_linesx  = t_schedule_linesx
              order_item_in    = t_item_in
              order_item_inx   = t_item_inx.
          WAIT UNTIL t_return[] IS NOT INITIAL.
          READ TABLE t_return INTO wa_return WITH KEY type = 'E'.
          IF sy-subrc <> 0.
          ELSE.
            r_return[] = t_return[].
            MESSAGE ID 'ZSD' TYPE 'E' NUMBER 613.
           RAISE errorinorderupdate.
          ENDIF.
          REFRESH t_schedule_linesx.
          REFRESH t_schedule_lines.
          REFRESH t_item_in.
          REFRESH t_item_inx.
          REFRESH t_return.
        ENDIF.
      ENDLOOP.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
       IMPORTING
         return = t_bapiret.
    ENDFORM.                    "Change_Sales_Order

    see the following example and try to do this:
    i_hdrx-updateflag = 'U'.
    *" Fill required SCHEDULE_LINES data.
    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.

  • Problem with externalURL function over sandboxbridge

    I have a simple application that I am running , I have run items through the sandbox bridge without any issue until I try to run the openExternalURL command, that one will not run, I am posting my client and the page here in hopes that someone might have come across this and have a fix for it , I am pretty sure that the fix is simple and that I am probably overlooking something small with this one LOL .
    If I call any of the other functions they work like a charm but if I call openExternalURL , it won't work so I am pretty sure the problem is the function openExternalURL
    Any ideas would be helpfull
    -R
    **************AIR CLIENT*********************************************************************
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script src="AIRAliases.js"></script>
    <script language="javascript">
    function openExternalURL(href) {
    var request = new air.URLRequest(href);
    try {           
    air.navigateToURL(request);
    catch (e) {
    function testFunction(T){
    alert(T);
    function getUrlVars(){
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    hash = hashes[i].split('=');
    vars.push(hash[0]);
    vars[hash[0]] = hash[1];
    return vars;
    function noLogin(){
    alert('Your login information was incorrect, please try again');
    top.location.href="login.html";
    var Exposed = new Object();
    Exposed.openExternalURL = openExternalURL;
    Exposed.getUrlVars = getUrlVars;
    Exposed.noLogin = noLogin;
    Exposed.testFunction = testFunction;
    function doLoad() {
    var frame = document.getElementById('viperframe').contentWindow.parentSandboxBridge = Exposed;
    setIframeHeight('viperframe');
            </script>
    </head>
    <body onload="doLoad();" onresize="setIframeHeight('viperframe');" onfocus="setIframeHeight('viperframe');" bgcolor="#222222">
    <iframe src="processlogin.html" id="viperframe" name="viperframe" frameborder="0" scrolling="no" width="100%"></iframe>
    </body>
    </html>
    ********************************END AIR CLIENT*********************************************
    *******************************PAGE CALLING FUNCTION**********************************
    <script language="javascript">
         parentSandboxBridge.openExternalURL('http://www.google.com')
    </script>
    ****************************END PAGE CALLING FUNCTION********************************

    Hi
    Could not find exact FM for your requirement but I have one logic which I also used for similar rquirement
    Table MCHB contain the batch and 'clabs' is the field for quantity,
    Just write your own logic and get the desired result.
    Hope this helps.
    Regards
    Bikas

  • Product ID is not getting updated in SC Goods /Service field

    Hi Gurus,
    While creating shopping carts in EBP, we are able to find the Product ID from the Good/Service find option, but when we select the Product ID in the search, it's not getting updated in the SC Goods/Service field.Also when we try to find the Cost center / WBS using find button it's not going to the search area after software upgrade.
    Could you please suggest us why system is behaving like this.
    Thanks
    Sada

    Hi Gurus,
    Any Idea on this.
    Also few of the Product ID's are getting updated from the search help to Goods /Service field of the SC and some are not getting updated. while debug the SC , we are geeting the error message as BBP_SC006, Its relavant to catlog. But we are not transfering the Product from catlog to SC item.
    The error mesage as: Good/Service & does not exist.
    Thanks & regards
    Sada

  • Service PO creation Using BAPI_PO_CREATE1

    Hi Friends,
    Can any body tell me how to create a service PO based on the existing service Agreement by using BAPI_PO_CREATE1 with sample code.
    Thanks,
    Kamlesh

    Hi Friends,
    Can any body tell me how to create a service PO based on the existing service Agreement by using BAPI_PO_CREATE1 with sample code.
    Thanks,
    Kamlesh

  • I updated to ios 5.1.1 and added icloud services. the problem is now whenever i connect my iphone to my PC, itunes does not recognize my phone. i need it to but it just does not connect..

    i updated to ios 5.1.1 and added icloud services. the problem is now whenever i connect my iphone to my PC, itunes does not recognize my phone. i need it to but it just does not connect..

    Try the standard fixes to rule out a software problem:
    - Reset. Nothing is lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Restore from backup
    - Restore to factory defaults/new iPod.
    If you still have the problem that points to a hardware problem. Yu can make an appointment at the the Genius Bar of an Apple store or try:
    fix for Home button

  • Web service invocation problem on host hostname and port 8000 protocol : http logical port name : LP_WS_SMDAGENT_MONITORING

    hello colleagues,
    In the phase Connect Diagnostics dont show the Agent available in SLD, but when go to SLD i have the agents,
    Error,
    Connect Diagnostics Agent
    The table does not contain any data
    Agent availables in all SLD
    SOAP:1.007 SRT: Unupported xstream found: ("HTTP Code 401 : Unauthorized")
    Web service invocation problem on host hostname and port 8000 protocol : http logical port name : LP_WS_SMDAGENT_MONITORING
    Thanks

    OK, then pls follow below steps;
    - Go to step 'Create Users' in solman_setup System Preparation scenario and make sure the user SM_INTERN_WS has a green status. Use the 'Test Login' button to make sure the user is not locked and has correct credentials maintained in solman_setup
    - Immediately after checking the user status, navigate to Configure Connectivity->Enable Web Services and execute again the 'Create Logical Ports' automatic activity, in order to propagate the correct credentials to the Logical Port definitions.
    - If the above operation is not successful, repeat the two steps above, providing a different user Id in 'Create Users' step, eg SM_INTERN_W1. This will prevent situations where the user gets locked by Logical Ports using an obsolete password.
    Let me know the results.
    Regards,
    Vivek

  • Error thread java : problem with the function "resume 0x***"  (forum sun)

    One problem with the function of jdb occured when I tried to use it to
    pilot the processor with differents threads. In fact, I use a simple example with 2 threads.
    I stop the two threads with two breakpoint, and I want to resume one or the other (with the function "resume 0x****"), the one wich I resumed stop again on the breackpoint and I decide again to resume one or the other. All of that to obtain a tree of execution.
    I give you the code of the class and the code of jdb.
    CLASS: (it's just a object Room with a variable degre that I increment and decrement with two threads increase and decrease)
    public class Test{
         public static void main(String[] args){
              Room r = new Room();
              decrease de = new decrease(r);
              increase in = new increase(r);
              de.start();
              in.start();
    class Room {
         private volatile int degre=20;
         public void more(){
         degre += 4;
         public void less(){      
         degre -= 3;
    class decrease extends Thread{
    private Room room;
    public decrease(Room r){
              room =r;
    public void run(){
    try{ 
         while (!interrupted()){ 
              room.less();
    catch(InterruptedException e) {}
    class increase extends Thread{
    private Room room;
    public increase(Room r){
         room =r;
    public void run(){ 
         try{ 
              while (!interrupted()){
                   room.more();
    catch(InterruptedException e) {}
    JDB:
    Initializing jdb ...
    stop at Test:7Deferring breakpoint Test:7.
    It will be set after the class is loaded.
    runrun Test
    Set uncaught java.lang.Throwable
    Set deferred uncaught java.lang.Throwable
    >
    VM Started: Set deferred breakpoint Test:7
    Breakpoint hit: "thread=main", Test.main(), line=7 bci=30
    7 in.start();
    main[1] stop at room:16
    Set breakpoint room:16
    main[1] stop at room:20
    Set breakpoint room:20
    main[1] resume
    All threads resumed.
    >
    Breakpoint hit: "thread=Thread-0", room.less(), line=20 bci=0
    20 degre -= 3;
    Thread-0[1] threads
    Group system:
    (java.lang.ref.Reference$ReferenceHandler)0x10d Reference Handler cond. waiting
    (java.lang.ref.Finalizer$FinalizerThread)0x10c Finalizer cond. waiting
    (java.lang.Thread)0x10b Signal Dispatcher running
    Group main:
    (decrease)0x146 Thread-0 running (at breakpoint)
    (increase)0x147 Thread-1 running (at breakpoint)
    (java.lang.Thread)0x148 DestroyJavaVM running
    Thread-0[1] resume 0x147
    Thread-0[1]
    Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
    16 degre += 4;
    Thread-1[1] resume 0x147
    Thread-1[1]
    Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
    16 degre += 4;
    Thread-1[1] print degre
    degre = 24
    Thread-1[1] resume 0x146 //It's here the problem, thread 0x146 have to stop on the //next breakpoint of decrease but nothing happen
    Thread-1[1] resume 0x147
    Thread-1[1]
    Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
    16 degre += 4;
    Thread-1[1] clear
    Breakpoints set:
    breakpoint Test:7
    breakpoint room:16
    breakpoint room:20
    PS: I tried many other examples with other class and other kind of breakpoints, but, in any cases, on thread doesn't manage to resume. When I try with general resume (no specification of the thread), It works but it isn't interresting for me because I want to decide wich thread continue his execution.

    Hi,
    I have read the FAQ of the JMF.
    The problem was the jar files of the JMF were not in the JRE\BIN\EXT
    folder of the Java runtime!
    now it works!
    thanks
    Reg

Maybe you are looking for