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

How to update t.code FBL3N(reference document nunber)

Former Member
0 Likes
870

Hi,

urgent,I want to update the t.code FBL3N in that t.code the field is reference document number.

I followed the program code as

&----


*& Report YST00010

*& To update text spool. VBRK and BKPF.

&----


*&

*&

&----


report zst00010.

selection-screen begin of block sel with frame.

parameters: pa_vkorg like vbrk-vkorg obligatory default '8000'.

parameters: pa_vbeln like vbrk-vbeln obligatory.

parameters: pa_gjahr like bkpf-gjahr obligatory.

parameters: pa_text(10) type c obligatory.

selection-screen end of block sel.

tables: bkpf,vbrk.

data: it_texts like tline occurs 0 with header line.

data: it_thead like thead occurs 0 with header line.

data: it_bkpf like bkpf occurs 0 with header line.

data: tp_langu like sy-langu.

data: z_vbeln like thead-tdname.

data: z_id like thead-tdid.

data: z_object like thead-tdobject.

data: func.

data: z_old_text(10) type c.

perform initialize.

*perform conversion.

if sy-subrc <> 0.

write at: /5 '国家发票号码的输入结果:'.

skip.

write at: /5 '不成功 - SAP发票号码不正切'.

exit.

endif.

perform check_bkpf.

if sy-subrc <> 0.

write at: /5 '国家发票号码的输入结果:'.

skip.

write at: /5 '不成功。 '.

write at: /5 '可能原因:'.

write at: /5 '- 财务会计年度不正切'.

skip.

write at: /5

'请参考SAP发票档案确认SAP发票号码与SAP发票的财务会计年度再重新执行'.

exit.

endif.

perform read_text.

read table it_texts index 1.

move it_texts-tdline to z_old_text.

perform init_text.

it_texts-tdformat = '*'.

it_texts-tdline = pa_text.

append it_texts.

it_thead-tdobject = z_object.

it_thead-tdname = z_vbeln.

it_thead-tdid = z_id.

it_thead-tdspras = tp_langu.

append it_thead.

perform save_text.

perform commit_text.

write at: /5 '国家发票号码的输入结果:'.

skip.

write at: /5 '旧的国家发票号码: ', 30(10) z_old_text.

write at: /5 '新的国家发票号码: ', 30(10) pa_text.

skip.

write at: /5 '更新成功。'.

perform update_accounting.

&----


*& Form initialize

&----


  • text

----


form initialize.

select single * from vbrk

where vbeln = pa_vbeln.

if sy-subrc <> 0.

exit.

endif.

move pa_vbeln to z_vbeln.

move 'Z802' to z_id.

move 'VBBK' to z_object.

if vbrk-kunag(1) = '4'.

move 'E' to tp_langu.

else.

move '1' to tp_langu.

endif.

endform. "initialize

&----


*& Form conversion

&----


  • text

----


form conversion.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = z_object

importing

output = z_object.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = z_vbeln

importing

output = z_vbeln.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = z_id

importing

output = z_id.

endform. "conversion

&----


*& Form READ_TEXT

&----


  • text

----


form read_text.

call function 'READ_TEXT'

exporting

id = z_id

language = tp_langu

name = z_vbeln

object = z_object

tables

lines = it_texts

exceptions

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

others = 8.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. "READ_TEXT

&----


*& Form init_text

&----


  • text

----


form init_text.

call function 'INIT_TEXT'

exporting

id = z_id

language = tp_langu

name = z_vbeln

object = z_object

importing

header = it_thead

tables

lines = it_texts.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. "init_text

&----


*& Form save_text

&----


  • text

----


form save_text.

call function 'SAVE_TEXT'

exporting

header = it_thead

savemode_direct = 'X'

tables

lines = it_texts

exceptions

id = 1

language = 2

name = 3

object = 4

others = 5.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. "save_text

&----


*& Form commit_text

&----


  • text

----


form commit_text.

call function 'COMMIT_TEXT'

exporting

name = it_thead-tdname

savemode_direct = 'X'.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. "commit_text

&----


*& Form update_accounting

&----


  • text

----


*shanker modif

form update_accounting.

select single * from bkpf into it_bkpf

where bukrs = pa_vkorg

and gjahr = pa_gjahr

and awkey = pa_vbeln.

append it_bkpf.

loop at it_bkpf.

update bkpf

set xblnr = pa_text

where bukrs = it_bkpf-bukrs

and gjahr = it_bkpf-gjahr

and awkey = it_bkpf-awkey.

write: /5 'SAP发票号码: ', 30 it_bkpf-awkey.

write: /5 '财务会计凭证号码: ',30 it_bkpf-belnr.

endloop.

endform.

&----


*& Form check_bkpf

&----


  • text

----


form check_bkpf.

select single * from bkpf

where bukrs = pa_vkorg

and gjahr = pa_gjahr

and awkey = pa_vbeln.

if sy-subrc <> 0.

endif.

endform. "check_bkpf

Thanks,

Sriii.

Title edited by: Alvaro Tejada Galindo on Jun 12, 2008 7:11 PM

Hi,

urgent,I want to update the t.code FBL3N in that t.code the field is reference document number.

I followed the program code as

&----


*& Report YST00010

*& To update text spool. VBRK and BKPF.

&----


*&

*&

&----


report zst00010.

selection-screen begin of block sel with frame.

parameters: pa_vkorg like vbrk-vkorg obligatory default '8000'.

parameters: pa_vbeln like vbrk-vbeln obligatory.

parameters: pa_gjahr like bkpf-gjahr obligatory.

parameters: pa_text(10) type c obligatory.

selection-screen end of block sel.

tables: bkpf,vbrk.

data: it_texts like tline occurs 0 with header line.

data: it_thead like thead occurs 0 with header line.

data: it_bkpf like bkpf occurs 0 with header line.

data: tp_langu like sy-langu.

data: z_vbeln like thead-tdname.

data: z_id like thead-tdid.

data: z_object like thead-tdobject.

data: func.

data: z_old_text(10) type c.

perform initialize.

*perform conversion.

if sy-subrc <> 0.

write at: /5 '国家发票号码的输入结果:'.

skip.

write at: /5 '不成功 - SAP发票号码不正切'.

exit.

endif.

perform check_bkpf.

if sy-subrc <> 0.

write at: /5 '国家发票号码的输入结果:'.

skip.

write at: /5 '不成功。 '.

write at: /5 '可能原因:'.

write at: /5 '- 财务会计年度不正切'.

skip.

write at: /5

'请参考SAP发票档案确认SAP发票号码与SAP发票的财务会计年度再重新执行'.

exit.

endif.

perform read_text.

read table it_texts index 1.

move it_texts-tdline to z_old_text.

perform init_text.

it_texts-tdformat = '*'.

it_texts-tdline = pa_text.

append it_texts.

it_thead-tdobject = z_object.

it_thead-tdname = z_vbeln.

it_thead-tdid = z_id.

it_thead-tdspras = tp_langu.

append it_thead.

perform save_text.

perform commit_text.

write at: /5 '国家发票号码的输入结果:'.

skip.

write at: /5 '旧的国家发票号码: ', 30(10) z_old_text.

write at: /5 '新的国家发票号码: ', 30(10) pa_text.

skip.

write at: /5 '更新成功。'.

perform update_accounting.

&----


*& Form initialize

&----


  • text

----


form initialize.

select single * from vbrk

where vbeln = pa_vbeln.

if sy-subrc <> 0.

exit.

endif.

move pa_vbeln to z_vbeln.

move 'Z802' to z_id.

move 'VBBK' to z_object.

if vbrk-kunag(1) = '4'.

move 'E' to tp_langu.

else.

move '1' to tp_langu.

endif.

endform. "initialize

&----


*& Form conversion

&----


  • text

----


form conversion.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = z_object

importing

output = z_object.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = z_vbeln

importing

output = z_vbeln.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = z_id

importing

output = z_id.

endform. "conversion

&----


*& Form READ_TEXT

&----


  • text

----


form read_text.

call function 'READ_TEXT'

exporting

id = z_id

language = tp_langu

name = z_vbeln

object = z_object

tables

lines = it_texts

exceptions

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

others = 8.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. "READ_TEXT

&----


*& Form init_text

&----


  • text

----


form init_text.

call function 'INIT_TEXT'

exporting

id = z_id

language = tp_langu

name = z_vbeln

object = z_object

importing

header = it_thead

tables

lines = it_texts.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. "init_text

&----


*& Form save_text

&----


  • text

----


form save_text.

call function 'SAVE_TEXT'

exporting

header = it_thead

savemode_direct = 'X'

tables

lines = it_texts

exceptions

id = 1

language = 2

name = 3

object = 4

others = 5.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. "save_text

&----


*& Form commit_text

&----


  • text

----


form commit_text.

call function 'COMMIT_TEXT'

exporting

name = it_thead-tdname

savemode_direct = 'X'.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. "commit_text

&----


*& Form update_accounting

&----


  • text

----


*shanker modif

form update_accounting.

select single * from bkpf into it_bkpf

where bukrs = pa_vkorg

and gjahr = pa_gjahr

and awkey = pa_vbeln.

append it_bkpf.

loop at it_bkpf.

update bkpf

set xblnr = pa_text

where bukrs = it_bkpf-bukrs

and gjahr = it_bkpf-gjahr

and awkey = it_bkpf-awkey.

write: /5 'SAP发票号码: ', 30 it_bkpf-awkey.

write: /5 '财务会计凭证号码: ',30 it_bkpf-belnr.

endloop.

endform.

&----


*& Form check_bkpf

&----


  • text

----


form check_bkpf.

select single * from bkpf

where bukrs = pa_vkorg

and gjahr = pa_gjahr

and awkey = pa_vbeln.

if sy-subrc <> 0.

endif.

endform. "check_bkpf

Thanks,

Sriii.

Title edited by: Alvaro Tejada Galindo on Jun 12, 2008 7:11 PM

4 REPLIES 4
Read only

Former Member
0 Likes
771

hai,

Kindly elaborate your problem, i am not able to understand what exactly you are looking for,either code rectification or adding field in fbl3n.

<REMOVED BY MODERATOR>

thanks

jase

Edited by: Alvaro Tejada Galindo on Jun 12, 2008 7:12 PM

Read only

0 Likes
771

Hi sam,

urgent ...

No i dont want to add the field .

I want to update the reference document number code recification(XBLNR) in t.code FBL5N,FBL3N.

Thanks,

Srii.

Edited by: sridhar reddy on Jun 13, 2008 5:04 AM

Edited by: sridhar reddy on Jun 13, 2008 5:06 AM

Read only

0 Likes
771

Hi Sridhar,

You can use exit in the substitution rule to change the XBLNR field.

The t-code is OBBH.

Please elaborate with your FI functional to know which exit to use.

Hope it helps,

Victor.

Read only

0 Likes
771

Hi,

still it's not updating the FBL3N.

thanks,

srii

Edited by: sridhar reddy on Jun 17, 2008 10:57 AM