BDC for MIGO for GR OutBound Delivery( A01 & R05 ) from Movement Type 107 to 109

Hi,
I am stuck with a very typical situation need all your expertise and advices for a solution.
We are basically trying to create change the movement type from 107 to 109 through MIGO.
I have made a BDC recording for MIGO ( because we would like to track each delivery specifically under shipment , I know that there is a BAPI which is there to do this but it works fine if we do the shipment with Purchase Order as input which dont want in that manner )
Process:
1. Creating Production Order
2. Creating Purchase Order
3. Creating STO
4. Deliveries
5. PGI for Deliveries
6. Shipment for group of outbound Deliveries
I have created a z program where i am passing shipment number in the selection screen.
Then it would take all the deliveries for that shipment and pass each delivery to MIGO and process it and change the status from 107 to 109.
Interesting part here is, the code works absolutely perfect only from my ID. But when I test from other ID it is not executing, so to check where is the problem I have added mess_tab to the CALL TRANSACTION to capture what message is been populated for my ID comparing with others
Message Captured on Others ID's:
MSGID: 00
MSGNR: 344
MSGV1: SAPLMIGO
MSGV2: 1300
Message Captured on MY ID:
MSGID: MIGO
MSGNR: 012
MSGV1: 5000005802
MSGV2: (empty)
This is the problem this program is executing only on MY ID, rest all ID's it is not processing.
We have cross verified with security and basis regarding any authorization issues but nothing came up.
Please help me what could be the issue ( WHY it is processing successfully for my and WHY NOT for other ID's)
Below is the main code :
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'                     " Converting Date format to DD/MM/YYYY
     EXPORTING
       DATE_INTERNAL            = sy-datum
     IMPORTING
       DATE_EXTERNAL            = lv_date_external
     EXCEPTIONS
       DATE_INTERNAL_IS_INVALID = 1
       OTHERS                   = 2.
       IF SY-SUBRC <> 0.                                     "#EC NEEDED
* Implement suitable error handling here
       ENDIF.
*   Validating input shipment number with database table VTTP
       SELECT VTTP~TKNUM
              VTTP~TPNUM
              VTTP~VBELN
         FROM VTTP INNER JOIN VTTK
         ON VTTP~TKNUM = VTTK~TKNUM
         INTO TABLE IT_VTTP
         WHERE VTTK~TKNUM = P_TKNUM
           AND VTTK~STDIS = 'X'.
       IF sy-subrc = 0.
*   Validating all deliveries having same Delivery type or not
         SELECT * FROM likp INTO TABLE it_likp FOR ALL ENTRIES IN it_vttp WHERE vbeln = it_vttp-vbeln
                                                                            AND vbtyp = 'J'.
         IF sy-subrc = 0.
           CLEAR lv_lines.
           LOOP AT it_likp INTO wa_likp.
             REFRESH:it_vbfa,BDCDATA.
*   Validating if Delivery Type = 109 (GR already done), or Delivery Type = 107 (must process for GR )
             SELECT * FROM vbfa INTO TABLE it_vbfa WHERE vbelv = wa_likp-vbeln
*                                                AND vbtyp_v = 'J'
                                                     AND bwart = '109'.
             IF sy-subrc = 0.
               lv_flag1 = 'X'.
             ELSE.
               SELECT * FROM vbfa INTO TABLE it_vbfa WHERE vbelv = wa_likp-vbeln
*                                                  AND vbtyp_v = 'J'
                                                       AND bwart = '107'.
               IF sy-subrc NE 0.
                 MESSAGE 'No Deliveries with Movement Type "107" ' TYPE 'I'.
               ELSE.
                 lv_flag2 = 'X'.
                 lv_lines = lv_lines + 1.
**  BDC for MIGO
                 perform bdc_dynpro      using 'SAPLMIGO' '0001'.
                 perform bdc_field       using 'BDC_OKCODE'
                                               '=OK_GO'.
                 perform bdc_field       using 'GODYNPRO-ACTION'
                                               'A01'.
                 perform bdc_field       using 'GODYNPRO-REFDOC'
                                               'R05'.
                 perform bdc_field       using 'GODEFAULT_TV-BWART'
                                               '109'.
                 perform bdc_field       using 'BDC_CURSOR'
                                               'GODYNPRO-OUTBOUND_DELIVERY'.
                 perform bdc_field       using 'GODYNPRO-OUTBOUND_DELIVERY'
                                               wa_likp-vbeln. "'80019574'.
                 perform bdc_field       using 'GOHEAD-BLDAT'
                                               lv_date_external. "'04/29/2015'.
                 perform bdc_field       using 'GOHEAD-BUDAT'
                                               lv_date_external. "'04/29/2015'.
                 perform bdc_field       using 'GOHEAD-WEVER'
                                               '1'.
                 perform bdc_dynpro      using 'SAPLMIGO' '0001'.
                 perform bdc_field       using 'BDC_OKCODE'
                                               '=OK_POST1'.
                 perform bdc_field       using 'GODEFAULT_TV-BWART'
                                               '109'.
                 perform bdc_field       using 'GOHEAD-BLDAT'
                                               lv_date_external. "'04/29/2015'.
                 perform bdc_field       using 'GOHEAD-LFSNR'
                                               wa_likp-vbeln. "'0080019574'.
                 perform bdc_field       using 'GOHEAD-BUDAT'
                                               lv_date_external. "'04/29/2015'.
                 perform bdc_field       using 'GOHEAD-WEVER'
                                               '1'.
                 perform bdc_field       using 'GODYNPRO-DETAIL_ZEILE'
                                               '   1'.
                 perform bdc_field       using 'GOITEM-ERFME'
                                               'EA'.
                 perform bdc_field       using 'GOITEM-ERFMG'
                                               '1'.
                 perform bdc_field       using 'GOITEM-LSMNG'
                                               '1'.
                 perform bdc_field       using 'GOITEM-LSMEH'
                                               'EA'.
                 perform bdc_field       using 'GOITEM-MIGO_ELIKZ'
                                               '1'.
                 perform bdc_field       using 'GOITEM-BWART'
                                               '109'.
                 perform bdc_field       using 'GOITEM-LGOBE'
                                               'RX Cross-docking'.
                 perform bdc_field       using 'BDC_CURSOR'
                                               'GODYNPRO-DETAIL_TAKE'.
                 perform bdc_field       using 'GODYNPRO-DETAIL_TAKE'
                                               'X'.
                 PERFORM bdc_dynpro      USING 'SAPLMIGO' '1300'.
                 PERFORM bdc_field       USING 'BDC_CURSOR'
                                               'G_TIP_DONT_SHOW_AGAIN'.
                 PERFORM bdc_field       USING 'BDC_OKCODE'
                                               '=OK_TIP_GO'.
                 PERFORM bdc_field       USING 'G_TIP_DONT_SHOW_AGAIN'
                                               'X'.
*& Avoid unncessary screens to populate while processing background.
                 LV_OPTIONS-DISMODE = 'N'.
                 LV_OPTIONS-UPDMODE = 'S'.
                 LV_OPTIONS-NOBINPT = 'X'.
                 CALL TRANSACTION 'MIGO' USING BDCDATA  OPTIONS FROM LV_OPTIONS MESSAGES INTO IT_MESSTAB1 .
                 WAIT UP TO 1 SECONDS.
                 DELETE IT_MESSTAB1 WHERE MSGTYP NE 'E'.
                 IF IT_MESSTAB1[] IS NOT INITIAL.
                   APPEND LINES OF IT_MESSTAB1 TO IT_MESSTAB.
                 ENDIF.
               ENDIF.
             ENDIF.
           ENDLOOP.
         ENDIF.
       ELSE.
         MESSAGE 'Shipment Number does not exists Or not Planned' TYPE 'E'.
       ENDIF.
     ELSE.
       MESSAGE 'Please insert Shipment Number' TYPE 'E'.
     ENDIF.
     IF lv_flag1 = 'X' AND lv_flag2 = 'X'.
       MESSAGE 'This shipment is processed with an inconsistent goods receipt' TYPE 'I'.
     ELSEIF lv_flag1 = 'X'.
       MESSAGE 'Shipment already been processed for these deliveries' TYPE 'I'.
     ELSEIF lv_flag2 = 'X'.
       lv_lines1 = lv_lines.
       CONDENSE lv_lines1 NO-GAPS .
       CONCATENATE lv_lines1 'Goods Receipt are posted for the shipment '
              INTO lv_message SEPARATED BY space.
       MESSAGE  lv_message TYPE 'I'.
     ENDIF.
* Display Messages from Message TAB.
     DELETE ADJACENT DUPLICATES FROM IT_MESSTAB.
     DATA:lv_msg TYPE string.
     LOOP AT IT_MESSTAB INTO WA_MESSTAB.
       CALL FUNCTION 'FORMAT_MESSAGE'
         EXPORTING
           ID        = WA_MESSTAB-MSGID
           NO        = WA_MESSTAB-MSGNR
           V1        = WA_MESSTAB-MSGV1
           V2        = WA_MESSTAB-MSGV2
           V3        = WA_MESSTAB-MSGV3
           V4        = WA_MESSTAB-MSGV4
         IMPORTING
           MSG       = lv_msg
         EXCEPTIONS
           NOT_FOUND = 1
           OTHERS    = 2.
       IF sy-subrc <> 0.
* Implement suitable error handling here
       ENDIF.
       WRITE:/ lv_msg.
     ENDLOOP.
*        Start new screen                                              *
   FORM BDC_DYNPRO USING PROGRAM DYNPRO.                 "#EC PF_NO_TYPE
     CLEAR BDCDATA.
     BDCDATA-PROGRAM  = PROGRAM.
     BDCDATA-DYNPRO   = DYNPRO.
     BDCDATA-DYNBEGIN = 'X'.
     APPEND BDCDATA.
   ENDFORM.
*        Insert field                                                  *
   FORM BDC_FIELD USING FNAM FVAL.                       "#EC PF_NO_TYPE
     CLEAR BDCDATA.
     BDCDATA-FNAM = FNAM.
     BDCDATA-FVAL = FVAL.
     APPEND BDCDATA.
   ENDFORM.
Thanks,
Srini

Hi Rob,
Thanks for quick reply.
I have checked the NOTE : 304122
But there in the NOTE it says ( " BAPI, BAPI_GOODSMVT_CANCEL, BAPI_GOODSMVT_CREATE, CNTL_ERROR" )
These BAPI's work perfectly for (purchase order as input type), but here out type is ( A01 & R05 ) we are giving DELIVERY NUMBER as input to MIGO.
So for this scenario we cannot use those BAPI's mentioned in the NOTE.
Also as stated earlier in the message interesting part is
"The code works absolutely perfect only from my ID. But when I test from other ID it is not executing. Code is working exactly as expected ONLY to my ID. When i try to execute the same code from another's ID it is not working"
So what do you think might be the issue?

Similar Messages

  • MIGO : How to identify post is for Goods Recipt of outbound delivery.

    Hi,
    I am working with MIGO Transaction,
    My requirement is that while posting the Goods recipt with outbound delivery, If Movement type is not eqaul to 861, display a msg to change movemnet type to 861.
    for this requirement I am using the BADI
    MB_DOCUMENT_BADI - >  MB_DOCUMENT_BEFORE_UPDATE  .
    My Querry is that How can I Identify that the posting is for Goods reciept with outbound delivery.
    thr r three importing parameter for the BADI
    MSEG
    MKPK
    & vm07m.
    I try mkpf-tcode2 field.
    but for both  goods recipt and cancellation , the value of this field is MIGO_GR.
    Please help me regarding identification of the same.

    Hi,
      Goods Receipt normally gets stored in MKPF & MSEG tables..
    Regards
    Kiran Sure

  • Print GR slip for GR against an Outbound Delivery

    Dear Experts,
    I have a requirement as below.
    Need to print GR slip for GR against an Outbound Delivery in VL02N (for Return Orders)
    What setting needs to be done?
    I donot see the GR slip check box in VL02N which normally exists in MIGO
    However, i need to print GR slip for such GRs in VL02N
    please help
    regards,
    Shetty

    Re: Printout during Goods Receipt
    See second, fourth reply and final post (which you've already found answer to via another thread).
    Regards,
    Nick

  • Different movement types for goods issue via outbound delivery

    Hi gurus,
    How can I use different movement types for goods issue via outbound delivery?
    Thanks&Best Regards,
    Burcu

    To use different schedule lines, we need different item types and different document types. Is that right?
    Is there a user exit in outbound delivery to post goods issue?
    Thanks...

  • Bapi to be used  for delivering data of outbound delivery to LDL

    Hi,
    I am new to ABAP development and I need to do some enhancements for standard bapi BAPI_OUTB_DELIVERY_SAVEREPLICA .
    I have to use bapi for delivering data of outbound delivery to LDL.
    I have created segments with additional fields for order header and item header in we31.
    The additional fields should be implemented in created segments.After creating segments the additional fields data should be assigned to Idoc structure OBDLV.
    This is the requirement I need to deliver  by tomorrow.Please help me by providing step by step procedure and how to do?
    Thanks in advance
    Raj

    Dear Venkat,
    for cancelling GI/GR you may use BAPI_GOODSMVT_CREATE with GM_Code 06
    for cancelling confirmations you may use BAPI_PRODORDCONF_CANCEL
    Regards, Andreas

  • Output Print for MIGO movement type-107.

    Hi All kindly help me in resolving the following issues:-
    There is the requirement of printing RF Label while saving the GR from PO in movement type-107.
    Help me to configure the output type in this case.
    How the data flows from MIGO transaction to the ABAP program and finally to the printer ?
    How to link the output type to the transaction MIGO and so in movement type-107 ?

    Hi,
    go to spro-Materials Management-Inventory Management and Physical Inventory-General Settings.
    in General Settings print version migo is 2 .execute after Maintain Print Indicator for Goods Receipt Documents check 107 mvt type.
    refer the below link
    Print material document (WE02) automatic when GR
    Regards
    Raj.

  • BADI for MIGO for restricting User to entered other MVT types?

    Hi All,
    BADI for MIGO for restricting User to entered other MVT types?
    I want to restrict some of user not to use 501 Movement type ..I already created a Ztable for checking User for 501 type.
    Please let me know any Enhancement to be used to restrict user ?
    Thanks and Regards
    Steve

    Hi Steave,
    You can use this enhancement exit MB_CF001, this exit will be called every time before posting, you can use your logic in this exit. see its documentation first before implementing.
    Regards
    Ahsan

  • Create Outbound delivery with QCI from Sale order

    Dear experts!
    Now, I'm getting some issues about searching function to create outbound delivery with QCI from Sale order.
    Note: My sale order have two item (10, 20) and when i create outbound delivery I also want to create QCI for them.
    Help me, Please
    Best regards, Huy.

    What is QCI?

  • MIRO should not happen for Movement Type 107

    Dear All,
    We have a peculiar scenario/requirement fulfilled by business and we have done almost all but getting stuck in below area:
    We have developed a output type in order to automatically post Mat Doc with Movement Type 107 once the user reverses Material Document with Mvt Type 103, This as per a business requirement. That means when 104 will be done for a Mat Doc with Mvt Type 103, "PO History Tab" will display in following order:
    103 > 104 > 107
    After 107, user will reverse it with Mvt Type 108 and specific G/L accounts will be hit which will update the "PO History" as:
    103 > 104 > 107 > 108
    Now issue is we want MIRO to be possible for Mvt Type 108, not for Mvt Type 107 else it will create a vendor liability twice and business will end up paying amount to vendor twice.
    How can this be achieved?
    Your sound suggestions are most welcome.
    Regards
    Samier Danish

    No replies
    Regards
    Samier Danish

  • What is the need for movement type 107

    Hi Gurus,
    In ECC 6.0 i have seen that SAP has introduced 107 for GR Block stock (valuated). Can anyone tell me the business sense for doing so.
    What was the exact need for introducing 107
    Rgds
    Venkat

    Hi,
    GR Blocked valuatedstock menas , when you do the GR with movement type 107 it  will posted under Plant and the value of the goods will be considerd/increased for that Plant. But the stock will be under Blocked Stock..It will not be used all other purpose till you do the transfer psting from Blocked to unresticted.
    Thanks,
    Kumar Arcot

  • Zero stock available for material while doing outbound delivery

    Hi ,
    System gives error "0 pc of material XXX avaialble" Message no VL150 when we are doing outbound delivery for sales order. But MMBE & MB52 reports shows sales order stock for the same material. This is happening for particular material but the other material which is having same sttings in material masters & sales order & for the same plant is not having problem & OD has been created.
    We are getting this error whiel posting very first outbound delivery for sales order.
    Help to resolve thsi will be appreciated.
    Regards
    Basavaraj Patil

    Hi,
    Run MD04 for the XXX material and ensure there is no other open sales order / Stock transfer orders.
    If appearing, delete it,  if its not applicable and try creating out bound delivery..
    Check if any safety stock is maintained for the said materials in the MRP view at the plant level, you might get similar error message, pl check.
    Regards
    Merwyn

  • Output type not created for outbound delivery while using SHMNT05 idoc type

    Hi Experts,
    Please help me to solve the below issue.
    Problem:- I want to to generate an IDOC(using type SHPMNT06) once the PGI is done for an outbound delivery.
    Already it is working fine when used DESADV.DESADV01 or DESADV.DELVRY07. But now the output type is not getting created when used SHMNT.SHPMNT06. I have created a separate output type ZPJ7 just as a mirror copy of the earlier output type(ZPJ6) used for DESADV.DELVRY07.
    Question:- Is it possible to use idoc SHPMNT06 instead for DESADV01 or DELVRY07? If yes then what are steps to be followed?
    The reason why SHPMNT06 idoc is planned:- We have a scenario to send outbound delivery to 3rd party system via XI. If the outbound delivery is for National(Not for Export) and PGI is completed then send the idoc straight forward to XI otherwise DO NOT generate the idoc, but just create the delivery. Collect all the deliveries in a transport and send it in a shipment. The shipment details can be sent using SHPMNT idoc. Now from XI perspective, if we can utlitze the same SHPMNT idoc for the National delivery(1st case) then perhaps this will require less effort. Hence shipment idoc is required to be generated when the delivery is created and PGI is done.
    Also it would be great if you can advice some better way to solve above mentioned scenario.
    Many Thanks,
    Sanjay

    There could be several reasons. Go to the document and in the extras-output check output determination analysis in the processing log.
    If the output has been created successfully then you need to see your printer determination. Ask basis to check it up. If the problem is that even the print preview is not coming. Check your communication in the output analysis and ensure LOCL is selected. Any other printer will need to be configured.
    If thats done already then check whether you have maintianed the condition record.
    If that too is done then check whether your output type has been assigned to the output procedure and that the output type is listed in the procedure.
    regds
    Jude

  • Issuing consignment stock for sub contracting against outbound delivery wm

    HI
    I have a outbound delivery created against subcontracting PO for issuing the components, i have stock determination turned ON so during picking against the outbound delivery i am able to pick K stock and own stock too(based on availability) but when i do PGI i get an error message You have not entered a value in field "Owner of stock" although an entry in this field is mandatory. message M7018, please share your thoughts whether is it possible to issue K stock for subcontracting PO if so how it can be achieved
    Thanks
    Terry

    Consignment Stock is not valuated stock of the system. Issuing a Material from K stock to Subcon means, you need to pay to vendor for the material through MRKO settlement.
    This message is because of the reason for MRKO. System should be updated with " whose stock are you using"
    Please enter the vendor number on that field, depend on which MRKO is done.
    Raghavan

  • BAPI for Getting details of outbound delivery or VL03N

    Hi,
    Can any one tell me whether there is a BAPI for display of outbound delivery.
    Can any one help me?
    thanks.

    Hi,
    Why do you need BAPI for displaying the delivery?
    Below 2 lines of code is enough.
    SET PARAMETER ID 'VL' FIELD 'delivery number'.
    CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
    Thanks,
    Vinod.

  • User Exit for MIGO for  batch

    Hi expert
    I am looking for user exits .at the time of migo when batch is generated into want the batch field to get grey, so the end user wont able to change the Batch no. and i want the grey field to be done for certain material. like ROH
    Can anyone of you suggest me a more appropriate User exit to work on. Please dont give me a list of user exits out there for migo as I have seen all those in Different threads.
    Thank You.
    Nabil

    Check with your ABAP person for BAdI MB_DOCUMENT_BADI ...here use the logic that system will check the MATNR...then for those MATNR their individual MTAT & if found MTAT = ROH then the CHARG field will be disabled.
    Also through the same logic check whether exit MBCFC003 can be used.
    Regards,
    Indranil
    Edited by: INDRANIL BHATTACHARYYA on Oct 1, 2010 9:49 AM

Maybe you are looking for