Ajay
For MB1B it should be 04
I used the same and it is working fine
gmhead-pstng_date = xpost. "sy-datum.
gmhead-doc_date = sy-datum.
gmhead-pr_uname = sy-uname.
gmcode-gm_code = '04'. "04 - MB1B - Transfer Posting
-----------------------------------------------------------------------------------------
For your reference:
---------------------------------------------------------------------------------------------
* GMCODE Table T158G - 01 - MB01 - Goods Receipts for Purchase Order
* 02 - MB31 - Goods Receipts for Prod Order
* 03 - MB1A - Goods Issue
* 04 - MB1B - Transfer Posting
* 05 - MB1C - Enter Other Goods Receipt
* 06 - MB11
*
* Domain: KZBEW - Movement Indicator
* Goods movement w/o reference
* B - Goods movement for purchase order
* F - Goods movement for production order
* L - Goods movement for delivery note
* K - Goods movement for kanban requirement (WM - internal only)
* O - Subsequent adjustment of "material-provided" consumption
* W - Subsequent adjustment of proportion/product unit material