Bapi purchase oder problem

While creating PO i am getting following three error, i am using bapi_create_po1 for me21n  , TRPO
1. No instance of object type PurchaseOrder has been created. External reference:
2. Purchase order still contains faulty items
3. Unknown account assignment not defined for use here
Please help
Ankesh

This is my Complete code below , waiting 4 ur reply
*& Report  ZPURCHASE_ORDER_BAPI
REPORT  ZPURCHASE_ORDER_BAPI.
DATA PO_HEADER TYPE BAPIMEPOHEADER.
DATA POHEADERX TYPE BAPIMEPOHEADERX.
DATA PO_ITEM TYPE  BAPIMEPOITEM OCCURS 0 WITH HEADER LINE. " ITEM LEVEL
DATA POITEMX TYPE BAPIMEPOITEMX OCCURS 0 WITH HEADER LINE. " ITEM LEVEL
DATA PO_LIMITS TYPE BAPIESUHC OCCURS 0 WITH HEADER LINE.  " LIMIT DATA
DATA PO_SERVICES TYPE BAPIESLLC OCCURS 0 WITH HEADER LINE. " TAX DATA
DATA POSCHEDULE TYPE BAPIMEPOSCHEDULE OCCURS 0 WITH HEADER LINE . " DELIVERY SCDHULE DATA
DATA POSCHEDULEX TYPE BAPIMEPOSCHEDULX OCCURS 0 WITH HEADER LINE . " DELIVERY SCDHULE DATA
DATA SALESDOCUMENT TYPE BAPIMEPOHEADER-PO_NUMBER.
DATA PO_ITEM_ACCOUNT_ASSIGNMENT     TYPE     BAPIEKKN OCCURS 0 WITH HEADER LINE.
DATA POACCOUNT     LIKE     BAPIMEPOACCOUNT OCCURS 0 WITH HEADER LINE.
DATA POACCOUNTX     LIKE     BAPIMEPOACCOUNTX OCCURS 0 WITH HEADER LINE.
DATA V_MESSAGE TYPE STRING.
DATA : RETURN LIKE BAPIRET2  OCCURS 0 WITH HEADER LINE.
********MESSAGE RELATED DATA
DATA: GD_CURRENTROW TYPE I.
DATA : PURCHASEORDER LIKE EKKO-EBELN.
DATA: TOT_REC TYPE I,     "Total Records
     GD_UPDATE TYPE I,   "Main Table Increement Counter
     GD_LINES TYPE I,    "Success Table increement Counter
     W_TEXTOUT LIKE T100-TEXT. "VARIABLE TO GET ERRORLOG
DATA : BEGIN OF IT_SUCCESS OCCURS 0,
        SALESDOCUMENT LIKE BAPIVBELN-VBELN,  "PROJECT
      END OF IT_SUCCESS.
DATA V_TEXT TYPE CHAR33.
DATA : BEGIN OF IT_ERROR OCCURS 0,
        SRNO(4),
        ERR_MSG(73) TYPE C,    "TO RETREIVE ERROR MESSAGES
     END OF IT_ERROR.
DATA : SRNO(4).
****HEADER DATA.
PO_HEADER-CREAT_DATE  = SY-DATUM.
PO_HEADER-DOC_DATE    = SY-DATUM.
PO_HEADER-DOC_TYPE    = 'TRPO'.
*po_header-DOC_CAT =
PO_HEADER-COMP_CODE   = '1000'.
PO_HEADER-PURCH_ORG   = '1000'.
PO_HEADER-PUR_GROUP   = '402'.
PO_HEADER-VENDOR      = 'A000010'. "'JR00006'.
PO_HEADER-CURRENCY    = 'INR'.
PO_HEADER-VPER_START  = '20081001'.
PO_HEADER-VPER_END    = '20081030'.
PO_HEADER-LANGU       = 'E'.
****another header FOR INTERFACE
POHEADERX-CREAT_DATE = SY-DATUM.
POHEADERX-DOC_DATE   =  'X'.
POHEADERX-DOC_TYPE   =  'X'.
POHEADERX-COMP_CODE  = 'X'.
POHEADERX-PURCH_ORG  =  'X'.
POHEADERX-PUR_GROUP  =  'X'.
POHEADERX-VENDOR     =  'X'.
POHEADERX-CURRENCY   =  'X'.
POHEADERX-VPER_START =  'X'.
POHEADERX-VPER_END   = 'X'.
PO_HEADER-LANGU      = 'X'.
****ITEM LEVEL DETAILS
PO_ITEM-PO_ITEM     = '00010'.
PO_ITEM-ACCTASSCAT  = 'D'.
PO_ITEM-ITEM_CAT    = 'D'.
PO_ITEM-SHORT_TEXT  = 'CEMENT'.     " SHORT TEXT
PO_ITEM-MATL_GROUP  = '101001'.     " MAT GRP
PO_ITEM-PLANT       = '1100'.     " PLANT
PO_ITEM-STGE_LOC    =  'FG01'.   " STORAGE LOCATION
PO_ITEM-TRACKINGNO  = '41'.  " DEPARTMENT CODE
PO_ITEM-QUANTITY   = '1.00'.
PO_ITEM-PO_UNIT    = 'AU'.
PO_ITEM-PREQ_NAME  = 'Abc@xyz'.
PO_ITEM-NET_PRICE  = '1000'.
APPEND PO_ITEM.
*** ITEM LEVEL DETAIL FOR INTERFACE
POITEMX-PO_ITEM     = '00010'.
POITEMX-ACCTASSCAT  = 'X'.
PO_ITEM-ITEM_CAT    = 'X'.
POITEMX-SHORT_TEXT  = 'X'.     " SHORT TEXT
POITEMX-MATL_GROUP  = 'X'.     " MAT GRP
POITEMX-PLANT       = 'X'.     " PLANT
POITEMX-STGE_LOC    =  'X'.   " STORAGE LOCATION
POITEMX-TRACKINGNO  = 'X'.  " DEPARTMENT CODE
POITEMX-QUANTITY    = 'X'.
POITEMX-PO_UNIT     = 'X'.
POITEMX-PREQ_NAME   = 'X'.
POITEMX-NET_PRICE   = 'X'.
APPEND POITEMX.
******LIMIT DATA
PO_LIMITS-LIMIT  =  '1000'.
PO_LIMITS-EXP_VALUE = '1000'.
APPEND PO_LIMITS.
*****TAX DATA
PO_SERVICES-TAX_CODE = 'JA'.
APPEND PO_SERVICES.
****DELIVERY SCDDULE DATA.
POSCHEDULE-PO_ITEM        = '00010'.
POSCHEDULE-SCHED_LINE     = '0001'.
POSCHEDULE-DEL_DATCAT_EXT =  'M'.
POSCHEDULE-DELIVERY_DATE  = '102008'.
POSCHEDULE-STAT_DATE      = '20081030'.
APPEND POSCHEDULE.
****FOR INTERFACE DELIVERY DATA
POSCHEDULEX-PO_ITEM        = '00010'.
POSCHEDULEX-SCHED_LINE     = '0001'.
POSCHEDULEX-DEL_DATCAT_EXT =  'X'.
POSCHEDULEX-DELIVERY_DATE  = 'X'.
POSCHEDULEX-STAT_DATE      = 'X'.
APPEND POSCHEDULEX .
*********PO ACCOUNT ASSIGNMENT.
*POACCOUNT-PO_ITEM    = '00010'.
*POACCOUNT-SERIAL_NO  = '01'.
*POACCOUNT-CREAT_DATE = SY-DATUM.
*POACCOUNT-GL_ACCOUNT = '0000400000'.
*POACCOUNT-COSTCENTER = '0000001000' .
*APPEND POACCOUNT .
*POACCOUNTX-PO_ITEM    = '00010'.
*POACCOUNTX-SERIAL_NO  = '01'.
*POACCOUNTX-CREAT_DATE = 'X'.
*POACCOUNTX-GL_ACCOUNT = 'X'.
*POACCOUNTX-CO_AREA    = 'X'.
*POACCOUNT-COSTCENTER  = 'X' .
*APPEND POACCOUNTX.
CALL FUNCTION 'BAPI_PO_CREATE1'
  EXPORTING
   POHEADER                     = PO_HEADER
   POHEADERX                    = POHEADERX
*   POADDRVENDOR                 =
*   TESTRUN                      =
*   MEMORY_UNCOMPLETE            =
*   MEMORY_COMPLETE              =
*   POEXPIMPHEADER               =
*   POEXPIMPHEADERX              =
*   VERSIONS                     =
*   NO_MESSAGING                 =
*   NO_MESSAGE_REQ               =
*   NO_AUTHORITY                 =
*   NO_PRICE_FROM_PO             =
IMPORTING
   EXPPURCHASEORDER             = SALESDOCUMENT
*   EXPHEADER                    =
*   EXPPOEXPIMPHEADER            =
TABLES
   RETURN                       =  RETURN
   POITEM                       = PO_ITEM
   POITEMX                      = POITEMX
*   POADDRDELIVERY               =
   POSCHEDULE                   = POSCHEDULE
   POSCHEDULEX                  = POSCHEDULEX
   POACCOUNT                    =  POACCOUNT
*   POACCOUNTPROFITSEGMENT       =
   POACCOUNTX                   =  POACCOUNTX
*   POCONDHEADER                 =
*   POCONDHEADERX                =
*   POCOND                       =
*   POCONDX                      =
   POLIMITS                     = PO_LIMITS
*   POCONTRACTLIMITS             =
   POSERVICES                   = PO_SERVICES
*   POSRVACCESSVALUES            =
*   POSERVICESTEXT               =
*   EXTENSIONIN                  =
*   EXTENSIONOUT                 =
*   POEXPIMPITEM                 =
*   POEXPIMPITEMX                =
*   POTEXTHEADER                 =
*   POTEXTITEM                   =
*   ALLVERSIONS                  =
*   POPARTNER                    =
*   POCOMPONENTS                 =
*   POCOMPONENTSX                =
*   POSHIPPING                   =
*   POSHIPPINGX                  =
*   POSHIPPINGEXP                =
*CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
* IMPORTING
*   RETURN        =
IF SALESDOCUMENT <> SPACE.
  COMMIT WORK.
  ADD 1 TO GD_UPDATE.
  IT_SUCCESS-SALESDOCUMENT = SALESDOCUMENT.
  APPEND IT_SUCCESS.
  CLEAR :SALESDOCUMENT,PO_HEADER.
*        REFRESH : RETURN,ORDER_ITEMS_IN,ORDER_PARTNERS.
ELSE.
  LOOP AT RETURN.
*          IT_ERROR-SRNO = TAB-SRNO.
    IT_ERROR-ERR_MSG = RETURN-MESSAGE .
    APPEND IT_ERROR.
  ENDLOOP.
  CLEAR :SALESDOCUMENT,PO_HEADER.
*        REFRESH : RETURN,ORDER_ITEMS_IN,ORDER_PARTNERS.
ENDIF.
DESCRIBE TABLE IT_SUCCESS LINES GD_LINES.
IF GD_LINES GT 0.
*     Display result report column headings
  PERFORM DISPLAY_COLUMN_HEADINGS.
  PERFORM DISPLAY_SUCESS.
ENDIF.
* IF SUCESS FAILS Display Error Report
DESCRIBE TABLE IT_ERROR LINES GD_LINES.
IF GD_LINES GT 0.
  PERFORM ERRORHEADINGS.
  PERFORM ERRORREPORT.
ENDIF.
*&      Form  DISPLAY_COLUMN_HEADINGS
*       text
*  -->  p1        text
*  <--  p2        text
FORM DISPLAY_COLUMN_HEADINGS .
  WRITE:2 ' Success Report '(014) COLOR COL_POSITIVE.
  SKIP.
  WRITE:2 'The following records inserted successfully:'(013).
  WRITE:/ SY-ULINE(15).
  FORMAT COLOR COL_HEADING.
  WRITE:/      SY-VLINE,
           (10) 'Sales order'(004), SY-VLINE.
  WRITE:/ SY-ULINE(15).
  "display_column_headings
ENDFORM.                    " DISPLAY_COLUMN_HEADINGS
*&      Form  DISPLAY_SUCESS
*       text
*  -->  p1        text
*  <--  p2        text
FORM DISPLAY_SUCESS .
  FORMAT COLOR COL_NORMAL.
  LOOP AT IT_SUCCESS.
    WRITE:/      SY-VLINE,
        (10)  IT_SUCCESS-SALESDOCUMENT, SY-VLINE.
    CLEAR IT_SUCCESS.
  ENDLOOP.
  WRITE:/ SY-ULINE(15).
  REFRESH: IT_SUCCESS.
  FORMAT COLOR COL_BACKGROUND.
ENDFORM.                    " DISPLAY_SUCESS
*&      Form  ERRORHEADINGS
*       text
*  -->  p1        text
*  <--  p2        text
FORM ERRORHEADINGS .
  SKIP.
  WRITE:2 ' Error Report '(007) COLOR COL_NEGATIVE.
  SKIP.
  WRITE:2 'The following records failed during update:'(008).
  WRITE:/ SY-ULINE(104).
  FORMAT COLOR COL_HEADING.
  WRITE:/      SY-VLINE,
          (10) 'ERROR.'(009), SY-VLINE.
  WRITE:/ SY-ULINE(104).
  FORMAT COLOR COL_NORMAL.
ENDFORM.                    " ERRORHEADINGS
*&      Form  ERRORREPORT
*       text
*  -->  p1        text
*  <--  p2        text
FORM ERRORREPORT .
  LOOP AT IT_ERROR.
    WRITE:/      SY-VLINE,
            (10) IT_ERROR-SRNO, SY-VLINE,
             (40) IT_ERROR-ERR_MSG, SY-VLINE.
  ENDLOOP.
  WRITE:/ SY-ULINE(104).
  REFRESH: IT_ERROR.

Similar Messages

  • How to upload Purchase oder text through BDC. or BAPI

    Hi...
       I wish to know how to upload purchase oder text wich is in MM01 t-code and has a screen number 4040 and program name SAPLMGMM, i want to migrate a material master data to another client by this fields, Basic, Purchasing, Purchase oder text ( long text), general plant date/storage1 and accounting. for that i am suspicious about uploading a purchase oder text with bdc...if i am true how i can have this by bapi or another means...please help me
    ...thaking you....

    Hi,
    Use FM - BAPI_PO_CREATE1
    It will fetch both HEADER and ITEM text.
    This module is used to create a PO and as u r involved in a data migration, I can suggest to use this one.
    Hope It'll help.
    Thanks & Regards,
    Ankur

  • Bapi purchase order

    Hy Gurus,
    Are there a Bapi with input the purchase order number and output the purchase order open quantity and delivery date?
    Thanks.
    Josy

    Hi
    Use this bapi BAPI_PO_CREATE1 it has those fields you want..
    thanks
    Edited by: Sharada.Dhulipala on Oct 12, 2011 4:33 PM

  • Open purchase orders problem

    Hi all,
    I want to close all open purchase order . MEMASSPO transaction doesnt allow me to close partial open POS ie PO is of 10 QTY & I received 5 qty .Remaining  5 QTY. there are around 1000 PO's are like that .
    Going  into me22 & delivery completed tick, I can do it manually .but its very hectic due to large no of PO's. Can I write a BDC for that ? I have a doubt whether that BDC will work properly or not because In each PO line Item Nos are different. which item is received completly & which not this is also to be considered.
    Plz reply .
    Thanks in Advance.
    Atul

    Hi,
    you can uses BAPIs instead of BDC. You can get details of PO from BAPI BAPI_PO_GETDETAIL1 and then change it using BAPI_PO_CHANGE. Both BAPIs have table POITEM with field NO_MORE_GR. This field corresponds to your flag. So you can easily see which items has not this flag set and then easily set this flag.
    Cheers

  • Sales order -  automatic creation of purchase order - problem on Credit Che

    Hello,
    We have a problem in sales order.
    For one item, we have an automatic creation of Purchase requisation, but we have to give manually the price in the purchase requisition.
    The problem is when we have give the price, the automatic credit check is executed, and the purchase requisition is not created if we block on this credit check.
    When the credit controller, released the Sales order (VKM1), the purchase is not created automatically because the field for the price in purchase requisition is empty and required.
    And when we come back to the sales order, we need to fill the value and the credit check is running a new time. .....
    and we have a loop.
    I have check in OSS Notes, and I not find a solution.
    How can we solve this problem
    Regards
    Jean-Claude Onderbeke

    Hello Buddi,
    It's impossible to change the price in PO, because the PO is not created.
    The problem is on the creation on the PR in the Sales Order.
    I'm not able to create the Purchase Requisition due to Credit Check, and I'm not able to make an automatic credit check because the value price in the PR is not filled automaticaly, and it's required.
    It's a loop known by SAP, but not solve.
    I hope that someone has found a solution to this strange behaviour.
    Regards
    Jean-Claude

  • Purchase Order Problem

    HI Experts,
      I have copied a purchase order form ZMEDRUCK from Medruck.  Modified according to the requirements of functional consultant without deleting a single element.  I have commented everything in the windows except /E - element lines.  Used subroutines to fetch some data and displayed.  Its working normally, but when enduser is trying to generate a PO with some JPY currency, it is not giving print preview nor print. 
    In the subroutine pool for calculating grand total I have used the following code.
    FORM freight TABLES   TA_INPUT STRUCTURE ITCSY
                            TA_OUTPUT STRUCTURE ITCSY.      "Structure
      DATA: TP_FREIGHT LIKE KONV-KAWRT,  " freight charges
            TP_CUSTOMS LIKE KONV-KAWRT,  " customs charges
            TP_EBELN   LIKE EKKO-EBELN,  " PO number
            TP_KNUMV   LIKE EKKO-KNUMV,  " document condition number
            TP_GTOTAL  TYPE P DECIMALS 2,  " grand total
            TP_TOTAL   LIKE KONV-KAWRT. " like konv-kawrt  " total before freight and customs.
      DATA: lv_grandtot(16),             " TYPE P DECIMALS 2,
                                       " lv_grandtot type konv-kawrt,
            tp_total1(16),
            tp_waers like ekko-waers.
      DATA : IT_KONV LIKE KONV OCCURS 0 WITH HEADER LINE. " for condition values.
      read table TA_INPUT with key 'EKKO-EBELN'.
      TP_EBELN = TA_INPUT-VALUE.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          INPUT  = TP_EBELN
        IMPORTING
          OUTPUT = TP_EBELN.
      READ TABLE TA_INPUT WITH KEY 'KOMK-FKWRT'.
    **without this function module, getting short dump while adding for grand total.
    **CONDENSE TA_INPUT-VALUE.
    *MOVE TA_INPUT-VALUE TO TP_TOTAL.
      CALL FUNCTION 'CATS_ITS_MAKE_STRING_NUMERICAL'
        EXPORTING
          INPUT_STRING  = TA_INPUT-VALUE
        IMPORTING
          VALUE         = TP_TOTAL
        EXCEPTIONS
          NOT_NUMERICAL = 1
          OTHERS        = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    READ TABLE TA_INPUT WITH KEY 'EKKO-WAERS'.
    tp_waers = ta_input-value.
    if tp_waers = 'JPY'.
    tp_total = tp_total * 10.
    endif.
    WRITE: TP_TOTAL TO TP_TOTAL1 CURRENCY 'JPY' LEFT-JUSTIFIED.
      SELECT SINGLE KNUMV FROM EKKO INTO TP_KNUMV WHERE EBELN = tp_ebeln.
      SELECT * FROM KONV INTO TABLE IT_KONV WHERE KNUMV = TP_KNUMV
                                          AND KSCHL IN ('FRB1' , 'ZOB1').
    *BREAK-POINT.
      LOOP AT IT_KONV.
        CASE IT_KONV-KSCHL.
          WHEN 'FRB1'.
            TP_FREIGHT = TP_FREIGHT + IT_KONV-KBETR.
          WHEN 'ZOB1'.
            TP_CUSTOMS = TP_CUSTOMS + IT_KONV-KBETR.
        ENDCASE.
      ENDLOOP.
    *******grand total.
    ***here if don't use function module CATS_ITS_MAKE_STRING_NUMERICAL, I get short dump.
      TP_GTOTAL = TP_TOTAL + TP_FREIGHT + TP_CUSTOMS.
    *WRITE TP_GTOTAL TO lv_grandtot CURRENCY tp_waers DECIMALS 2 LEFT-JUSTIFIED.
    WRITE TP_GTOTAL TO lv_grandtot CURRENCY tp_waers LEFT-JUSTIFIED.
    *move tp_gtotal to lv_grandtot.
      loop at TA_OUTPUT.
        case TA_OUTPUT-NAME.
          when 'TP_FREIGHT'.
            MOVE TP_FREIGHT TO TA_OUTPUT-VALUE  .
            CONDENSE TA_OUTPUT-VALUE.
            modify TA_OUTPUT.
          when 'TP_CUSTOMS'.
            MOVE TP_CUSTOMS TO TA_OUTPUT-VALUE  .
            CONDENSE TA_OUTPUT-VALUE.
            modify TA_OUTPUT.
          when 'TP_GTOTAL'.
            MOVE lv_grandtot TO TA_OUTPUT-VALUE  .
            CONDENSE TA_OUTPUT-VALUE.
            modify TA_OUTPUT.
        endcase.
      endloop.
    endform.                    "freight
    It is working well even with JPY currency, but this time when she was entering a material with JPY currency, neither preview is coming nor print.  In the status bar(in me21n) it shows error that a certain include is not available, but when I enter into script debugging mode, print preview is coming and grand total is 0, because of error in function module.  In the ABAP debugging mode, in the function module I have used, the sy-subrc is 1.  This is go-live issue and this problem has occurred in Prod server.  We could not stimulate the scene in Dev server.
    In Dev, I noticed that when ever I tick off in 'Ret PO' check box, the same problem is coming.
    Can any one help me with this problem.

    The table PO_AGENTS stores the buyers .
    To define a buyer, you need to define an employee (Purchasing super user > Setup > Personnel > Employees), then a Buyer (Purchasing super user > Setup>Personnel > Buyers)

  • Help Bapi Purchase order with reference to purchase requisition no

    Hi,
    i used BAPI_PO_CREATE1 for creating purchase order with reference to Purchase requisition number but im getting these error
    please help me to solve this
    1 E BAPI 001 No instance of object type PurchaseOrder has been created. External reference:
    2 E MEPO 001 Purchase order item 00010 still contains faulty schedule lines
    3 E 06 054 Doc. type/item cat. NB/S (requisition) <-> NB/ (purch. order)
    4 E 8W 162 No schedule line exists for schedule line number 0010000030 00010 0000.
    Thanks & Regards,
    Azhar
    Message was edited by:
            Azhar

    Hi Azar,
    I am also getting the same messages, did you get resolve the issue.

  • BAPI purchase order create (subcontracting)

    Hi,
    Is it possible to create subcomponents for PO item when it is not BOM related? I checked BAPI_PO_CREATE and CREATE1 (with ALE messages assigned) but cannot find how to use standard way to accomplish this (ver. 4.6C).
    Is there a better way to do this than batch input with ME21?
    Best regards,
    Maciej

    That's the first thing I checked...
    CREATE1 is used only once in 4.7 (idoc_input..) and not in 4.6C, there should be new interface generated.  The problem is all BAPIs interfaces have no container for subcomponents at all (only items general, schedule lines, service lines, conditions etc.).
    Note 197958 says BAPI_PO_CREATE can be used for creating subcontracting items only when BOMs exist and most probably it is the last answer to this issue;)
    Br,
    Maciej

  • Help - Error in PR BAPI :  Purchasing across company codes is not allowed..

    I have written a program to create Purchase Requisition.I am using two BAPIs.In the file i specify the old PR No, New Plant,Purch Group and Purch Org.It is actually a program to create a new PR in a new plant which is a copy of an Old PR in older plant.
    Program is below:
    I am getting the error Purchasing across company codes is not allowed..
    Please Help
    *& Report  ZMMB_BDC_ME51N_WO
    REPORT  ZMMB_BDC_ME51N_WO.
    INITIALIZATION.
    D A T A   D E C L A R A T I O N                                     *
      TYPES: BEGIN OF TY_TABDATA,
              BANFN TYPE EBAN-BANFN, " Purchase Requistion No
              WERKS TYPE MEREQ3211GRID-WERKS, "Plant
              EKGRP TYPE MEREQ3211GRID-EKGRP, "Purchasing Group
              EKORG TYPE MEREQ3211GRID-EKORG, "Purchasing Organization
             END OF TY_TABDATA.
      TYPES: BEGIN OF TY_CHECK,
                BANFN TYPE EBAN-BANFN, " Purchase Requistion No
                BNFPO TYPE EBAN-BNFPO, " Purchase Requistion Item No
                EBAKZ TYPE EBAN-EBAKZ, " PR Closed
             END OF TY_CHECK.
    Declaration of the Internal Table & Work Area.
      DATA:
             IT_TABDATA         TYPE  STANDARD  TABLE  OF   TY_TABDATA, " Internal Table for file
             WA_TABDATA         TYPE                       TY_TABDATA.
      DATA: IT_ITEM TYPE STANDARD TABLE OF BAPIEBAN ,
            WA_ITEM LIKE LINE OF IT_ITEM,
            IT_ITEM1 TYPE STANDARD TABLE OF BAPIEBANC,
            WA_ITEM1 LIKE LINE OF IT_ITEM1,
            IT_ACCOUNT TYPE STANDARD TABLE OF BAPIEBKN,
            WA_ACCOUNT LIKE LINE OF IT_ACCOUNT,
            IT_PRITEMTEXT TYPE STANDARD TABLE OF BAPIEBANTX,
            WA_PRITEMTEXT LIKE LINE OF IT_PRITEMTEXT,
            IT_SERVICES TYPE STANDARD TABLE OF BAPIESLL ,
            WA_SERVICES LIKE LINE OF IT_SERVICES,
            IT_SERVICES1 TYPE STANDARD TABLE OF BAPIESLLC ,
            WA_SERVICES1 LIKE LINE OF IT_SERVICES1,
            IT_SERVICETEXT TYPE STANDARD TABLE OF BAPIESLLTX,
            WA_SERVICETEXT LIKE LINE OF IT_SERVICETEXT,
            IT_CHECK TYPE STANDARD TABLE OF TY_CHECK,
            WA_CHECK LIKE LINE OF IT_CHECK.
       Global data Declaration
      DATA:   GV_YEAR(4)         TYPE C,
              GV_MNTH(2)         TYPE C,
              GV_DATE(2)         TYPE C,
              GV_DATUM(8)       TYPE C,
              GV_ANS TYPE C,
              W_FILENAME      TYPE  STRING.
    Declaration of the Internal Table with Header Line comprising of the uploaded data.
      DATA:  BEGIN  OF  IT_FILE_UPLOAD  OCCURS  0.
      INCLUDE  STRUCTURE  ALSMEX_TABLINE.  "  Rows for Table with Excel Data
      DATA:  END  OF  IT_FILE_UPLOAD.
    Batch Input Data for a single Transaction.
    Message of Call Transaction.
      DATA:  BDCDATA  LIKE  BDCDATA     OCCURS  0  WITH  HEADER  LINE,
             MSGTAB   LIKE  BDCMSGCOLL  OCCURS  0  WITH  HEADER  LINE.
    S E L E C T I O N - S C R E E N                                     *
      SELECTION-SCREEN:  BEGIN  OF  BLOCK  B1  WITH  FRAME TITLE TEXT-001,
                             BEGIN  OF  BLOCK  B2  WITH  FRAME TITLE TEXT-004.
      PARAMETERS: P_FNAME  LIKE  RLGRAP-FILENAME  OBLIGATORY.
      SELECTION-SCREEN:      END  OF  BLOCK  B2,
                         END  OF  BLOCK  B1.
    E V E N T : AT    S E L E C T I O N - S C R E E N                   *
    AT  SELECTION-SCREEN  ON  VALUE-REQUEST  FOR  P_FNAME.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          STATIC    = 'X'
        CHANGING
          FILE_NAME = P_FNAME.
    E V E N T : S T A R T - O F - S E L E C T I O N                     *
    START-OF-SELECTION.
    Upload Excel file into Internal Table.
      PERFORM  UPLOAD_EXCEL_FILE.
      IF  NOT  IT_FILE_UPLOAD  IS  INITIAL.
      Confirm whether you want to proceed with the Upload.
        PERFORM  CONFIRM_UPLOAD.
        IF  GV_ANS  EQ  '1'.
      Organize the uploaded data into another Internal Table.
          PERFORM  ORGANIZE_UPLOADED_DATA.
          PERFORM BAPI_CALL.
        ENDIF.
      ELSE.
        LEAVE PROGRAM.
      ENDIF.
    *&      Form  UPLOAD_EXCEL_FILE
          text
    -->  p1        text
    <--  p2        text
    FORM UPLOAD_EXCEL_FILE .
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          FILENAME                = P_FNAME
          I_BEGIN_COL             = 1
          I_BEGIN_ROW             = 4
          I_END_COL               = 4
          I_END_ROW               = 9999
        TABLES
          INTERN                  = IT_FILE_UPLOAD
        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.
    ENDFORM.                    " UPLOAD_EXCEL_FILE
    *&      Form  CONFIRM_UPLOAD
          text
    -->  p1        text
    <--  p2        text
    FORM CONFIRM_UPLOAD .
      CALL FUNCTION 'POPUP_TO_CONFIRM'
        EXPORTING
          TITLEBAR       = TEXT-002
          TEXT_QUESTION  = TEXT-003
        IMPORTING
          ANSWER         = GV_ANS
        EXCEPTIONS
          TEXT_NOT_FOUND = 1
          OTHERS         = 2.
    ENDFORM.                    " CONFIRM_UPLOAD
    *&      Form  ORGANIZE_UPLOADED_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM ORGANIZE_UPLOADED_DATA .
      DATA : GV_TOTROW TYPE I, "No of records
              GV_ROW TYPE I,
              LC_CNT(3) TYPE N.
      GV_TOTROW = 1.
      SORT  IT_FILE_UPLOAD  BY  ROW
                              COL.
      LOOP AT IT_FILE_UPLOAD.
        GV_TOTROW = IT_FILE_UPLOAD-ROW.
      ENDLOOP.
      GV_ROW = 1.
      WHILE GV_ROW <= GV_TOTROW.
        LOOP  AT  IT_FILE_UPLOAD WHERE ROW = GV_ROW.
          CASE  IT_FILE_UPLOAD-COL.
            WHEN '0001'.
              WA_TABDATA-BANFN = IT_FILE_UPLOAD-VALUE.
            WHEN '0002'.
              WA_TABDATA-WERKS = IT_FILE_UPLOAD-VALUE.
            WHEN '0003'.
              WA_TABDATA-EKGRP = IT_FILE_UPLOAD-VALUE.
            WHEN '0004'.
              WA_TABDATA-EKORG = IT_FILE_UPLOAD-VALUE.
          ENDCASE.
        ENDLOOP.
        GV_ROW = GV_ROW + 1.
        APPEND WA_TABDATA TO   IT_TABDATA .
        CLEAR :WA_TABDATA.
      ENDWHILE.
    ENDFORM.                    " ORGANIZE_UPLOADED_DATA
    *&      Form  BAPI_CALL
          text
    -->  p1        text
    <--  p2        text
    FORM BAPI_CALL .
      DATA:ITM_NO(4) TYPE N,LV_PERCENTAGE(3) TYPE N,
           LV_MSG(60),
           IT_RETURN TYPE STANDARD TABLE OF BAPIRETURN,
           WA_RETURN LIKE LINE OF IT_RETURN.
      DATA: BEGIN OF WA_RETURN1,
            BANFN TYPE EBAN-BANFN.
      INCLUDE  TYPE BAPIRETURN.
      DATA END OF WA_RETURN1.
      DATA:IT_RETURN1 LIKE STANDARD TABLE OF WA_RETURN1.
      DESCRIBE TABLE IT_TABDATA LINES ITM_NO.
      LOOP AT IT_TABDATA INTO WA_TABDATA.
        CALL FUNCTION 'BAPI_REQUISITION_GETDETAIL'
          EXPORTING
            NUMBER                               = WA_TABDATA-BANFN
           ACCOUNT_ASSIGNMENT                   = 'X'
           ITEM_TEXTS                           = 'X'
           SERVICES                             = 'X'
           SERVICE_TEXTS                        = 'X'
          TABLES
            REQUISITION_ITEMS                    = IT_ITEM
           REQUISITION_ACCOUNT_ASSIGNMENT       = IT_ACCOUNT
           REQUISITION_TEXT                     = IT_PRITEMTEXT
      REQUISITION_LIMITS                   =
      REQUISITION_CONTRACT_LIMITS          =
       REQUISITION_SERVICES                 = IT_SERVICES
       REQUISITION_SERVICES_TEXTS           = IT_SERVICETEXT
      REQUISITION_SRV_ACCASS_VALUES        =
      RETURN                               =
        COMPUTE LV_PERCENTAGE = ( ITM_NO / SY-TABIX ) * 100.
        CONCATENATE 'PROCESSING PURCHASING REQUISITION FOR OLD PR NUMBER ' WA_TABDATA-BANFN INTO LV_MSG.
        CALL FUNCTION 'RM_SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
            PERCENTAGE = LV_PERCENTAGE
            TEXT       = LV_MSG.
        CLEAR:LV_PERCENTAGE ,LV_MSG.
        IF IT_TABDATA[] IS NOT INITIAL.
          SELECT BANFN BNFPO EBAKZ FROM EBAN INTO TABLE IT_CHECK FOR ALL ENTRIES IN IT_TABDATA
              WHERE BANFN = IT_TABDATA-BANFN AND EBAKZ = 'X'.
        ENDIF.
        LOOP AT IT_CHECK INTO WA_CHECK.
          LOOP AT IT_ITEM INTO WA_ITEM WHERE PREQ_NO = WA_CHECK-BANFN AND PREQ_ITEM = WA_CHECK-BNFPO.
            DELETE IT_ITEM WHERE PREQ_NO = WA_CHECK-BANFN AND PREQ_ITEM = WA_CHECK-BNFPO.
          ENDLOOP.
          LOOP AT IT_ACCOUNT INTO WA_ACCOUNT WHERE PREQ_NO = WA_CHECK-BANFN AND PREQ_ITEM = WA_CHECK-BNFPO.
            DELETE IT_ACCOUNT WHERE PREQ_NO = WA_CHECK-BANFN AND PREQ_ITEM = WA_CHECK-BNFPO.
          ENDLOOP.
        ENDLOOP.
        LOOP AT IT_ITEM INTO WA_ITEM.
          WA_ITEM-PLANT = WA_TABDATA-WERKS.
          WA_ITEM-PUR_GROUP = WA_TABDATA-EKGRP.
          WA_ITEM-PURCH_ORG = WA_TABDATA-EKORG.
          MODIFY IT_ITEM FROM WA_ITEM TRANSPORTING PLANT PUR_GROUP PURCH_ORG.
          MOVE-CORRESPONDING WA_ITEM TO WA_ITEM1.
          WA_ITEM1-PREQ_NO = ''.
          WA_ITEM1-STORE_LOC = ''.
          APPEND WA_ITEM1 TO IT_ITEM1.
          CLEAR WA_ITEM1.
        ENDLOOP.
        LOOP AT IT_ACCOUNT INTO WA_ACCOUNT.
          WA_ACCOUNT-PREQ_NO = ''.
          MODIFY IT_ACCOUNT FROM WA_ACCOUNT TRANSPORTING PREQ_NO.
        ENDLOOP.
        LOOP AT IT_SERVICES INTO WA_SERVICES.
          MOVE-CORRESPONDING WA_SERVICES TO WA_SERVICES1.
          APPEND WA_SERVICES1 TO IT_SERVICES1.
          CLEAR WA_SERVICES1.
        ENDLOOP.
        CALL FUNCTION 'BAPI_REQUISITION_CREATE'
       EXPORTING
         SKIP_ITEMS_WITH_ERROR                =
         AUTOMATIC_SOURCE                     = 'X'
       IMPORTING
         NUMBER                               =
          TABLES
            REQUISITION_ITEMS                    = IT_ITEM1
           REQUISITION_ACCOUNT_ASSIGNMENT       = IT_ACCOUNT
           REQUISITION_ITEM_TEXT                = IT_PRITEMTEXT
         REQUISITION_LIMITS                   =
         REQUISITION_CONTRACT_LIMITS          =
          REQUISITION_SERVICES                 = IT_SERVICES1
         REQUISITION_SRV_ACCASS_VALUES        =
           RETURN                               = IT_RETURN
          REQUISITION_SERVICES_TEXT            = IT_SERVICETEXT
         REQUISITION_ADDRDELIVERY             =
         EXTENSIONIN                          =
        READ TABLE IT_RETURN INTO WA_RETURN INDEX 1.
        IF WA_RETURN-TYPE = 'E'.
          CLEAR WA_RETURN.
          LOOP AT IT_RETURN INTO WA_RETURN WHERE TYPE EQ 'E'.
            WA_RETURN1-BANFN = WA_TABDATA-BANFN.
            MOVE-CORRESPONDING WA_RETURN TO  WA_RETURN1.
            APPEND WA_RETURN1 TO IT_RETURN1.
            CLEAR WA_RETURN1.
          ENDLOOP.
        ELSE.
          WA_RETURN1-BANFN = WA_TABDATA-BANFN.
          MOVE-CORRESPONDING WA_RETURN TO  WA_RETURN1.
          APPEND WA_RETURN1 TO IT_RETURN1.
          CLEAR WA_RETURN1.
        ENDIF.
        IF SY-SUBRC <> 0.
        ENDIF.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
             WAIT          =
           IMPORTING
             RETURN        =
        REFRESH: IT_RETURN[],IT_ITEM[],IT_ACCOUNT[],IT_PRITEMTEXT[],IT_ITEM1[],IT_SERVICES[],IT_SERVICES1[],
                 IT_SERVICETEXT[].
      ENDLOOP.
      WRITE :10 'OLD PR NUMBER' COLOR COL_KEY, 25 'MESSAGE' COLOR COL_KEY.
      LOOP AT IT_RETURN1 INTO WA_RETURN1.
        WRITE:/10 WA_RETURN1-BANFN,25 WA_RETURN1-MESSAGE.
      ENDLOOP.
      CLEAR:IT_TABDATA[],WA_TABDATA.
    ENDFORM   .                 "BAPI_CALL

    Solved on Own

  • Restore Purchases feature Problem

    Hello,
    We've got the problem during apple approve process. The app is Multifolio with newsstand subscription.
    They said "We found that your app offers In-App Purchase(s) that can be restored but does not include a “Restore Purchases" feature to allow users to restore the previously purchased In-App Purchase(s), as specified in the “Restoring Purchase Products” section of the In-App Purchase Programming Guide"
    The app include subscription and it works. Even the start dialog to restore purchases presented.
    But there are no button on the right to restore purchases.
    Shared secret is ok.
    It is not the first our app. In previous apps this button presented from the beginning.
    We can't understand the reason. Please help

    And what has this to do with Adobe? If you're talking about e-pub or whatever, ask in the relevant forums.
    Mylenium

  • ITunes having purchasing processing problems? or is it me?

    Is anyone else experiencing problems with downloading albums? I am getting an error message everytime that iTunes cannot process credit card purchases at this time. Please try back later."  It's been all day!

    Welcome to the Apple Community.
    It's most likely your network.
    Intermittent problems are often a result of interference. Interference can be caused by other networks in the neighbourhood or from household electrical items.
    You can download and install iStumbler (NetStumbler for windows users) to help you see which channels are used by neighbouring networks so that you can avoid them, but iStumbler will not see household items.
    Refer to your router manual for instructions on changing your wifi channel or adjusting your multicast rate.
    There are other types of problems that can affect networks, but this is by far the most common, hence worth mentioning first.

  • Purchased music problem

    okay so here is my problem. for some reason my itunes just would not open up i kept getting the message, "itunes has encountered an error blah blah blah". i spent weeks trying to get my itunes working again. finally after several installs and uninstalls i just had to get rid of everything in my computer that had anything to do with quicktime, itunes, and ipod and wallah my itunes is back. the only problem is my whole library is gone and the only trail of my library is still on my ipod itself. i havent updated my ipod for fear of losing all of my purchased music (which i stupidly didn't back up of course). does anyone have any idea of how to get my purchased music off my ipod and into my new library. help is greatly appreciated, thanx

    thanx alot katrina that solved my problem...partially but now that i have my whole ipod including songs i purchased into my library for some reason those songs that i purchased will not go onto my ipod when i hit uppdate my ipod. any suggestions

  • BAPI parameters mismatch problem

    Hi All,
    I have been assigned to object wherein i need to insert bapi BAPI_GOODSMVT_CREATE in function module ZQM06_FM_TASK_GOODS_MOVEMENT. The problem is that i need to fill the structure that i can pass it to BAPI but the import parameters of FM ZQM06_FM_TASK_GOODS_MOVEMENT contain  structure that is mismatching. I mean to say that the FM is importing VIQMEL data and from that data i need to fill up structure that would be paased to Bapi BAPI_GOODSMVT_CREATE .
    As of now i am not able to map data into structure from VIQMEL so is there any FM or BAPI available for which i can pass VIQMEL data and it returnns me sales order data which in turn i can pass it to the specified bapi BAPI_GOODSMVT_CREATE ?
    Your response is highly appreciable.
    Thanks & Regards,
    Parag

    Hi Parag,
    There is no any such function module to pass the data from Bapi to normal function modules.
    If the structure of the Function modules are different, only way is finding the matching fields of the both function modules.
    Check what all are the matching fields and populate internally after calling the Bapi BAPI_GOODSMVT_CREATE fm. within the function module code itself. Then commit your work. It will definitely work.
    But increases the program overhead for you populating and checking all the fields. It is the way to solve this issue.
    Because BAPI structures some times will not match with standard structures.
    First you try to populate the Item data, with structure BAPI2017_GM_ITEM_CREATE. if this is done correctly you can handle the rest.
    Regards,
    Santosh Kumar M.

  • Bapi BAPI_POEC_CREATE I_PO_LIMIT problem

    Hi all,
    I have the problem with creation of BAPI_POEC_CREATE and limit position.
    If I create the Purchase Order without Limit Position the badi work correctly, if I create the Purchase Order with limit position and I the structure I_PO_LIMIT is valued, the badi doesn't work and generate the below message:
    BBP_PD 386 For purchase orders with limit, a limit must be specified (and only here)
    Any suggestion?
    Thanks.
    Kindly regard.
    Salvatore

    Hi Atul,
    Thanks for your help.
    Now I post my code, this is an example program for create PO from Contract, may be copy and past in abap editor on SRM 5.5 system.
    Also, I have checked the new notes posted, but not work.
    program ztest02.
    DATA: event        TYPE REF TO cl_htmlb_event,
      head_ctr     type BBP_PDS_ctr_HEADER_D,
      org_data     type HRS_OBJEC,
      ctr_org      type BBPT_PDS_ORG,
      wa_ctr_org   type BBP_PDS_ORG,
      wa_obj       type CRMD_ORDERADM_H-OBJECT_ID,
      bapi_head_po type BAPI_PO_HEADER_C,
         ret          type table of BAPIRET2,
      lt_item_ctr  type table of BBP_PDS_CTR_ITEM_D,
      wa_item_ctr  type BBP_PDS_CTR_ITEM_D,
      lt_item_po   type table of BAPI_PO_ITEM_C,
      wa_item_po   type BAPI_PO_ITEM_C,
      lt_part_ctr  type table of BBP_PDS_PARTNER,
      wa_part_ctr  type BBP_PDS_PARTNER,
      lt_part_po   type table of BAPI_BUP_C,
      wa_part_po   type BAPI_BUP_C,
      lt_org_ctr   type table of BBP_PDS_ORG,
      wa_org_ctr   type BBP_PDS_ORG,
      lt_org_po    type table of BAPI_ORG_C,
      wa_org_po    type BAPI_ORG_C,
      lv_item_number     TYPE bbp_item_no,
      lt_text      type BBPT_PDS_LONGTEXT,
      wa_text      type BBP_PDS_LONGTEXT,
      lt_po_text   type TABLE OF BAPI_TEXT_I,
      wa_po_text   type BAPI_TEXT_I,
      lt_att_ctr   TYPE BBPT_PDS_ATT_T,
      wa_att_ctr   type BBP_PDS_ATT_T,
      lt_att_po    type TABLE OF BAPI_ATT_C,
      wa_att_po    type BAPI_ATT_C,
      lt_limit     type table of BAPI_LIMIT_C,
      ls_limit     type BAPI_LIMIT_C,
    e_bapi_hpo type BAPI_PO_HEADER_D,
    e_item_po type table of BAPI_PO_ITEM_D,
    ewa_item_po type BAPI_PO_ITEM_D,
    *event = cl_htmlb_manager=>get_event( runtime->server->request ) .
    *DATA: event        TYPE REF TO cl_htmlb_event,
         head_ctr     type BBP_PDS_ctr_HEADER_D,
         org_data     type HRS_OBJEC,
         ctr_org      type BBPT_PDS_ORG,
         wa_ctr_org   type BBP_PDS_ORG,
         wa_obj       type CRMD_ORDERADM_H-OBJECT_ID,
         bapi_head_po type BAPI_PO_HEADER_C,
         ret          type table of BAPIRET2,
         lt_item_ctr  type table of BBP_PDS_CTR_ITEM_D,
         wa_item_ctr  type BBP_PDS_CTR_ITEM_D,
         lt_item_po   type table of BAPI_PO_ITEM_C,
         wa_item_po   type BAPI_PO_ITEM_C,
         lt_part_ctr  type table of BBP_PDS_PARTNER,
         wa_part_ctr  type BBP_PDS_PARTNER,
         lt_part_po   type table of BAPI_BUP_C,
         wa_part_po   type BAPI_BUP_C,
         lt_org_ctr   type table of BBP_PDS_ORG,
         wa_org_ctr   type BBP_PDS_ORG,
         lt_org_po    type table of BAPI_ORG_C,
         wa_org_po    type BAPI_ORG_C,
      ret          type table of bapiret2.
    data : msg type table of BBP_PDS_MESSAGES,
           wa_msg type bapiret2.
    *wa_obj = '4400001124'.
    if 1 eq 1.
      wa_obj = '4400001220'.
      CALL FUNCTION 'BBP_PD_CTR_GETDETAIL'
       EXPORTING
         I_OBJECT_ID               = wa_obj
       IMPORTING
         E_HEADER                  = head_ctr
         ET_ATTACH                 = lt_att_ctr
      ET_CONDITIONS             =
    TABLES
       E_ITEM                    = lt_item_ctr
       E_PARTNER                 = lt_part_ctr
       E_LONGTEXT                = lt_text
       E_ORGDATA                 = lt_org_ctr
      E_MESSAGES                =
      E_HCF                     =
      E_ICF                     =
      E_ACTVAL                  =
      E_ACC_ACTVAL              =
      E_HEADER_REL              =
      E_ITMLIM_REL              =
      E_TOL                     =
      E_DIS                     =
      E_STATUS                  =
      E_VERSION                 =
    *controllare che l'Organizzazione acquisti dell'utente che crea ordine sia nel contratto
      CALL FUNCTION 'BBP_OM_STRUC_GET_ORG_FROM_USER'
        EXPORTING
          USER                    = sy-uname
        IMPORTING
          ORGUNIT                 = org_data
        EXCEPTIONS
          PATH_NOT_FOUND          = 1
          ERROR_READING_STRUCTURE = 2
          NO_ROOTS                = 3
          INVALID_ROOTS           = 4
          INTERNAL_ERROR          = 5
          USER_NOT_ASSIGNED       = 6
          OTHERS                  = 7.
      read TABLE lt_org_ctr into wa_org_ctr index 1.
    if wa_ctr_org-PROC_ORG_OT ne org_data-OTYPE or
        wa_ctr_org-PROC_ORG_ID ne org_data-OBJID.
       message = 'L\''utente non ha i permessi adeguati per la creazione dell\''ordine'.
    endif.
      if 1 eq 1.
        MOVE-CORRESPONDING head_ctr to bapi_head_po.
        bapi_head_po-process_type = 'ECPO'.
        bapi_head_po-LOGSYS_FI = 'SV4CLNT100'.
        bapi_head_po-EXT_DEM_LOGSYS = 'SV5_100'.
        bapi_head_po-gr_ind = 'X'.
        bapi_head_po-CO_CODE = 'Z001'.
        bapi_head_po-BUSINESSPROCESS = head_ctr-guid.
        clear lv_item_number.
        loop at lt_item_ctr into wa_item_ctr.
          lv_item_number             = lv_item_number + 1.
          MOVE-CORRESPONDING wa_item_ctr to wa_item_po.
          wa_item_po-ITEM_GUID = wa_item_ctr-guid.
          wa_item_po-ITEM_NUMBER = lv_item_number.
          wa_item_po-category_guid = wa_item_ctr-category.
          wa_item_po-PRODUCT_SRC_SYS = wa_item_ctr-LOGSYS_FI.
          wa_item_po-CTR_NUMBER = head_ctr-object_id.
          wa_item_po-CTR_GUID = head_ctr-GUID.
          wa_item_po-CTR_ITEM_NUMBER = wa_item_ctr-NUMBER_INT.
         wa_item_po-subtype = 'EP'.
          wa_item_po-PRODUCT_SRC_SYS = 'SV5_100'.
          append wa_item_po to lt_item_po.
          MOVE-CORRESPONDING wa_item_po to ls_limit.
          ls_limit-PARENT_GUID = wa_item_ctr-guid.
         ls_limit-LIM_REF_H_GUID = wa_item_ctr-guid.
          ls_limit-LIMIT = wa_item_ctr-PRICE.
          ls_limit-EXP_VALUE = wa_item_ctr-PRICE * 50.
          ls_limit-LIM_REF_LOG_SYS = 'SV4CLNT100'.
         ls_limit-lim_type = 'G'.
          ls_limit-unlimited = 'X'.
           ls_limit-LIM_REF_H_ID = bapi_head_po-DOC_NUMBER.
           ls_limit-LIM_REF_I_ID = wa_item_po-ITEM_NUMBER.
           ls_limit-LIM_REF_H_GUID = head_ctr-guid.
           ls_limit-LIM_REF_I_GUID = wa_item_po-ITEM_GUID.
          append ls_limit to lt_limit.
        endloop.
        loop at lt_part_ctr into wa_part_ctr.
          if wa_part_ctr-PARTNER_FCT ne 51 and
             wa_part_ctr-PARTNER_FCT ne 38 and
             wa_part_ctr-PARTNER_FCT ne 26.
            MOVE-CORRESPONDING wa_part_ctr to wa_part_po.
            wa_part_po-PARTNER_guid = wa_part_ctr-PARTNER_NO.
            append wa_part_po to lt_part_po.
          endif.
          if wa_part_ctr-PARTNER_FCT eq 26.
            MOVE-CORRESPONDING wa_part_ctr to wa_part_po.
            wa_part_po-PARTNER_guid = wa_part_ctr-PARTNER_NO.
            move '00000016' to wa_part_po-PARTNER_FCT.
            append wa_part_po to lt_part_po.
          endif.
          clear : wa_part_ctr,wa_part_po.
        endloop.
        loop at lt_org_ctr into wa_org_ctr.
          MOVE-CORRESPONDING wa_org_ctr to wa_org_po.
          wa_org_po-parent_guid = head_ctr-guid.
          append wa_org_po to lt_org_po.
        endloop.
       tabelle testi
        loop at lt_text into wa_text.
          wa_po_text-PARENT_GUID = wa_text-GUID.
          wa_po_text-TEXT_ID = wa_text-TDID.
          wa_po_text-TEXT_LINE = wa_text-TDLINE.
         wa_po_text-LANGU_ISO = wa_text-TDSPRAS.
          append wa_po_text to lt_po_text.
        endloop.
       tabella allegati
        loop at lt_att_ctr into wa_att_ctr
           where p_guid eq head_ctr-guid.
          MOVE-CORRESPONDING wa_att_ctr to wa_att_po.
          wa_att_po-PARENT_GUID = wa_att_ctr-P_GUID.
          wa_att_po-url = wa_att_ctr-DISP_URL.
         wa_att_po-classname = wa_att_ctr-phio_class.
          wa_att_po-doc_id = wa_att_ctr-phio_objid.
          append wa_att_po to lt_att_po.
        endloop.
        CALL FUNCTION 'BAPI_POEC_CREATE'
          EXPORTING
            I_PO_HEADER            = bapi_head_po
        I_PO_HEADER_CUST       =
        I_TESTRUN              = 'X'
          IMPORTING
            E_PO_HEADER            = e_bapi_hpo
        E_PO_HEADER_CUST       =
          TABLES
            I_PO_ITEMS             = lt_item_po
        I_PO_ITEMS_CUST        =
        I_PO_ACCASS            =
        I_PO_ACCASS_CUST       =
           I_PO_PARTNER           = lt_part_po
           I_PO_TEXT              = lt_po_text
          I_PO_ATTACH            = lt_att_po
          I_PO_ORGDATA           = lt_org_po
        I_PO_LIMIT             = lt_limit
        I_PO_SDLN              =
         E_PO_ITEMS             = e_item_po
        E_PO_ITEMS_CUST        =
        E_PO_ACCASS            =
        E_PO_ACCASS_CUST       =
        E_PO_PARTNER           =
        E_PO_ORGDATA           =
        E_PO_LIMIT             =
        E_PO_SDLN              =
        E_PO_TEXT              =
        E_PO_STATUS            =
        E_PO_ATTACH            =
           RETURN                 = ret
        commit work AND WAIT.
      endif.
    endif.
    Regards.

  • Reg:Standard purchase oder printing

    Dear All,
    In ME9F transaction code we assigned one 'z' print program for standard PO printing and as well as one 'z' form(sap script ) name for standard PO printing. what is problem means we included one 'z' condition type for PO printing. where we have to include that 'z' conditon type in standard PO printing. we searched in print program and form (main window) also for existing 'z' condtion types , from there itself we can include that newly 'z'  condtion type. But we couldnt able to find out that existing conditon types.
    If there is a any solution let me know how to taggle this issue.
    Thanks,
    Sankar M

    Hi,
    Go to transaction: NACE
    Select the approrpirate Application
    i.e in your case if it is purchase order then it is EF.
    Click the output types.
    Click the edit icon and then go for new entries.
    Enter the zcondition type.
    Regards
    Sunil.

Maybe you are looking for