‎2007 Oct 04 1:58 PM
Hi,
Can any one explain what
WITH_POSTING EQ ' ' or
WITH_POSTING EQ 'H'
in the FM rv_invoice_refresh mean?i have to use them in my program..
Thanks,
Challa.
‎2007 Oct 04 2:05 PM
Hi
With Posting H means it is CREDIT posting
Space means with No credit or debit..
there are so many options
like CA 'CD' means contains either Credit or Debit
NA means Not any of them
Regards
Anji
‎2007 Oct 04 2:21 PM
hi
good
DATA: v_vbeln TYPE likp-vbeln.
Parameters
PARAMETERS: p_vbeln LIKE v_vbeln.
PARAMETERS: p_fkart LIKE vbrk-fkart.
PARAMETERS: p_test TYPE allgtest.
Data declarations.
DATA: s_vbsk LIKE vbsk.
DATA: t_komfk TYPE STANDARD TABLE OF komfk,
t_komv TYPE STANDARD TABLE OF komv,
t_thead TYPE STANDARD TABLE OF theadvb,
t_vbfs TYPE STANDARD TABLE OF vbfs,
t_vbpa TYPE STANDARD TABLE OF vbpavb,
t_vbrk TYPE STANDARD TABLE OF vbrkvb,
t_vbrp TYPE STANDARD TABLE OF vbrpvb,
t_vbss TYPE STANDARD TABLE OF vbss.
DATA: BEGIN OF s_likp,
vbeln TYPE vbeln,
vbtyp TYPE vbak-vbtyp,
END OF s_likp.
DATA: BEGIN OF s_lips,
vbeln TYPE vbeln,
posnr TYPE posnr,
END OF s_lips.
Internal tables.
DATA: t_likp LIKE TABLE OF s_likp.
DATA: t_lips LIKE TABLE OF s_lips.
DATA: s_komfk TYPE komfk.
DATA: s_vbfs TYPE vbfs.
DATA: v_with_posting TYPE xfeld.
DATA: v_no_enqueue TYPE xfeld.
DATA: v_message TYPE string.
START-OF-SELECTION.
Check the testrun.
IF p_test IS INITIAL.
v_with_posting = 'B'.
ELSE.
v_with_posting = 'H'.
v_no_enqueue = 'X'.
ENDIF.
Get the data from VBAK.
SELECT vbeln vbtyp FROM likp
INTO TABLE t_likp
WHERE vbeln = p_vbeln.
IF sy-subrc <> 0.
MESSAGE s208(00) WITH 'Invalid vbeln'.
LEAVE LIST-PROCESSING.
ENDIF.
Get the data from VBAP.
IF NOT t_likp IS INITIAL.
SELECT vbeln posnr INTO TABLE t_lips
FROM lips
FOR ALL ENTRIES IN t_likp
WHERE vbeln = t_likp-vbeln.
ENDIF.
Refresh.
CALL FUNCTION 'RV_INVOICE_REFRESH'
EXPORTING
with_posting = 'B'
TABLES
xkomfk = t_komfk
xkomv = t_komv
xthead = t_thead
xvbfs = t_vbfs
xvbpa = t_vbpa
xvbrk = t_vbrk
xvbrp = t_vbrp
xvbss = t_vbss.
Build the internal table t_komfk.
LOOP AT t_likp INTO s_likp.
LOOP AT t_lips INTO s_lips WHERE vbeln = s_likp-vbeln.
Fill the values.
s_komfk-mandt = sy-mandt.
s_komfk-vbeln = s_likp-vbeln.
s_komfk-posnr = s_lips-posnr.
s_komfk-vbtyp = s_likp-vbtyp.
s_komfk-seldat = sy-datum.
s_komfk-fkart = p_fkart.
APPEND s_komfk TO t_komfk.
CLEAR: s_komfk.
ENDLOOP.
ENDLOOP.
invoice create
CALL FUNCTION 'RV_INVOICE_CREATE'
EXPORTING
vbsk_i = s_vbsk
with_posting = v_with_posting
id_no_enqueue = v_no_enqueue
IMPORTING
vbsk_e = s_vbsk
TABLES
xkomfk = t_komfk
xkomv = t_komv
xthead = t_thead
xvbfs = t_vbfs
xvbpa = t_vbpa
xvbrk = t_vbrk
xvbrp = t_vbrp
xvbss = t_vbss.
Display the invoice created.
LOOP AT t_vbfs INTO s_vbfs.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = s_vbfs-msgid
no = s_vbfs-msgno
v1 = s_vbfs-msgv1
v2 = s_vbfs-msgv2
v3 = s_vbfs-msgv3
v4 = s_vbfs-msgv4
IMPORTING
msg = v_message
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e208(00) WITH 'Error in calling function module'.
ENDIF.
WRITE: / s_vbfs-msgty, s_vbfs-msgv1, v_message.
ENDLOOP.
Refresh and clear.
REFRESH: t_vbfs,
t_komfk,
t_komv,
t_thead,
t_vbfs,
t_vbpa,
t_vbrk,
t_vbrp,
t_vbss.
CLEAR: t_vbfs,
t_komfk,
t_komv,
t_thead,
t_vbfs,
t_vbpa,
t_vbrk,
t_vbrp,
t_vbss.
reward point if helpful.
thanks
mrutyun^
‎2007 Oct 04 2:27 PM
Hi mrutyun,
Thank you for the answer....
i tried this..but after sucess in rv_invoice_create(invoice is created) i want the invoice number created to be output in a list....but i can't capture it..is there any way out...please help me with this...
Thanks,
Challa.