Application Development 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: 

Regarding PGI (vl01) and billing document (vf01)

Former Member
0 Kudos
208

Hi experts!

is there any bapi or function module availble to do PGI (POST GOODS ISSUE) and to create Billing Document (invoicing).

Thanks in advance

1 ACCEPTED SOLUTION

Former Member
0 Kudos
121

Hi use below FM

WS_DELIVERY_UPDATE or 'WS_DELIVERY_UPDATE'_2 to create PGI and update delivery

sample code below.

CALL FUNCTION 'WS_DELIVERY_UPDATE'

EXPORTING

VBKOK_WA = I_VBKOK

SYNCHRON = 'X'

NO_MESSAGES_UPDATE = ' '

UPDATE_PICKING = 'X'

COMMIT = ' '

DELIVERY =

NICHT_SPERREN = 'X'

IF_ERROR_MESSAGES_SEND_0 = 'X'

TABLES

PROT = I_PROTT

EXCEPTIONS

ERROR_MESSAGE = 1

OTHERS = 2.

IF SY-SUBRC 0.

ROLLBACK WORK.

ELSE.

COMMIT WORK.

ENDIF.

and to create invoice use fm RV_INVOICE_CREATE.

for these FM check where used list you will get an idea about what parameter to be passed to these fm

Thanks,

Pavan

4 REPLIES 4

Former Member
0 Kudos
121

You can use the BAPI - BAPI_BILLING_DOCUMENT_CREATEMULTIPLE for billing document create.

You can try with the BAPI - BAPI_GOODSMVT_CREATE for the post goods issue.

Thanks,

Srinivas

Former Member
0 Kudos
122

Hi use below FM

WS_DELIVERY_UPDATE or 'WS_DELIVERY_UPDATE'_2 to create PGI and update delivery

sample code below.

CALL FUNCTION 'WS_DELIVERY_UPDATE'

EXPORTING

VBKOK_WA = I_VBKOK

SYNCHRON = 'X'

NO_MESSAGES_UPDATE = ' '

UPDATE_PICKING = 'X'

COMMIT = ' '

DELIVERY =

NICHT_SPERREN = 'X'

IF_ERROR_MESSAGES_SEND_0 = 'X'

TABLES

PROT = I_PROTT

EXCEPTIONS

ERROR_MESSAGE = 1

OTHERS = 2.

IF SY-SUBRC 0.

ROLLBACK WORK.

ELSE.

COMMIT WORK.

ENDIF.

and to create invoice use fm RV_INVOICE_CREATE.

for these FM check where used list you will get an idea about what parameter to be passed to these fm

Thanks,

Pavan

0 Kudos
121

hi pavan,

after doing the PGI i want to catch the material document number for that Post Goods Issued delivey order , how can i catch the material document number plz help me....,

jana

0 Kudos
121

Hi jana!

use this to catch md number.

CALL FUNCTION 'WS_DELIVERY_UPDATE'

EXPORTING

VBKOK_WA = LS_VBKOK

SYNCHRON = 'X'

COMMIT = 'X'

  • IF_GET_DELIVERY_BUFFERED = 'X'

DELIVERY = ITAB_HEAD-VGBEL

UPDATE_PICKING = 'X'

NICHT_SPERREN = 'X'

IF_ERROR_MESSAGES_SEND_0 = ' '

  • IMPORTING

  • EF_ERROR_ANY_0 = LF_ERROR_ANY

  • TABLES

  • VBPOK_TAB = LT_VBPOK_TAB

  • PROT = LT_PROT

EXCEPTIONS

ERROR_MESSAGE = 1

OTHERS = 2.

IF SY-SUBRC = 0.

WAIT UP TO '0.005' SECONDS.

CLEAR VBFA-VBELN.

SELECT SINGLE VBELN INTO VBFA-VBELN FROM VBFA

WHERE VBELV = ITAB_HEAD-VGBEL

AND ERDAT = SY-DATUM

AND VBTYP_N = 'R'.

thanks

jawad