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

problem in chage FB02 item text

Former Member
0 Likes
3,372

Hi Freinds.

I got one assignment to change the Item text in FB02(Change Document). I wrote one program to change the item text using FM FI_ITEMS_MASS_CHANGE. It's working fine. But as soon it changes the next line item's text, the previous is also changed to same as this one. And if there are 6 or 7 items ,at the end of the program , all the line items have same text as the last one.

But we need different textx of line items for one Header document.

Am I using the correct Function Module? Please suggest.

Previously I tried doing recording and BDC of FB02, but failed because i think there is some enhancement done in this T-code.

so please suggest how to complete my assignment.

Thanx and regrads.

Prashant Tiwari.

1 ACCEPTED SOLUTION
Read only

nirajgadre
Active Contributor
0 Likes
2,723

Hi,

Try to use the function module FI_DOCUMENT_CHANGE in loop. In this function module,there is an option to pass the line item number parameter I_BUZEI and in table parameters T_ACCCHG pass the line item text for each line item.

13 REPLIES 13
Read only

nirajgadre
Active Contributor
0 Likes
2,724

Hi,

Try to use the function module FI_DOCUMENT_CHANGE in loop. In this function module,there is an option to pass the line item number parameter I_BUZEI and in table parameters T_ACCCHG pass the line item text for each line item.

Read only

0 Likes
2,723

Hi Niraj.

I used this FM FI_DOCUMENT_CHANGE in the same way as it is being used in Standard SAP program

"RFFMFGTCREV_CHECKS" but it gives the error message for all items "Clear Items can not be processed'. But when i check that Item document number in FBL5N, it shows that the item is still open.

Do you have any Idea how to use FB09 for the same "text change purpose".

Any other suggestions , plz provide.

Read only

0 Likes
2,723

Hi,

The FB09 transaction is used to change the line item details . If you run the fb09 on first screen you are require to put the company code , document number , fiscal year and line item number.

on the second screen you will get that line item details.

so change the line item text for the lines and save the document.

If you want to change the line items for specific line item like asset , GL or vendor lie item then you require to select the check box accordingly as per the requirement.

so try to create the BDC for transaction FB09 and put this into loop i guess this will solve your issue.

can you alos mention which parameters you are passing for function module FI_DOCUMENT_CHANGE.

Read only

0 Likes
2,723

Hi Niraj

I tried BDC for FB09 using recording. While using this in Loop...Endloop, it the second loop pass the values do not passed by program.....the previously run document comes....it doesnt refreshes the input field. So from second loop pass it dint work.

Plz check the following code.

form update_fb09 .

var = 'A'.

data:l_belnr(10) type c,

l_bukrs(04) type c,

l_gjahr(04) type c,

l_buzei(03) type c,

l_sgtxt(50) type c.

loop at it_bseg into wa_bseg.

l_belnr = wa_bseg-belnr.

l_bukrs = wa_bseg-bukrs.

l_gjahr = wa_bseg-gjahr.

l_buzei = wa_bseg-buzei.

l_sgtxt = wa_bseg-sgtxt.

perform bdc_dynpro using 'SAPMF05L' '0102'.

*perform bdc_field using 'BDC_CURSOR'

  • 'RF05L-BELNR'.

perform bdc_field using 'BDC_CURSOR'

'RF05L-BUZEI'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF05L-BELNR'

l_belnr. "'10002'.

perform bdc_field using 'RF05L-BUKRS'

l_bukrs. "'7777'.

perform bdc_field using 'RF05L-GJAHR'

l_gjahr. "'2009'.

perform bdc_field using 'RF05L-BUZEI'

l_buzei. "'1'.

perform bdc_dynpro using 'SAPMF05L' '0301'.

perform bdc_field using 'BDC_CURSOR'

'BSEG-SGTXT'.

perform bdc_field using 'BDC_OKCODE'

'=AE'.

*perform bdc_field using 'BSEG-ZTERM'

  • '0001'.

*perform bdc_field using 'BSEG-ZFBDT'

  • '01.09.2009'.

*perform bdc_field using 'BSEG-ZUONR'

  • '0090003091'.

perform bdc_field using 'BSEG-SGTXT'

l_sgtxt. "'1212'.

*perform bdc_transaction using 'FB09'.

call transaction 'FB09' using bdcdata messages into messtab

update 'S'

mode var.

clear: l_belnr ,l_bukrs ,l_gjahr ,l_buzei ,l_sgtxt ,wa_bseg.

endloop.

endform. " UPDATE_FB09

Please suggest me how to refresh the FB09 input fields for second loop pass.

Read only

0 Likes
2,723

hi,

You required to refresh the BDCDATA table every time after the call transaction. try this this will work for you

Read only

0 Likes
2,723

Hi Niraj.

Sorry I am disturbing you by asking questions again and again.

Your suggestion to refresh the BDCDATA table does work, but in next loop pass one screen comes named "Coding Block".

and after this it doesnt works. I can't trace why this screen comes. But I remeber while doing BDC using FB02 also this screen appeared and after that all BDC program doesnt works.

So plz advice me how to by pass this screen......as it doesn't come while recording.

Side by side 'm doing using FM FI_DOCUMENT_CHANGE, it works fine for the first line item but not for the second third.

Is there any exits/enhancement work done? How can i trace that? Any idea?

Read only

0 Likes
2,722

Hi Prashant,

I guess while creating the SHDB for FB09 you are getting this coding block screen so you need to add this screen in your BDC code which is currently not there. hence once this screen is called program is not going forward. so add that screen in the BDC code and try to execute.

Read only

0 Likes
2,722

Hi Niraj.

Its not coming there while recoding FB09, I cheked once again. Its only coming when running the SHDB code in Loop-Endloop.

while analyzing i found for the first line item its callling screen no '301', and for the next line item it is calling screen '300'. But in my SHDB recording it is there to call screen '301', I cant trace why it;s calling screen '300' for the second line item.

So how to forcefully call screen '301' instead of '300'....plz suggest.

Read only

0 Likes
2,722

hi,

The screen 301 and 300 is called based on the gl account of the line item you are passing hence you need to call the second screen based on the type of line item for example if it is vendor line line item call different screen and if it is customer line item call different screen.

Read only

0 Likes
2,722

hi,

you will find out the line item type in the tbsl table based on the gl account in the line item.

Read only

0 Likes
2,722
perform bdc_dynpro    using 'SAPMF05L' '0102'.
perform bdc_field                    using 'BDC_CURSOR'
                                    'RF05L-GJAHR'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'RF05L-BELNR'
                              l_belnr..
perform bdc_field       using 'RF05L-BUKRS'
                              l_bukrs	.
perform bdc_field       using 'RF05L-GJAHR'
                              l_gjahr.
perform bdc_field       using 'RF05L-BUZEI'
                              record-BUZEI_004.

check the line item and call the screen based on the type

if line item related to screen 300 then

perform bdc_dynpro  using 'SAPMF05L' '0300'.
perform bdc_field       using 'BDC_CURSOR'
                              'BSEG-SGTXT'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'BSEG-SGTXT'
                              l_sgtxt.

perform bdc_dynpro      using 'SAPLKACB' '0002'.
perform bdc_field       using 'BDC_CURSOR'
                              'COBL-ANLN1'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTE'.

else.

perform bdc_dynpro      using 'SAPMF05L' '0301'.
perform bdc_field       using 'BDC_CURSOR'
                              'BSEG-SGTXT'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'BSEG-SGTXT'
                              l_sgtxt.

endif.

if line item related to screen 300 then

perform bdc_dynpro      using 'SAPMF05L' '0301'.
perform bdc_field          using 'BDC_CURSOR'
                                      'BSEG-ZUONR'.
perform bdc_field       using 'BDC_OKCODE'
                                     '=AE'.

perform bdc_dynpro  using 'SAPLKACB' '0002'.
perform bdc_field       using 'BDC_CURSOR'
                                    'COBL-ANLN1'.
perform bdc_field       using 'BDC_OKCODE'
                                   '=ENTE'.

else.

perform bdc_dynpro      using 'SAPMF05L' '0300'.
perform bdc_field            using 'BDC_CURSOR'
                                        'BSEG-ZUONR'.
perform bdc_field       using 'BDC_OKCODE'
                                     '=AE'.

endif.

Read only

0 Likes
2,722

Hi Niraj.

Thanx a lot.

Now i can solve the issue with your help.

Actually our Functional Consultant should told me Document numbers are chnaging based on the G/L or vendor/ or Customer.

I am giving you full points.

have a nice day freind.

Read only

Former Member
0 Likes
2,722

Hello Everyone.

I want to change the Zterm and the Zfbdt feilds. I am using the function module FI_ITEMS_MASS_CHANGE. This function module is working fine for the baseline date(ZFBDT). But the zterm part is not being updated. Please help....