Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function module to create Post Goods Issue

Former Member
0 Likes
8,037

Hi Friends,

Pls,Give me the Function module or BAPI To create Post Goods Issue for Delivery Order Number...........My requirment is to display error message during creation of PGI. because .using BDC of VL02N not able to display error message

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,468

HI Friend,

Check this function module:

BAPI_GOODSMVT_CREATE

Hope this helps you.

Regards,

Chandra Sekhar

7 REPLIES 7
Read only

Former Member
0 Likes
3,469

HI Friend,

Check this function module:

BAPI_GOODSMVT_CREATE

Hope this helps you.

Regards,

Chandra Sekhar

Read only

Former Member
0 Likes
3,468
Read only

0 Likes
3,468

I hv done BDC for VL02N but that BDC not capturing error message...........so pls,let me know how to achieve that.......

Read only

0 Likes
3,468

Hi,

Why???

We can capture error messages. Check below code. I am able to capture errors here. Also the error u r going to capture is generic or specific?

Any ways what ever messages u get while in BDC all those will be populated in messages table.


  CLEAR w_lfimg.
  MOVE po_lfimg TO w_lfimg.
  CONDENSE w_lfimg.

  REFRESH: i_bdcdata[], i_bdcmsgcoll[].
  PERFORM: bdc_screen USING 'SAPMV50A'   '4004',
           bdc_data   USING 'BDC_OKCODE' '/00',
           bdc_data   USING 'LIKP-VBELN' po_vbeln,  "Delivery
           bdc_screen USING 'SAPMV50A'   '1000',
           bdc_data   USING 'BDC_OKCODE' '=T\02',
           bdc_screen USING 'SAPMV50A'   '1000',
           bdc_data   USING 'BDC_OKCODE' '=WABU_T',
           bdc_data   USING 'BDC_SUBSCR'
          'SAPMV50A                                1104SUBSCREEN_BODY',
           bdc_data   USING 'LIPSD-G_LFIMG(01)' w_lfimg, "Quantity
           bdc_data   USING 'LIPSD-PIKMG(01)'   w_lfimg. "Quantity


  CALL TRANSACTION c_vl02n
       USING       i_bdcdata
       MODE        w_mode
       UPDATE      c_s
       MESSAGES INTO i_bdcmsgcoll.

  CLEAR   wa_bdcmsgcoll.
  REFRESH i_msg[].
  LOOP AT i_bdcmsgcoll INTO  wa_bdcmsgcoll
                       WHERE msgtyp EQ c_e
                       OR    msgtyp EQ c_a.
    MOVE   wa_bdcmsgcoll-msgv1 TO wa_msg-message.
    APPEND wa_msg TO i_msg.
    EXIT.
  ENDLOOP.

Here i will always have one line item. Thats why hardcoding the quantity field to *'LIPSD-G_LFIMG(01)' *

U can copy this code and at the place of populating the quantity u can put a logic to populate the quantity for multiple line items.

U can also try BAPI BAPI_GOODSMVT_CREATE.

Check the FM documentation to know how to use. It is clearly explained.

Hope it will be helpful.

Thanks,

Vinod.

Edited by: Vinod Reddy Vemuru on Jul 7, 2008 5:59 PM

Read only

0 Likes
3,468

hi vinod,

thnks for the reply......i m also using the same code as u mentioned.........

But when there is message like.......

oldest item overdue.....credit block..........that kind of error i m not able to capture.....

Read only

0 Likes
3,468

Hi,

Generally we will get this message when we create sales order it self. Order will be created and goes to block status so that delivery can't be created. Once delivery is created then only we can do GI. This means Order is already released from credit block from transaction VKM3.

So we wont be getting this message while doing GI. Please check and reconfirm.

Also that message is just information, But not error.

Please correct me if i am wrong.

Also u can very well use BAPI_GOODSMVT_CREATE. Check FM documentation for usage. It is pretty clear.

Thanks,

Vinod.

Read only

Former Member
0 Likes
3,468

  DATA: l_vbkok_wa   TYPE vbkok,
        l_i_prott    TYPE STANDARD TABLE OF prott,
        l_pgi_status TYPE xfeld,
        l_str1       TYPE string,
        l_str2       TYPE string,
        l_str3       TYPE string.

* Populating work area for Confirming Picking Data from Delivery Header
  l_vbkok_wa-vbeln_vl = delivery_no.
  l_vbkok_wa-vbtyp_vl = 'J'.
  l_vbkok_wa-vbeln    = order_no.
  l_vbkok_wa-wabuc    = c_check.

* Create Goods Issue
  CALL FUNCTION 'WS_DELIVERY_UPDATE'
    EXPORTING
      vbkok_wa                  = l_vbkok_wa
      synchron                  = c_check
      commit                    = c_check
      delivery                  = l_vbkok_wa-vbeln_vl
      if_database_update        = '1'
      if_error_messages_send_0  = c_check
    IMPORTING
      ef_error_in_goods_issue_0 = l_pgi_status
    TABLES
      prot                      = l_i_prott.

  IF l_pgi_status IS NOT INITIAL.
    wa_ret_order-zzstat_tcode2 = 'E'.
    l_str1 = 'PGI not done for delivery no : '.
    l_str2 = delivery_no.
    PERFORM sub_send_mail USING l_str1 l_str2 l_str3.
  ELSE.
    wa_ret_order-zzstat_tcode2 = 'S'.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait = c_check.
  ENDIF.