Get DocNum from newly entered Production Order

I have an add-on that creates a production order from a given BOM (Item).  The code works fine and the production order shows up in B1.  However, following the "ProdOrder.Add" event, I need to find the DocNum and/or DocEntry for the newly added Production Order.  The problem is that none of those fields are actually populated even after the "Add" event.
How can I retrieve this data from the newly added Production Order?
Here's my code so far:
ProdOrder = B1Connections.diCompany.GetBusinessObject(BoObjectTypes.oProductionOrders)
                ProdOrder.ItemNo = ItemID
                ProdOrder.PlannedQuantity = Qty       
                strDate = DueDate.Substring(4, 2) & "/" & DueDate.Substring(6, 2) & "/" & DueDate.Substring(0, 4)
                dDate = strDate
                ProdOrder.DueDate = dDate
                intResult = ProdOrder.Add()
DocNum = ProdOrder.DocumentNumber
Even though the DocNum will show up fine in the database, the statement above will return only a "0" value.
What do I need to do to get this data?
Thanks!

Hey Curtis,
Have you checked out the GetNewObjectCode method in the DI API? I am not sure what version you are using but you can use this for sure in 2004

Similar Messages

  • Users are not able to create POs from PRs having Production Order (F)

    Hi Gurus
    Users are not able to create POs from PRs having Production Order (F) as creation indicator.
    Whenever we are trying to convert the PR to PO we are getting the error message "Requisition has different doc. type NB and item cat. >&<" based on the below OSS# 938154 condition for the creation indicator type F.
    Would you please investigate and advise what OSS notes are required to be able to use item category L (subcontracting) on a PO for a requisition generated from a network activity via Procurement Type = "Preliminary requisition for WBS element".
    Thanks,
    Sada.

    Hi Ajay & Andra
    Whenever we are trying to convert the PR to PO we are getting the error message "Requisition has different doc. type NB and item cat. >&<" based on the below OSS# 938154 condition for the creation indicator type  Production order (F).
    Our Business requirement as shown below.
    1).The problem - we currently have no way to "direct requisition" an item to be procured via      subcontracting - only itu2019s possible via MRP.
    2).These behaviors are inconsistent as the requisition process should not impact the procurement process.  Can we find a way to influence the creation indicator on the requisition so that it does not appear as a production order?
    Please suggest any alternate method for achieving this.
    Thanks & Regards
    Sada

  • Printing UDF from BOM on Production Order

    I have added some UDF's on my BOM that I'd like to print on the Production Order. How do I get BOM UDF info onto the Production Order?
    Sal

    Sal,
    BOM and Prod Order are 2 different documents and therefore do not share the UDF.  You will need to create similar set of UDF on the Production Order Header / rows (as required) and create formatted seach to copy the data from the UDF.
    Please give me an example of the data in the UDF and I will walk you through
    Suda

  • How to get the finished date of production order

    hi guys
    now i want to get the finished date of production date.  when i search in the table afko , i found the field GLTRI is '0000.00.00'.
    BUT IN the production order display view , the confirm date is '2007.1.1'. so how can i get the confirm date with the production order number? thanks.

    For costing report, you have to read the following tables: based on material Qty/value/ Machine rate and machine posting date , machine rate ( T-code kp26)  and also types of material Raw, finished and semi finished ..
    AFRU ,AFPO,AFKO,AFVV,AFVC,CAUFV FOR PRODUCTION ORDER.
    For material calculation MARA, MSEG and MKPF as well as MAKT...
    Hope this’ll help you .
    Thanks

  • How to get the cost center of production order

    hi guys
    please tell me how i can get the cost center of the production order. 
    thanks.

    You need AUFK-KOSTL ?
    Pole

  • Document Flow from BOM to Production Orders

    Dear SAP Gurus,
    I have attached a few documents at header level of the BOM. I have also attached document at item level in the BOM. When I create a production order these documents are not flowing to Production Order. Is there any way to do that. I also want to see them in CS11 and CS12 reports.
    In OPKP I have already checked Document Links-BOM "On Creation" and "On Release" for my production scheduling profile.
    Thanks and Regards
    Geravine

    I have three documents. One is attached at the BOM header level under the documents tab. The second with item category D is entered as a line item in the BOM Items. The third is in the Item Level under the item's documents tab in the item details. All have same document type.
    When I create the production order the second document is copied in the document overview of production order. First and Third are nowhere to be seen.
    Is there any config or user exit to achieve the same?

  • Need BAPI to get Actual, Plan, Variance by Production Order

    Hi Experts,
    I need to get variance, Plan, and actual cost (material cost) by Production Order. Does SAP has BAPI to do this?
    Best Reguard

    For costing report, you have to read the following tables: based on material Qty/value/ Machine rate and machine posting date , machine rate ( T-code kp26)  and also types of material Raw, finished and semi finished ..
    AFRU ,AFPO,AFKO,AFVV,AFVC,CAUFV FOR PRODUCTION ORDER.
    For material calculation MARA, MSEG and MKPF as well as MAKT...
    Hope this’ll help you .
    Thanks

  • Spare Sales order stealing stock from a Released production order

    Hi Gurus,
    This is not a new problem. I read the below link only a hundred time now.
    Sales order stealing components from Production order
    Business scenario-
    Top Assembly material - XYZ (Let's say Desktop PC), Proc type - E, Plng Strat - 40 (regular MTS scenario)
    Sub Assembly material - ABC (Let's say Monitor), Proc type - F, Plng Strat - blank. But we sell this part sometimes (Let's say - customer wants an additional monitor).
    Roy is a shop supervisor working on a $1 million Sales order for Top assembly XYZ which is already late and customer is screaming.
    He released the production order with no missing parts, printed and fretting to finish this order.
    After couple of hours of setup & machine prep - Roy went to pick up the parts and to his surprise material ABC is not available. 
    Tina is at shipping department working on a $1000 Sales order that arrive today. System said 'sure you can ship it 3 days in advance'. So created a delivery and shipped it to the customer.
    Now, Roy ran TCode: MB52 and found out that Tina just shipped his component ABC.
    SAP gave the part ABC to a $1000 sales order and business lost sales on a $1 million order.
    Please find the attachment for config screen shots TCode: OPJJ
    Sales order Checking rule
    Production order Release checking rule
    Please help me resolve this issue.
    Let me know if you need more info.
    Thanks,

    Praneeth,
    There are two separate concepts here.  "How do I ensure that production orders and Sales orders are on an equal footing" and "what is the purpose of 'check without RLT'.
    You have an ATP check relevant for Sales orders (checking rule "A" for Make To Stock).  You have an ATP check for production orders (I assume it is checking rule "PP").  If you want these two objects to have equal priority on stock and supplies, then make the two rules (OVZ9 for A and PP) identical.
    Now, to RLT.
    Prod Order Release has 'Check without RLT' active, that means - it'll let the sales orders (also that are outside the RLT) steal the stock.
    Sales orders that are outside RLT will automatically confirm.  "Stealing" stock is a result of combination of the ATP for the sales orders, plus the ATP for the sales order delivery, combined with the ATP for production orders. and any ATP you may have on Goods Issues against a production order.  I cannot possibly tell you what you should do to prevent stealing stock, since there are so many permutations of scenarios that can affect the outcome.
    I suggest instead that you give me concrete scenarios, telling me of specific problems, illustrated with screenshots of CO09, and I will help you through one or two specific scenarios.
    Best regards,
    DB49

  • Vendor partner function not getting copied from opportunity to ERP order

    Hi,
    I have created vendors in ERP and replicated them to CRM. The number ranges are different in both the systems. IN CRM it is Y033100476 and in ERP it is 33100476. I have put Y033100476 in the parties involved assignment block and create ERP sales order as follow up. When i do this the broker partner function first of all doesnt appear with partner function Y033100476. And the system gives me warning that "CRM business partner Y033100476 could not be mapped to an ERP customer", i have seen the notes 1236015 and 1446253, but still its not clear to me, that why the vendor partner doesnt gets copied to ERP sales orders, am i missing any setting?

    By standard you:
    1. associate customers to plants in ERP under spro>Materials Management> Purchasing>Purchase Order>Set Up Stock Transport Order. There select button "Plant" to get a list of all plants in the system. Select one plant and press button "Details". In the details screen enter customer number you want to assosiate with plant.
    2. mapp table customer <-> Plant in CRM in table CRMM_LOCMAP. In order to update this table with the information from ERP, run the download object DNL_PLANT. After the download is completed, the table CRMM_LOCMAP should be filled with fresh records which map the 'plant business partners' to respective plants. But as I said in previous post, you can also
    manually update this table with the correct mapping entries.
    Regards.

  • Does Node UUID get propagated from Staging to Production

    Hi,
    We have the following requirement -
    We have a folder which contains list of articles in Content Repository.
    The requirement is to select the articles from the folder, and display it in a certain order.
    Preferred solution is XML based, where we just specify the list of items in the order in which they are to appear.
    We did think of a solution where, we will list down all the UID of the nodes that should appear in the portlet in the same order in XML. And in the JSP retrieve the node based on the UUID and display all its relevant properties.
    However I just had one concern on this. The custom will always manipulate the XML on Staging and then propagate onto production. So in that case, the Node UUID that is obtained from Admin Console in Staging - Once propagated does it remain same?
    So will the Staging XML with Staging values of NODE UID's have tp be manipulated to point to Production UID's or
    Does the UUID value in staging get propagated to PRODUCTION. SO that the same XML can be used across. Or is a new SET of UID's are created for PROD env.

    Hi Deepak,
    Thanks for your inputs.
    You mentioned that we create a property in the content type that specifies the order.
    If I understand it clearly, if we create 2 properties 1. to-be-published (boolean) and 2. posted-date
    and instruct the person doing content management that
    1. Select the items using the to-be-published property (Content selector will select all nodes on the basis of this property)
    2. The items will be sorted on the basis of posted-date (Descending order)
    Pls. confirm, if this can be the approach.
    Alternatively,
    As end user was insisting a XML based approach, how about creating a property - Post-Id (User will have to specify a unique ID) and in the XML just specify the ID. But what I dont get here is, how will the nodes get retrieved in first place.
    Thanks,
    Lilly

  • Get DocNum from CFL (choose from list)

    Hi SAP gurus!
    Wish all of you a very Happy and Prosperous New Year 2012 !
    is it possible to get Document Number from List of Goods Receipt (CFL) ..?
    in Landed Cost Screen, when user clicks on 'Copy From' button, i am trying to execute query based on Document Number of List Of Goods Receipt CFL (Screen No. 10019). and then  assign value of  GrossAmnt to textfield  'ActualCost'
    but in Screen 10019, when i press 'Choose' button, value in  pval.formtype is 992!
    in Case statement of 10019, hence my query is not getting executed..
    Does any one have any idea how can i get Document Number from CFL.?
    below is my code.
    '// add an event type to the container
    '// this method returns an EventFilter object
        Set oFilter = oFilters.Add(et_ITEM_PRESSED)
    '// aggign the form type on which the event would be processed
        oFilter.Add 992      'Landed Cost Screen
        oFilter.Add 10019  'List of Goods Receipt Screen (CFL)
    in Case statement of pval.formtype
    If pVal.FormType <> 0 Then
    If pVal.Before_Action = False Then
    Select Case pVal.FormType
    case 992:
    case 10019:
    select case pval.eventtype
    case et_item_pressed
    Set o_TmpForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
    o_matrix = o_TmpForm.items.item("7").specific
    set actual_cost = o_matrix.column.item("DocNum").specific.value ' actual_cost.RowCount is 0, hence runtime error.
    'now passing query in below sub end sub subroutine(procedure)..
    get_actual_cost
    end select
    end Select
    end if
    end if
    i appreciate your help..
    Thanks and Regards,
    kaviprashu

    Hello,
    When you call ChooseFromList object, and select an item, you can get the datatable which contains the selected rows from the CFL object.
    Now it has several columns (basically all columns in the head table), you so it is now easy to select the correct column:
    val1 = oDataTable.GetValue("[COLUMN_NAME]", 0)
    Sample code:
    If oCFLEvento.BeforeAction = False Then
                    Dim oDataTable As SAPbouiCOM.DataTable
                    oDataTable = oCFLEvento.SelectedObjects
                    Dim val1 As String
                    Dim val2 As String
                    Try
                        val1 = oDataTable.GetValue("DocNum", 0)
                        val2 = oDataTable.GetValue("DocEntry", 0)
                    Catch ex As Exception
                    End Try
    Now you can only focus on the landed costs screen, (992) and track event et_CHOOSE_FROM_LIST
    Now the complete code:
    If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
                oCFLEvento = pVal
                Dim sCFL_ID As String
                sCFL_ID = oCFLEvento.ChooseFromListUID
                Dim oForm As SAPbouiCOM.Form
                oForm = SBO_Application.Forms.Item(FormUID)
                Dim oCFL As SAPbouiCOM.ChooseFromList
                oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
                If oCFLEvento.BeforeAction = False Then
                    Dim oDataTable As SAPbouiCOM.DataTable
                    oDataTable = oCFLEvento.SelectedObjects
                    Dim val1 As String
                    Dim val2 As String
                    Try
                        val1 = oDataTable.GetValue("DocNum", 0)
                        val2 = oDataTable.GetValue("DocEntry", 0)
                    Catch ex As Exception
                    End Try
                End If
            End If
    Regards
    János

  • Manual discounts are not getting copied from Quote to Sales order

    Hello All,
    If I assign a manual discount to any item in Quotation document, this condition type with its discount amount is not getting
    copied over to Sales order document, I have selected the drop down "D Copy all conditions" in the copy control for item categories,
    and both quote & Sales order use the same pricing procedure, i am i missing something here?
    I appreciate your help
    thanks
    Chandu

    Hi Chandu,
    Please try to adopt the standard pricing type in the copy control between QT and OR which is "A - Copy Pricing components Unchanged and redetermine Scales".
    Please share the outcome.
    Regards

  • Not getting data from newly created dashboards

    Hi,
    I have created new Dashboard like "Server Health Status"  not getting any data, whatever i have created earlier dashboards all getting data without any issue but if i create the same new dashboard im getting any data, please find the below error,
    Can you please help me n this issue anyone. I'm Using SCOM 2012 SP1 with SQL Server 2008 R2.
    Microsoft.EnterpriseManagement.Presentation.DataAccess.DataAccessDataNotFoundException: Exception reading objects ---> Microsoft.EnterpriseManagement.Common.UnknownDatabaseException: The query processor ran out of internal resources and could not produce
    a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support
    Services for more information.
       at Microsoft.EnterpriseManagement.Common.Internal.ServiceProxy.HandleFault(String methodName, Message message)
       at Microsoft.EnterpriseManagement.Common.Internal.EntityObjectsServiceProxy.GetRelatedManagedEntitiesByManagedEntityTypesAndCriteriaWithInstanceQueryOptions(IList`1 parentManagedEntityIds, Boolean recurse, IList`1 managedEntityTypeIds, IList`1
    managedEntityBaseTypeIds, IList`1 criterias, String languageCode, InstanceQueryOptions instanceQueryOptions)
       at Microsoft.EnterpriseManagement.InstancesManagement.GetRelatedObjectsInternal[T](ICollection`1 instanceIds, ICollection`1 criteriaCollection, TraversalDepth traversalDepth, ObjectQueryOptions queryOptions)
       at Microsoft.EnterpriseManagement.Management.DataProviders.ManagedEntityProvider.GetContainedManagedEntities(IDataObjectCollection targetEntities, ICollection`1 recursionTypeNames, ICollection`1 baseTypeNames, String criteriaString, List`1 valueDefinitions,
    List`1 sortValueDefinitions, String typePropertyName, String typeWithIconPropertyName, Boolean propertyCollectionRequested)
       --- End of inner exception stack trace ---
       at Microsoft.EnterpriseManagement.Presentation.DataAccess.DataProviderCommandMethodInvoker.Invoke()
       at Microsoft.EnterpriseManagement.Monitoring.DataProviders.RetryCommandExecutionStrategy.Invoke(IDataProviderCommandMethodInvoker invoker)
       at Microsoft.EnterpriseManagement.Presentation.DataAccess.DataProviderCommandMethod.Invoke(CoreDataGateway gateWay, DataCommand command)
       at Microsoft.EnterpriseManagement.Presentation.DataAccess.CoreDataGateway.ExecuteInternal[TResult](DataCommand command)
       at Microsoft.EnterpriseManagement.Presentation.DataAccess.CoreDataGateway.<ExecuteAsync>b__0[TResult](<>f__AnonymousType0`1 data)
    Thanks 
    Raja R
    Raja R

    Hi,
    Please try the Update Rollup 2 for System Center 2012 Service Pack 1
    http://support.microsoft.com/kb/2802159
    It fixes the issue “Query processor runs out of internal resources and cannot produce a query plan when you open Dashboard views”.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How Do I Get Results From Data Entered Yesterday

    How can I specify data that was entered Yesterday for a report? The report is run automatically so I can't hand enter yesterday's date each time it's run. I have been digging through the Help Files and the closest I come up with is 'All Dates to Yesterday'. Any advice would be greatly appreciated.

    There is a function called as CurrentDate in the formula fields... you can use this column to yesterdays date... and you dont have to manully change it
    happy reporting

  • How to get all production orders for a workcenter

    Hello ...
    I have a requirement to create a report of all production orders for a given workcenter.  The user enters the workcenter (CRHD-ARBPL), plant (CRHD-WERKS) and a date range, and wants to see a list of orders (AUFNR) that fall within that date range along with some other data from AFKO and AFPO. 
    I can't figure out a good, consistent way to get from workcenter to production orders.
    Any ideas?
    Thanks!
    Sharon

    Hi there check this program for relation between SO PO and Production order
    REPORT z_so_info.
    TABLES: vbak, vbap, afko, afpo.
    *Field catalog
    TYPE-POOLS: slis.
    DATA: lv_repid TYPE sy-repid VALUE sy-repid,
    xfield TYPE slis_t_fieldcat_alv,
    afield TYPE slis_fieldcat_alv.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(25) text-002.
    SELECT-OPTIONS: so_so FOR vbak-vbeln OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-003.
    PARAMETERS:
    p_kunnr LIKE vbak-kunnr, " sold-to
    p_kunwe LIKE vbak-kunnr. " ship-to
    SELECTION-SCREEN END OF BLOCK b2.
    *Constants
    CONSTANTS: c_zor TYPE vbak-auart VALUE 'ZOR',
    c_we TYPE vbpa-parvw VALUE 'WE',
    c_ag TYPE vbpa-parvw VALUE 'AG'.
    * c_space TYPE space.
    *Ranges
    RANGES: ra_parvw FOR vbpa-parvw,
    ra_kunnr FOR vbpa-kunnr.
    *Tables
    DATA: BEGIN OF gt_output OCCURS 0,
    vbeln LIKE vbak-vbeln, " sales order number
    posnr LIKE vbap-posnr, " SO item number
    matnr LIKE vbap-matnr, " material number
    sh LIKE vbpa-kunnr, " Ship-to
    sp LIKE vbpa-kunnr, " Sold-to
    lifnr LIKE ekko-lifnr, " Vendor
    bstnk LIKE vbak-bstnk, " PO number
    banfn LIKE vbep-banfn, " Purchase requi
    po_st TYPE char30, " PO status text
    pstyv TYPE vbap-pstyv, " Item catagory
    aufnr LIKE afpo-aufnr, " Production Order
    prd_stat TYPE string, " Prd order status
    END OF gt_output.
    DATA: wa_output LIKE gt_output.
    FIELD-SYMBOLS: <fs_output> LIKE gt_output.
    *Table for sales order and PO
    TYPES : BEGIN OF gs_data,
    vbeln TYPE vbak-vbeln,
    posnr TYPE vbap-posnr,
    pstyv TYPE vbap-pstyv,
    matnr TYPE vbap-matnr,
    END OF gs_data.
    DATA: gt_data TYPE STANDARD TABLE OF gs_data,
    wa_data TYPE gs_data.
    *Table for Production Orders
    TYPES: BEGIN OF gs_prd,
    aufnr TYPE afpo-aufnr,
    posnr TYPE afpo-posnr,
    kdauf TYPE afpo-kdauf,
    kdpos TYPE afpo-kdpos,
    wepos TYPE afpo-wepos, "Goods Receipt Indicator
    elikz TYPE afpo-elikz, "Delivery Completed Indicator
    objnr TYPE aufk-objnr, "Object number
    * getri TYPE afko-getri, "Confirmed Order Finish Date
    * gltri TYPE afko-gltri, "Actual finish date
    END OF gs_prd.
    DATA: gt_prd TYPE STANDARD TABLE OF gs_prd,
    wa_prd TYPE gs_prd.
    *Table for partner data
    TYPES: BEGIN OF gs_partner,
    vbeln TYPE vbak-vbeln,
    posnr TYPE vbap-posnr,
    parvw TYPE vbpa-parvw,
    kunnr TYPE vbpa-kunnr,
    END OF gs_partner.
    DATA: gt_partner TYPE STANDARD TABLE OF gs_partner,
    wa_partner TYPE gs_partner.
    TYPES: BEGIN OF gs_po,
    ebeln TYPE ekkn-ebeln,
    ebelp TYPE ekkn-ebelp,
    vbeln TYPE ekkn-vbeln,
    vbelp TYPE ekkn-vbelp,
    END OF gs_po.
    DATA: gt_po TYPE STANDARD TABLE OF gs_po,
    wa_po TYPE gs_po.
    TYPES: BEGIN OF gs_preq,
    vbeln TYPE vbep-vbeln,
    posnr TYPE vbep-posnr,
    banfn TYPE vbep-banfn,
    END OF gs_preq.
    DATA: gt_preq TYPE STANDARD TABLE OF gs_preq,
    wa_preq TYPE gs_preq.
    TYPES: BEGIN OF gs_po_stat,
    ebeln TYPE ekko-ebeln,
    procstat TYPE ekko-procstat,
    lifnr TYPE ekko-lifnr,
    END OF gs_po_stat.
    DATA: gt_po_stat TYPE STANDARD TABLE OF gs_po_stat,
    wa_po_stat TYPE gs_po_stat.
    *Field symbols
    FIELD-SYMBOLS: <fs> TYPE tj02t-txt04,
    <fs_temp> TYPE tj02t-txt04,
    <fs_stat> TYPE char30.
    START-OF-SELECTION.
    PERFORM fr_build_range.
    PERFORM fr_get_data.
    PERFORM fr_build_fc.
    PERFORM fr_output.
    *& Form fr_get_data
    * text
    * --> p1 text
    * <-- p2 text
    FORM fr_get_data.
    *Get SO
    SELECT a~vbeln a~posnr a~pstyv a~matnr
    FROM vbap AS a
    JOIN vbak AS b
    ON a~vbeln = b~vbeln
    JOIN vbpa AS c
    ON b~vbeln = c~vbeln
    INTO TABLE gt_data
    WHERE b~vbeln IN so_so
    AND b~auart EQ c_zor "Only Sales Orders
    AND c~kunnr IN ra_kunnr. "from selection screen
    DELETE ADJACENT DUPLICATES FROM gt_data COMPARING vbeln posnr.
    *get data of the production order
    IF NOT gt_data[] IS INITIAL.
    SELECT a~aufnr a~posnr a~kdauf a~kdpos a~wepos a~elikz
    b~objnr
    FROM afpo AS a
    JOIN aufk AS b
    ON a~aufnr = b~aufnr
    INTO TABLE gt_prd
    FOR ALL ENTRIES IN gt_data
    WHERE a~kdauf EQ gt_data-vbeln
    AND a~kdpos EQ gt_data-posnr.
    ENDIF.
    *Get partner data
    IF NOT gt_data[] IS INITIAL.
    SELECT vbeln posnr parvw kunnr
    FROM vbpa
    INTO TABLE gt_partner
    FOR ALL ENTRIES IN gt_data
    WHERE vbeln EQ gt_data-vbeln.
    ENDIF.
    *Get Purchase Order
    IF NOT gt_data[] IS INITIAL.
    SELECT ebeln ebelp vbeln vbelp
    FROM ekkn
    INTO TABLE gt_po
    FOR ALL ENTRIES IN gt_data
    WHERE vbeln EQ gt_data-vbeln
    AND vbelp EQ gt_data-posnr.
    SELECT vbeln posnr banfn
    FROM vbep
    INTO TABLE gt_preq
    FOR ALL ENTRIES IN gt_data
    WHERE vbeln EQ gt_data-vbeln
    AND posnr EQ gt_data-posnr.
    ENDIF.
    IF NOT gt_po[] IS INITIAL.
    SELECT a~ebeln a~procstat a~lifnr
    FROM ekko AS a
    JOIN ekpo AS b
    ON a~ebeln = b~ebeln
    INTO TABLE gt_po_stat
    FOR ALL ENTRIES IN gt_po
    WHERE b~ebeln EQ gt_po-ebeln
    AND b~ebelp EQ gt_po-ebelp.
    ENDIF.
    *Move data to output table
    LOOP AT gt_data INTO wa_data.
    wa_output-vbeln = wa_data-vbeln.
    wa_output-posnr = wa_data-posnr.
    wa_output-pstyv = wa_data-pstyv.
    wa_output-matnr = wa_data-matnr.
    READ TABLE gt_po INTO wa_po WITH KEY vbeln = wa_data-vbeln
    vbelp = wa_data-posnr.
    IF sy-subrc EQ 0.
    wa_output-bstnk = wa_po-ebeln.
    READ TABLE gt_po_stat INTO wa_po_stat WITH KEY ebeln = wa_po-ebeln.
    IF sy-subrc EQ 0.
    wa_output-lifnr = wa_po_stat-lifnr.
    CASE wa_po_stat-procstat.
    WHEN '01'.
    wa_output-po_st = 'Version in process'.
    WHEN '02'.
    wa_output-po_st = 'Active'.
    WHEN '03'.
    wa_output-po_st = 'In release'.
    WHEN '04'.
    wa_output-po_st = 'Partially released'.
    WHEN '05'.
    wa_output-po_st = 'Released Completely'.
    WHEN '08'.
    wa_output-po_st = 'Rejected'.
    ENDCASE.
    ENDIF. "inner read subrc
    ENDIF. "outer read subrc
    READ TABLE gt_preq INTO wa_preq WITH KEY vbeln = wa_data-vbeln
    posnr = wa_data-posnr.
    IF sy-subrc EQ 0.
    wa_output-banfn = wa_preq-banfn.
    ENDIF.
    READ TABLE gt_prd INTO wa_prd WITH KEY kdauf = wa_data-vbeln
    kdpos = wa_data-posnr.
    IF sy-subrc EQ 0.
    wa_output-aufnr = wa_prd-aufnr.
    *get the purchase requisition for production order as well
    SELECT SINGLE banfn
    FROM ebkn
    INTO wa_output-banfn
    WHERE aufnr EQ wa_prd-aufnr.
    *Get the status of the production order
    PERFORM fr_get_prd_stat USING wa_prd-objnr
    CHANGING wa_output-prd_stat.
    ENDIF. " sy-subrc
    READ TABLE gt_partner INTO wa_partner WITH KEY vbeln = wa_data-vbeln
    parvw = c_we.
    IF sy-subrc EQ 0.
    wa_output-sh = wa_partner-kunnr.
    ENDIF.
    READ TABLE gt_partner INTO wa_partner WITH KEY vbeln = wa_data-vbeln
    parvw = c_ag.
    IF sy-subrc EQ 0.
    wa_output-sp = wa_partner-kunnr.
    ENDIF.
    APPEND wa_output TO gt_output.
    CLEAR: wa_data, wa_prd,wa_partner,wa_output.
    ENDLOOP.
    ENDFORM. " fr_get_data
    *& Form fr_build_range
    * text
    * --> p1 text
    * <-- p2 text
    FORM fr_build_range .
    *Range for partner function
    MOVE 'I' TO ra_parvw-sign.
    MOVE 'EQ' TO ra_parvw-option.
    MOVE 'SH' TO ra_parvw-low. " we
    APPEND ra_parvw.
    CLEAR ra_parvw.
    MOVE 'I' TO ra_parvw-sign.
    MOVE 'EQ' TO ra_parvw-option.
    MOVE 'SP' TO ra_parvw-low. " ag
    APPEND ra_parvw.
    CLEAR ra_parvw.
    *Range for ship-to and sold-to
    MOVE 'I' TO ra_kunnr-sign.
    MOVE 'EQ' TO ra_kunnr-option.
    MOVE p_kunnr TO ra_kunnr-low.
    APPEND ra_kunnr.
    CLEAR ra_kunnr.
    MOVE 'I' TO ra_kunnr-sign.
    MOVE 'EQ' TO ra_kunnr-option.
    MOVE p_kunwe TO ra_kunnr-low.
    APPEND ra_kunnr.
    CLEAR ra_kunnr.
    ENDFORM. " fr_build_range
    *& Form fr_build_fc
    * text
    * --> p1 text
    * <-- p2 text
    FORM fr_build_fc .
    * sales order number
    afield-fieldname = 'VBELN'.
    afield-seltext_s = 'Sales #'.
    afield-ref_tabname = 'VBAK'.
    APPEND afield TO xfield. CLEAR afield.
    * sales ITEM number
    afield-fieldname = 'POSNR'.
    afield-seltext_s = 'Item #'.
    afield-ref_tabname = 'VBAP'.
    APPEND afield TO xfield. CLEAR afield.
    * Material Number
    afield-fieldname = 'MATNR'.
    afield-seltext_s = 'Material #'.
    afield-ref_tabname = 'VBAP'.
    afield-outputlen = 10.
    APPEND afield TO xfield. CLEAR afield.
    *Vendor Number
    afield-fieldname = 'LIFNR'.
    afield-seltext_s = 'Vendor Num.'.
    afield-ref_tabname = 'EKKO'.
    APPEND afield TO xfield. CLEAR afield.
    * ship-to-party
    afield-fieldname = 'SH'.
    afield-seltext_s = 'Ship-to'.
    afield-ref_tabname = 'VBPA'.
    APPEND afield TO xfield. CLEAR afield.
    * sold-to-party
    afield-fieldname = 'SP'.
    afield-seltext_s = 'Sold-to'.
    afield-ref_tabname = 'VBPA'.
    APPEND afield TO xfield. CLEAR afield.
    *PO number
    afield-fieldname = 'BSTNK'.
    afield-seltext_s = 'PO NUM'.
    afield-ref_tabname = 'EKKO'.
    APPEND afield TO xfield. CLEAR afield.
    *PO status
    * afield-fieldname = 'PO_STAT'.
    * afield-seltext_s = 'Step'.
    * afield-ref_tabname = 'zbacklog_v2'.
    * APPEND afield TO xfield. CLEAR afield.
    *PO step status
    afield-fieldname = 'PO_ST'.
    afield-seltext_s = 'PO.Status'.
    afield-ref_tabname = 'zbacklog_v2'.
    APPEND afield TO xfield. CLEAR afield.
    *Purchase requisition
    afield-fieldname = 'BANFN'.
    afield-seltext_s = 'Pur. Req.'.
    afield-ref_tabname = 'VBEP'.
    APPEND afield TO xfield. CLEAR afield.
    *Item catagory
    afield-fieldname = 'PSTYV'.
    afield-seltext_s = 'Itm. Catg'.
    afield-ref_tabname = 'VBAP'.
    APPEND afield TO xfield. CLEAR afield.
    *Prodcution Order number
    afield-fieldname = 'AUFNR'.
    afield-seltext_m = 'Prod.Order'.
    afield-ref_tabname = 'AFKO'.
    APPEND afield TO xfield. CLEAR afield.
    *PRODCUTION status
    afield-fieldname = 'PRD_STAT'.
    afield-seltext_s = 'Prd. Step'.
    afield-ref_tabname = 'zbacklog_v2'.
    afield-outputlen = 20.
    APPEND afield TO xfield. CLEAR afield.
    *PRODUCTION step status
    * afield-fieldname = 'PRD_ST'.
    * afield-seltext_s = 'Prd. Status'.
    * afield-ref_tabname = 'zbacklog_v2'.
    * APPEND afield TO xfield. CLEAR afield.
    ENDFORM. " fr_build_fc
    *& Form fr_output
    * text
    * --> p1 text
    * <-- p2 text
    FORM fr_output .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    * I_CALLBACK_PF_STATUS_SET = ' '
    * I_CALLBACK_USER_COMMAND = ' '
    * I_STRUCTURE_NAME =
    * IS_LAYOUT =
    it_fieldcat = xfield[]
    i_default = 'X'
    i_save = 'A'
    TABLES
    t_outtab = gt_output
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    ENDFORM. " fr_output
    *& Form fr_get_prd_stat
    * text
    * -->P_WA_PRD_OBJNR text
    FORM fr_get_prd_stat USING p_objnr CHANGING p_prd_stat.
    DATA: lt_status TYPE STANDARD TABLE OF jstat,
    wa_status TYPE jstat,
    lv_status TYPE tj02t-txt04,
    lv_temp2 TYPE char5,
    lv_buff TYPE string.
    CALL FUNCTION 'STATUS_READ'
    EXPORTING
    client = sy-mandt
    objnr = p_objnr
    only_active = 'X'
    TABLES
    status = lt_status
    EXCEPTIONS
    object_not_found = 1
    OTHERS = 2.
    LOOP AT lt_status INTO wa_status.
    IF wa_status-stat(1) EQ 'I'.
    SELECT txt04 FROM tj02t
    INTO lv_status
    WHERE istat EQ wa_status-stat
    AND spras EQ 'E'.
    ENDSELECT.
    lv_temp2 = lv_status.
    CONCATENATE lv_temp2 p_prd_stat INTO p_prd_stat
    SEPARATED BY ','.
    ENDIF.
    CLEAR: wa_status, lv_status, lv_temp2.
    ENDLOOP.
    lv_buff = p_prd_stat.
    *Status of Production Order
    IF lv_buff CS 'CRTD'.
    p_prd_stat = 'Not Active'.
    ENDIF.
    IF lv_buff CS 'REL'.
    IF lv_buff CS 'GMPS'.
    p_prd_stat = 'Printed In Prod'.
    ELSE.
    p_prd_stat = 'Printed'.
    ENDIF.
    ENDIF.
    IF lv_buff CS 'TECO'.
    p_prd_stat = 'Technically Compt.'.
    ENDIF.
    ENDFORM. " fr_get_prd_stat

Maybe you are looking for

  • Xsql save as dialog appears on Jdev Execution

    Hi i am running RedHat 7.3 with rdbms 9.0.2.1 and Jdev 9.0.3. xsu is running find in command line on Oracle Apache server, i can run the xsql demo ... so far so good in Jdev, when i want to execute the xsql file, i got he save as dialog box :( i noti

  • CSS10500 Load Balancing Multiple Hosts

    Hello, I have a CSS10500 switch and i would like to load balance the connections to a couple of hosts. My setup (roughly) is as follows int e1-RTR1-------->int e2-Host1                  -------->int e3-Host2 and int e5-RTR2------>int e6-Host1        

  • Validation not Working in WBS Element

    Dear Team, I have created a Validation at WBS element level like this:- Prerequisite PROJ-PROFL = 'ZPSSNR' Check PRPS-POSID : 1-6 := PROJ-PSPID : 1-6: Error: WBS ID doesn't start with Project ID My Project ID "SN-001" Now when I tried create 1st Leve

  • Can't open saved pdf file

    How can I re-open a pdf file which I had downloaded and opened, then saved. I get a message "There was an error opening this document. There was a problem reading this document (14)." Richard 4420

  • Number data-type saving problem through PL/SQL

    hi, I am having a field in my table called "amount" with type number(17,3). I am facing some problem while saving the data through pl/sql developer. while i am inserting data like 123456789012.567 its working fine but when I am inserting 123456789012