Sitemap

Amicuk Programming Answers

How to check the Production order exits

2015-10-11   Views:1

Advertisement

Hi Experts Modification to processing of Command Orders & Tickets We require a modification to the processing being performed on sales data originating from the Command Concrete system and potentially from other systems yet to come online (e.g. Pinke

Hi Experts
Modification to processing of Command Orders & Tickets
We require a modification to the processing being performed on sales data originating from the Command Concrete system and potentially from other systems yet to come online (e.g. Pinkenba Cement plant).
The Sap process involved is ZINT_INBOUND_POLLING and within that, ZINT_CSTPORD_ROUTINES.
The problem
Currently there is an assumption that every sales order (and its deliveries) will include a product which is made to order, i.e. for which a production order will be required.
In ZINT_CSTPORD_ROUTINES, a check is made to identify the production order linked to the sales order. If there is no such production order (usually because of the customeru2019s credit status) then processing of the ticket is terminated.
This assumption would fall down if an order was to be raised (in Command) on which there is no concrete material. For example, if we sold a bag of pigment or a screed to a customer. In this case the item would be sold from stock and there would be no need for a production order.
The solution
In the routine which checks for the existence of a production order, modify the code as follows:
Inspect each item on the sales order
If (and only if) there is at least one item with a category of u201CZTACu201D then check for a production order, otherwise process the order in the usual manner.
----  ZINT_CSTPORD_ROUTINES -
*&      Form  process_inbound_data
      Create prod. orders from ticket data extracted from the COMMAND
      system. Note that large portions of the code in this routine
      have been copied from the retired ZPPU_COMMAND_PRODUCTION
      interface program. This was done (1) because the old code works
      and (2) to save development time.
     -->T_ZINT_IDATA  Internal table of interface data
     -->T_ZINT_PARAM  Internal table of interface parameters
     -->T_ZINT_MSLOG  Internal table of messages
     -->P_ZINT_ID     Interface ID
     -->P_ZINT_TY     Inteface type
     -->P_ZINT_IS     IDOC group for interface
     -->P_ZINT_DL     Flag: delete IDOC group when complete
     -->P_ZINT_AL     Flag: run in standalone mode
     -->P_ZINT_NW     Flag: do not log warning messages
     -->P_ZINT_SQ     Interface sequence number
     <--P_ZINT_RC     Return code (<>0=>error)
form process_inbound_data  tables   t_zint_idata structure zint_idata
                                    t_zint_param structure zint_param
                                    t_zint_mslog structure zint_mslog
                           using    p_zint_id    type      zint_id
                                    p_zint_ty    type      zint_ty
                                    p_zint_is    type      zint_is
                                    p_zint_dl    type      zint_dl
                                    p_zint_al    type      zint_al
                                    p_zint_nw    type      zint_nw
                                    p_zint_sq    type      zint_sq
                           changing p_zint_rc    type      zint_rc.
program is continuing .............
I WANT TO WRITE A CODING HERE **********************
CHECK IF PRODUCTION ORDER REQUIRED
          IF NOT THEN GO TO PERFORM UPDATE DATA
  if production order required then check
                for each item on sales order item list
                      with item category = 'ZTAC' then
                                 return true
                            next
                              end function
    if there is no production code
           these has to be check from VBAP TABLE field VBELN and PSTYV (ZTAC,ZTAN Etc)
  select * from Vbap WHERE VBELN = '00000269951' and VBAP.PSTYV = 'ZTAC','ZTAN' Etc
No production order?
    elseif lva_prodord is initial.
      clear v_messg.
      call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
        exporting
          input  = lva_filemat
        importing
          output = lva_filemat.
    No production order found - log a warning message.
      concatenate 'Production Order not be found for'
                  'Command order' lva_cmdord
                  'Material'      lva_filemat
                  'Customer'      lwa_02-customer
        into v_messg separated by space.
      perform write_log_entry
        tables t_zint_mslog
        using  'E' 'ZINT_CSTPORD_ROUTINES'
                   'FIND_SAP_PRODORD'
                     v_messg
                     p_zint_nw
                     lwa_01-ticketnumber.                " RJS
      continue.
    endif.
Production Order WAS found... Continue creating IDOCS
    lwa_hdrlevel-postg_date = lwa_01-ticketdate.
Obtain the storage location parameter value.
    read table t_zint_param with key zint_fn = 'LGORT'.
    if sy-subrc ne c_noerr.
      perform write_log_entry
        tables t_zint_mslog
        using  'E' 'ZINT_CSTPORD_ROUTINES'
                   'PROCESS_INBOUND_DATA'
                   'Parameter LGORT is missing from ZINT_PARAM'
                   p_zint_nw
                   lwa_01-ticketnumber.                " RJS
      exit.
    endif.
    loop at l_it_05 into lwa_05
      where ticketnumber = lwa_01-ticketnumber.
      clear lwa_gm_item_create.
      lva_filemat = lwa_05-material.
      if lva_filemat eq lva_prodmat.
        concatenate 'Command ticket-' lwa_05-ticketnumber
          into lwa_hdrlevel-conf_text.
        lwa_hdrlevel-conf_quan_unit = lwa_05-unitofmeasure.
        lwa_hdrlevel-yield          = lwa_05-quantity.
check whether the confirmed value + current delivery value is equal *
the production order qty. If the production order value is less
than the total delivered value, set final conf indicator  and clear
reservations
        lva_wemng = lva_wemng + lwa_05-quantity.
        if lva_wemng < lva_psmng.
          lwa_hdrlevel-clear_res      = c_false.
          lwa_hdrlevel-fin_conf       = ' '.
        else.
          lwa_hdrlevel-clear_res      = c_true.
          lwa_hdrlevel-fin_conf       = 'X'.
        endif.
        move: 'Z1BP_PP_HDRLEVEL' to t_idoc_data-segnam,
              lwa_hdrlevel       to t_idoc_data-sdata.
        append t_idoc_data.
        clear lva_formmat.
        lva_formmat                   = lwa_05-material.
        lwa_gm_item_create-material   = lva_formmat.
        lwa_gm_item_create-plant      = lwa_03-plant.
        lwa_gm_item_create-ref_date   = lwa_01-ticketdate.
        lwa_gm_item_create-prod_date  = lwa_01-ticketdate.
        lwa_gm_item_create-move_type  = '101'.
        lwa_gm_item_create-spec_stock = 'E'.
        lwa_gm_item_create-sales_ord  = lva_saleord.
        lwa_gm_item_create-entry_qnt  = lwa_05-quantity.
        lwa_gm_item_create-entry_uom  = lwa_05-unitofmeasure.
        lwa_gm_item_create-orderid    = lva_prodord.
        lwa_gm_item_create-move_mat   = lva_formmat.
        lwa_gm_item_create-move_plant = lwa_03-plant.
        lwa_gm_item_create-mvt_ind    = 'F'.
        clear t_idoc_data.
        move: 'E1BP2017_GM_ITEM_CREATE' to t_idoc_data-segnam,
              lwa_gm_item_create        to t_idoc_data-sdata.
        append t_idoc_data.
      else.
        clear: lva_loggr,
               lva_formmat.
        lva_formmat = lwa_05-material.
        select single loggr into lva_loggr from marc
          where matnr = lva_formmat
          and   werks = lwa_03-plant.
        if sy-subrc ne 0.
          clear v_messg.
          No logistics handling group - log a warning message.
          concatenate 'No logistics handling group for material'
                       lva_formmat
                      'in plant'
                       lwa_03-plant
            into v_messg separated by space.
          perform write_log_entry
            tables t_ldata
            using 'W' 'ZINT_CSTPORD_ROUTINES'
                      'PROCESS_INBOUND_DATA'
                      v_messg
                      p_zint_nw
                      lwa_01-ticketnumber.                " RJS
          clear lva_loggr.
        endif.
        if lwa_03-satsur eq 'T'.
          lwa_e1edl21-lprio = 30.
        else.
          lwa_e1edl21-lprio = 20.
        endif.
      else.
        if lwa_03-satsur eq 'T'.
          lwa_e1edl21-lprio = 10.
        else.
          lwa_e1edl21-lprio = '  '.
        endif.
      endif.
      lwa_e1edl21-berot = lwa_04-driver.
      move: 'E1EDL21'   to t_idoc_data-segnam,
            lwa_e1edl21 to t_idoc_data-sdata.
      append t_idoc_data.
      lwa_e1edl55-qualf = '001'.
      lwa_e1edl55-refnr = lva_saleord.
      move: 'E1EDL55'   to t_idoc_data-segnam,
            lwa_e1edl55 to t_idoc_data-sdata.
      append t_idoc_data.
Loop at materials - create delivery entry for each
      loop at l_it_05 into lwa_05
        where ticketnumber = lwa_01-ticketnumber.
        clear t_idoc_data.
        lwa_e1edl24-matnr = lwa_05-material.
        lwa_e1edl24-werks = lwa_03-plant.
        lwa_e1edl24-vfdat = lwa_01-ticketdate.
        lwa_e1edl24-lfimg = lwa_05-quantity.
        lwa_e1edl24-vrkme = lwa_05-unitofmeasure.
        lwa_e1edl24-lgort = t_zint_param-zint_fv.
        clear lva_loggr.
        lva_formmat = lwa_05-material.
        clear lva_loggr.
        select single loggr into lva_loggr from marc
          where matnr = lva_formmat
          and   werks = lwa_03-plant.
        if sy-subrc ne 0.
        No logistics handling group - log a warning message.
          concatenate 'No logistics handling group for material'
                       lva_formmat
                      'in plant'
                       lwa_03-plant
            into v_messg separated by space.
          perform write_log_entry
            tables t_ldata
            using 'W' 'ZINT_CSTPORD_ROUTINES'
                      'PROCESS_INBOUND_DATA'
                      v_messg
                      p_zint_nw
                      lwa_01-ticketnumber.                " RJS
          lva_loggr = 'BBIN'.
        endif.
        if lva_loggr is initial.
          move: 'E1EDL24'   to t_idoc_data-segnam,
                lwa_e1edl24 to t_idoc_data-sdata.
          append t_idoc_data.
        endif.
      endloop.
      clear: lva_xabln,
             lva_vbeln,
             l_vbfa.
Matching ticket against a Delivery?
      select single xabln vbeln into (lva_xabln,lva_vbeln) from likp
          where xabln = lwa_01-ticketnumber.
      if sy-subrc = 0.
If found, does this delivery match the sales order?
        select * from vbfa into l_vbfa
          where vbelv = lva_saleord
          and   vbeln = lva_vbeln.
          exit.
        endselect.
      endif.
No matching delivery found, or Matching delivery, but for other Sls Ord
      if lva_xabln is initial
      or ( lva_vbeln <> space and l_vbfa is initial ).
        if not lva_saleord is initial.
          perform create_delivery_idocs tables t_zint_mslog
                                        using  s_idcgp
                                               lwa_01-ticketnumber
                                               p_zint_nw.
        else.
          concatenate 'Error finding a Sales Order for ticket "'
                      lwa_01-ticketnumber
                      '" reprocess the file AFTER'
                      ' the sales order issues have been fixed'
          into        lva_outtext.
          perform write_log_entry tables t_zint_mslog
                                  using  'E'
                                         'ZINT_CSTPORD_ROUTINES'
                                         'PROCESS_INBOUND_DATA'
                                         lva_outtext
                                         p_zint_nw
                                         lwa_01-ticketnumber. " RJS
        endif.
      else.
        concatenate 'Command Ticket "'
                    lwa_01-ticketnumber
                    '" has already been processed into delivery "'
                    lva_vbeln
        into        lva_outtext.
        perform write_log_entry tables t_zint_mslog
                                using  'I'
                                       'ZINT_CSTPORD_ROUTINES'
                                       'PROCESS_INBOUND_DATA'
                                       lva_outtext
                                       p_zint_nw
                                       lwa_01-ticketnumber. " RJS
        refresh t_idoc_data.
      endif.
    endif.
    refresh t_idoc_data.
Write out all messages collected so far
    perform update_data tables t_zint_mslog
                        using p_zint_id p_zint_ty.
  endloop.
Write out all messages collected so far
  perform update_data tables t_zint_mslog
                      using p_zint_id p_zint_ty.
endform.                    " process_inbound_data
Thnaks
Regards

The replay answer
Advertisement
Thanks
Thread closed

Go to See the other 2 answers

How to check the Production order exits

Category:DefaultRelease time:2015-10-11Views:130

Hi Experts Modification to processing of Command Orders & Tickets We require a modification to the processing being performed on sales data originating from the Command Concrete system and potentially from other systems yet to come online (e.g. Pinke[More]

Authorization check for production order settlement

Category:DefaultRelease time:-0001-11-30Views:130

Hi All, Production order settlement currently can be done by any user of any company code. there is a high risk involved in the same since unauthorized postings may happen. Hence we need to add authorization check for production order settlement. Can[More]

Check for Production Order

Category:DefaultRelease time:-0001-11-30Views:130

Hi experts i want to put a check while Production order creation such that without Standard cost estimate(costing),It should not allow to create Production order. Regards Sandeep Patilhi What venki has told abt the exit, its absolutely correct.Even i[More]

Material availability  check for production order

Category:DefaultRelease time:-0001-11-30Views:130

Hello, Is there any functional module to check the material availability of production order. So that it can be used in developments. Regards, GaneshHi, Following are the available Function Modules for avaibility checks in Production orders, BAPI_PRO[More]

PRT availaibility check in production order.

Category:DefaultRelease time:-0001-11-30Views:130

Hi I have created PRT of type M and attached to operation and when i try do availaibility check in production order then iam getting message "PRT availability could not be checked" What are pre-requisite for getting PRT availability check? Is it[More]

Availbility check in production order

Category:DefaultRelease time:-0001-11-30Views:130

Hi Friends We need to have the availbility check in production order , where we need to exclude some of the storage locations stock & include some of the storage locations stock How we can achive this In Customising , either it says to take all the s[More]

Reg: Error in availability check in production order

Category:DefaultRelease time:-0001-11-30Views:130

Dear all, I am facing a problem during availability check. After creation of production order, when i am clicking 'Materials' it is showing a error message as 'Incorrect check'. When i click log, the error msg is "Order type xxxx, plant xxxx: Checkin[More]

Collective ATP check for production orders

Category:DefaultRelease time:-0001-11-30Views:130

Hi Gurus, I tried the MDVP tcode, but I can only do the collective ATP check for planned orders. we wanted to do the collective check with production orders, can you tell me how I can do this? Thanks.I've posted this question but didn't get any respo[More]

I need Checking in Production Order Qty

Category:DefaultRelease time:-0001-11-30Views:130

Hi all, In our industry we are creating Production Order From Sales Order (MTO Scenario) by using T.Code CO08 or CO01 T.Code with out running MRP.Now if anybody intend to change the PO qty by using CO02 T.Code system allows and as a result the Sales[More]

Check in Production order qty with ref to Planned order

Category:DefaultRelease time:-0001-11-30Views:130

Dear all, Please suggest me, when i am creating a productin order with ref to planned order , so the order qty should not exceed the planned order qty. How can i control this , please give ur valuable inputs on the same. regards Ravi AroraDear If you[More]

GR quantity check against Production Order in MB31

Category:DefaultRelease time:-0001-11-30Views:130

Hi Experts, How to check GR quantity against Production Order (101) can not be greater than Confirmation quantity for the Production Order in MB31. Regards, Praful MankarHi Praful, Use user exit MBCF0002, here put condation that check AFEU table (con[More]

Hot
Hello Experts, I'm running an App-V 5.0 SP1 Management Server and Publishing Server on Server 2012 R2. My Sequencer and Client are App-V 5.0 SP2 from the current MDOP 2013 R2. The target systems are all running TrendMicro Antivirus, but I'm not sure, [More]
I've been using this with full sucess since July but my headset will only listen to music now.  If i try to make a call it ignores the headset and works on handset, reverting to headset for music when the call is over!  I have a spare controller and [More]
Default Settings for a WCF Service Application are stored in the web.config file and are Read Only because only Application settings are allowed i.e. you cannot change the Scope from "Application" to "User" in the settings designer lik [More]
Hi guys From the outset Im letting you know that Im no computer expert or wizz. Im just a guy trying to keep up to date. And after reading all this IM starting to feel really dumb. Anyways im in a world of bother and its been driving me mad for the l [More]
I am attempting to write an application that in part will control an Anritsu MP1570A Sonet Analyzer. This instrument departs from the IEEE standard in that it requires tx or rx messages to be terminated with a carriage return <\n>. In the custom pro [More]
Hi, Can somebody help me please? My program goes like this: I'm creating a program wherein there are two TextArea, left and right, and a button. The role of the left TextArea is where I will type a Java code (what i mean is a class). After typing, th [More]
I am running Mac 10.5.8 with the most recent version of Firefox and am unable to install Adobe Flash Player. I have tried uninstalling the previous versions of flash and have even used the Adobe Flash Uninstaller tool for mac to make sure everything [More]
Dear Friends, I want to create sales order using BSP. For that there is an bapi called BAPI_SALES_CREATEFROMDAT2. I have two ways to do that. 1. I will create all the required structure on the BW system and then i can call the bapi. 2. I will create [More]
Hello All, I am unable to view the logs and Traces , When I am accessing it through NWA for example http: <server>:<port>\nwa ...... In Monitoring --> Logs and Traces --> when I select Default Trace , Its asks me for the setting up the d [More]
Hi my friends I have nokia n96 (RM-247) not branded and I experienced some problems after I install the new firmware 30.033. When I connect the phone in mass storage mode I am receiving the following message: Exception Processing Message c0000013 Par [More]