<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: FUNCTION MODULE FOR CHANGING HEADER TEXT FOR GOODS ISSUE DOCUMENT in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-changing-header-text-for-goods-issue-document/m-p/4035972#M964659</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Use SAVE_TEXT FM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Jun 2008 12:25:49 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-20T12:25:49Z</dc:date>
    <item>
      <title>FUNCTION MODULE FOR CHANGING HEADER TEXT FOR GOODS ISSUE DOCUMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-changing-header-text-for-goods-issue-document/m-p/4035971#M964658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi  experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    i want to change the header text (mkpf-bktxt) of the goods issue document , for  this purpose any fn is there &lt;/P&gt;&lt;P&gt;please suggest.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 12:24:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-changing-header-text-for-goods-issue-document/m-p/4035971#M964658</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T12:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: FUNCTION MODULE FOR CHANGING HEADER TEXT FOR GOODS ISSUE DOCUMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-changing-header-text-for-goods-issue-document/m-p/4035972#M964659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Use SAVE_TEXT FM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 12:25:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-changing-header-text-for-goods-issue-document/m-p/4035972#M964659</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T12:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: FUNCTION MODULE FOR CHANGING HEADER TEXT FOR GOODS ISSUE DOCUMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-changing-header-text-for-goods-issue-document/m-p/4035973#M964660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mohan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use:&lt;STRONG&gt;'WS_DELIVERY_UPDATE'&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZWM_OVERWEIGHT_FIX no standard page heading
message-id zwm.
======================================================================

* 
Program Name : ZWM_OVERWEIGHT_FIX * 
* 
Description : Tool to fix Overweight in delivery line item, * 
Used All Function module to cancel invoice , * 
Reverse the goods issue ,Update Delivery qty,Create * 
invoice * 
* 
Author : Seshu * 
Date : 05/08/2007 * 
* 
----------------------------------------------------------------------

MODIFICATION HISTORY * 
----------------------------------------------------------------------

DATE | AUTHOR | CHANGE # | DESCRIPTION OF MODIFICATION * 
---------|----------|------------|------------------------------------

05/08/07| Seshu | DEVK921979 | Initial * 
************************************************************************

************************************************************************
















D A T A - D E C L A R A T I O N ******************* 
************************************************************************


Tables 

Tables : vbak,
vbap,
vbfa,
likp,
lips,
vbrk,
vbrp.


Internal Tables 

data : i_lips like lips occurs 0 with header line,
i_vbap like vbap occurs 0 with header line.


Variables 
data : v_deliv like vbfa-vbelv,
v_invoic like vbfa-vbelv.


Data Declaration Part for Post Goods Issue 
DATA: l_vbeln LIKE likp-vbeln,
l_vbkok LIKE vbkok,
i_prot LIKE prott OCCURS 0 WITH HEADER LINE,
ef_error_any_0 TYPE c,
ef_error_in_item_deletion_0 TYPE c,
ef_error_in_pod_update_0 TYPE c,
ef_error_in_interface_0 TYPE c,
ef_error_in_goods_issue_0 TYPE c,
ef_error_in_final_check_0 TYPE c,
d_return LIKE bapireturn1.




Internal tables for BAPI Function Module 
data : i_cret like BAPIRETURN1 occurs 0 with header line,
i_csucess like BAPIVBRKSUCcESS occurs 0 with header line,
i_ret2 like bapiret2 ,
flag type c,
i_mesg like mesg occurs 0 with header line.


Data Declaration for Invoice Creation 
DATA: VBSK_I LIKE VBSK.
data: d_success type c.
DATA: XKOMFK LIKE KOMFK OCCURS 0 WITH HEADER LINE,
XKOMV LIKE KOMV OCCURS 0 WITH HEADER LINE,
XTHEAD LIKE THEADVB OCCURS 0 WITH HEADER LINE,
XVBFS LIKE VBFS OCCURS 0 WITH HEADER LINE,
XVBPA LIKE VBPAVB OCCURS 0 WITH HEADER LINE,
XVBRK LIKE VBRKVB OCCURS 0 WITH HEADER LINE,
XVBRP LIKE VBRPVB OCCURS 0 WITH HEADER LINE,
XVBSS LIKE VBSS OCCURS 0 WITH HEADER LINE,
XKOMFKGN LIKE KOMFKGN OCCURS 0 WITH HEADER LINE.

************************************************************************
















S E L E C T I O N - S C R E E N ****************** 
************************************************************************


Selection-screen 

Selection-screen : begin of block blk with frame title text-001.
parameters : p_vbeln like vbak-vbeln obligatory.
selection-screen : end of block blk.

************************************************************************
















A T - S E L E C T I O N - S C R E E N *************** 
************************************************************************


Validation on Sales order 

at selection-screen on p_vbeln.


Check the data on VBAK Table 
select single vbeln from vbak into vbak-vbeln
where vbeln = p_vbeln.

if sy-subrc ne 0.
message e006 with p_vbeln.
endif.

************************************************************************















S T A R T - O F - S E L E C T I O N ******************* 
************************************************************************
Start-of-selection.

break sreddy.

Get the Invoice Number corresponding Sales Order Number 
perform get_invoice.


Step 1. 


Cancel the Invoice - Transaction VF11 

perform cancel_invoice.


Reverse the goods issue 
perform reverse_goodsissue.


Get the Order and Delivery Items 

perform get_sales_deliv.


Delivery Change 
perform Delivery_change.


Create Invoice document 
perform invoice_create.

************************************************************************















E N D - O F - S E L E C T I O N ******************* 
************************************************************************
end-of-selection.

if flag = 'X'.

message i012 with p_vbeln.

endif.
&amp;amp;---------------------------------------------------------------------
*&amp;amp; Form get_invoice
&amp;amp;---------------------------------------------------------------------

Get Invoice Number 
----------------------------------------------------------------------
FORM get_invoice.


Clear Variables 

clear : v_deliv,
v_invoic,
flag.

Get the Delivery Number First 
select single vbeln from vbfa into v_deliv
where vbelv = p_vbeln
and vbtyp_n = 'J'.

if sy-subrc ne 0.

message i004 with p_vbeln.
stop.

endif.


Get the Invoice Number 
select single vbeln from vbfa into v_invoic
where vbelv = p_vbeln
and vbtyp_n = 'M'.

if sy-subrc ne 0.
message i003 with p_vbeln.
stop.
endif.

ENDFORM. " get_invoice

&amp;amp;---------------------------------------------------------------------
*&amp;amp; Form cancel_invoice
&amp;amp;---------------------------------------------------------------------


Cancel the Invoice 
----------------------------------------------------------------------
FORM cancel_invoice.

clear : i_ret2,
i_cret,
i_csucess.

refresh : i_cret,
i_csucess.

CALL FUNCTION 'BAPI_BILLINGDOC_CANCEL1'
EXPORTING
BILLINGDOCUMENT = v_invoic

TESTRUN = 
NO_COMMIT = 
BILLINGDATE = 
TABLES
RETURN = i_cret
SUCCESS = i_csucess
.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = space
IMPORTING
RETURN = i_ret2.


read table i_cret with key type = 'E'. 

if sy-subrc ne 0.

message i005 with v_invoic.
stop.

endif.

ENDFORM. " cancel_invoice
&amp;amp;---------------------------------------------------------------------
*&amp;amp; Form reverse_goodsissue
&amp;amp;---------------------------------------------------------------------


Reverse the goods Issue 
----------------------------------------------------------------------
FORM reverse_goodsissue.


Local Variable 

data : lv_vbtyp like likp-vbtyp.

clear : i_mesg,
lv_vbtyp.

refresh : i_mesg.

select single vbtyp from likp into lv_vbtyp
where vbeln = v_deliv.

CALL FUNCTION 'WS_REVERSE_GOODS_ISSUE'
EXPORTING
I_VBELN = v_deliv
I_BUDAT = sy-datum

I_COUNT = 
I_MBLNR = 
I_TCODE = 
I_VBTYP = lv_vbtyp
TABLES
T_MESG = i_mesg
EXCEPTIONS
ERROR_REVERSE_GOODS_ISSUE = 1
OTHERS = 2
.

if sy-subrc ne 0.
message i007 with v_deliv.
endif.


ENDFORM. " reverse_goodsissue
&amp;amp;---------------------------------------------------------------------
*&amp;amp; Form get_sales_deliv
&amp;amp;---------------------------------------------------------------------


Get the Sales order and Deliv Items 
----------------------------------------------------------------------
FORM get_sales_deliv.


Local Variables 
data : lv_kwmeng like vbap-kwmeng.

clear : i_lips,
i_vbap.

refresh : i_lips,
i_vbap.



Select the data from LIPS 
select * from lips into table i_lips
where vbeln = v_deliv.

if sy-subrc ne 0.
message i008 with v_deliv.
stop.
endif.

sort i_lips by vbeln posnr.


Get the Sales order Item Data. 
select * from vbap into table i_vbap
where vbeln = p_vbeln.

if sy-subrc ne 0.
message i006 with p_vbeln.
stop.
endif.

sort i_vbap by vbeln posnr.


Compare delivery Item and Order Items 
loop at i_lips.

clear lv_kwmeng.

read table i_vbap with key posnr = i_lips-posnr.

if sy-subrc eq 0.

lv_kwmeng = i_vbap-kwmeng * 2.

if lv_kwmeng &amp;gt;= i_lips-lfimg.

i_lips-lfimg = i_vbap-kwmeng.
modify i_lips.

endif.

endif.


endloop.

ENDFORM. " get_sales_deliv
&amp;amp;---------------------------------------------------------------------
*&amp;amp; Form Delivery_change
&amp;amp;---------------------------------------------------------------------


Delivery Update 
----------------------------------------------------------------------
FORM Delivery_change.

Clear : i_prot.
refresh : i_prot.


Delivery Update 
CALL FUNCTION 'LE_MOB_DELIVERY_UPDATE'
EXPORTING
do_commit = 'X'
TABLES
t_delivery_items = i_lips
prot = i_prot
EXCEPTIONS
conversion_overflow = 1
essential_data_missing = 2
error = 3
nothing_to_update = 4
lock_after_update_failed = 5
error_in_delivery_update = 6
OTHERS = 7.

COMMIT WORK.

IF sy-subrc 0.

MESSAGE i009 with v_deliv.

endif.




Post Goods Issue 
CLEAR: d_return,
i_prot,
l_vbeln,
l_vbkok.

REFRESH i_prot.

CLEAR: ef_error_in_item_deletion_0 ,
ef_error_in_pod_update_0 ,
ef_error_in_interface_0 ,
ef_error_in_goods_issue_0 ,
ef_error_in_final_check_0 .


carry out goods issue 
l_vbeln = v_deliv.
l_vbkok-vbeln_vl = l_vbeln.
l_vbkok-wabuc = 'X'.




carry out goods issue 
l_vbeln = v_deliv.
l_vbkok-vbeln_vl = l_vbeln.
l_vbkok-wabuc = 'X'.


SET UPDATE TASK LOCAL. 
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
vbkok_wa = l_vbkok
synchron = 'X'
no_messages_update = ' '
update_picking = 'X'
commit = 'X'
delivery = l_vbeln
nicht_sperren = 'X'
if_error_messages_send_0 = space
IMPORTING
ef_error_any_0 = ef_error_any_0
ef_error_in_item_deletion_0 = ef_error_in_item_deletion_0
ef_error_in_pod_update_0 = ef_error_in_pod_update_0
ef_error_in_interface_0 = ef_error_in_interface_0
ef_error_in_goods_issue_0 = ef_error_in_goods_issue_0
ef_error_in_final_check_0 = ef_error_in_final_check_0
TABLES
prot = i_prot
EXCEPTIONS
error_message = 1
OTHERS = 2.

if sy-subrc ne 0.
message i010 with v_deliv.

else.
COMMIT WORK .
endif.

ENDFORM. " Delivery_change
&amp;amp;---------------------------------------------------------------------
*&amp;amp; Form invoice_create
&amp;amp;---------------------------------------------------------------------

Invoice Creation 
----------------------------------------------------------------------
FORM invoice_create.

refresh: XKOMFK, XKOMV,
XTHEAD, XVBFS,
XVBPA, XVBRK,
XVBRP, XVBSS.

clear : XKOMFK, XKOMV,
XTHEAD, XVBFS,
XVBPA, XVBRK,
XVBRP, XVBSS,
VBSK_I.


VBSK_I-SMART = 'F'.
XKOMFK-VBELN = v_deliv.
XKOMFK-VBTYP = 'J'.
APPEND XKOMFK.

CALL FUNCTION 'RV_INVOICE_CREATE'
EXPORTING
VBSK_I = VBSK_I
WITH_POSTING = 'C'
TABLES
XKOMFK = XKOMFK
XKOMV = XKOMV
XTHEAD = XTHEAD
XVBFS = XVBFS
XVBPA = XVBPA
XVBRK = XVBRK
XVBRP = XVBRP
XVBSS = XVBSS.

if sy-subrc eq 0.
COMMIT WORK.
flag = 'X'.

else.
message i011 with p_vbeln.
endif.

ENDFORM. " invoice_create&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LE_MOB_DELIVERY_UPDATE
BAPI_OUTB_DELIVERY_CHANGE'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Amit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Amit on Jun 20, 2008 2:38 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 12:32:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-changing-header-text-for-goods-issue-document/m-p/4035973#M964660</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T12:32:18Z</dc:date>
    </item>
  </channel>
</rss>

