2007 Nov 27 12:53 PM
Hi All,
Is there a standard function module to update BSID table. Thanks
regards
Siby
2007 Nov 27 12:56 PM
Hi,
I don't think so but u can do like this.
&----
*& Form SUB_READ_UPDATE_BSEG
&----
text
----
FORM sub_read_update_bseg.
IF NOT it_final[] IS INITIAL.
LOOP AT it_final INTO wa_final.
UPDATE bseg SET zuonr = wa_final-ccnum
WHERE bukrs EQ wa_final-bukrs
AND belnr EQ wa_final-vbeln
AND rfzei EQ wa_final-rfzei
AND saknr NE ' '.
ENDLOOP.
*--Message data updated successfully
MESSAGE i888 WITH text-002.
LEAVE LIST-PROCESSING.
ELSE.
*--Message No data found
MESSAGE i888 WITH text-003.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " SUB_READ_UPDATE_BSEG
Regards,
Prashant
2007 Nov 27 12:58 PM
hi Sibi,
tables like BSID are updated by transactions (or complex FMs), because of the integrity of the system. Which field do you want to update at all?.
ec
2007 Nov 27 1:02 PM
Hi,
I want to update ZLSCH (Payment Method) field for a customer credit note.
2007 Nov 27 1:08 PM
you can use tranaction FB09 for modifiing line items in FI. You can easily develop a program which uses BDC or call transaction to do this. If you need more help, just let me know.
2012 Nov 09 4:48 PM
FB09 is not an executable program and in do not see BSID anywhere here.
Can anyone answer this question with a code sample?
It has been asked multiple times but there is not a single answer fitting the job here.
Me I want to update BSID-ZLSCH among others.
2012 Nov 10 12:00 PM
Read more carefully, FB09 is a transaction not a program (update line item, where FB02 is update document), use SHDB to build a small BDC wrapper report (very easy, try it) or use a FM like FI_ITEMS_MASS_CHANGE (which will build a BDC for FB02)
BSID in only a copy (secondary index) of some BSEG items for performance (not cleared, debitor) so update MUST come from BSEG standard updates.
Regards,
Raymond
2012 Nov 12 9:17 AM
Hi Raymond
There are several things that I do not understand and/or are wrong in your answer:
- SHDB is for recording purposes, not for updating let alone that it is a code generator;
- I have yet to see a usable, reliable and understandable BDC report. Wrapper is a Java term meaning something totally not bound to this subject;
- I saw FI_ITEMS_MASS_CHANGE and it does not seem to do anything with BSID or BSEG;
- I have used BSID as a real table and never BSEG, and I do not understand what you mean here by copy. A secondary index is totally not related, that is something you use to look up database records if you can not select on primary key.
Can you (or anyone else) tell me how to update standard SAP tables with BDC or how to update BSID (through BSEG?) (preferably by coding sample)?
BR Dennis
2012 Nov 12 9:45 AM
Regards,
Raymond
2012 Nov 12 10:35 AM
I start to believe I might be able to use FI_ITEMS_MASS_CHANGE but still it is too vague..
I could understand it with just the importing and exporting parameter since I would then give in a BSEG record to update, nothing special about that.
It seems it_fldtab does nothing more than listing which fields are updated, I can do that.
But what to do with IT_BUZTAB? It seems to be a few key fields from BSEG, but I believe I already put those in S_BSEG.
Also I do not see how I could have more than one table line.
If I would have to put all my records in it to update I would understand that but then S_BSEG is not clear to me since I now have more than one BSEG record so what could be the logic of S_BSEG..
Maybe with the answer to this I can produce working code to update BSEG and implicit BSID, and put it here as an instructive example.
2012 Nov 12 10:48 AM
Fill the parameters so :
This FM allow to apply the same change to multiple items.
Else, record transaction FB09 with SHDB and generate a program with this transaction (don't call it a wrapper if it cause trouble)
Regards,
Raymond
2012 Nov 12 1:31 PM
though this seems to be ok, I see that BSID and BSEG are not identical in all columns.
How should I copy with that since I have to update the BSEG record to get to the BSID record?
2012 Nov 12 1:57 PM
Read current values from BSEG, as
though this seems to be ok, I see that BSID and BSEG are not identical in all columns.
can be a serious problem of database consistency, try to diagnose this with report RFINDEX (read its documentation) and raise an OSS message (component FI-GL-GL-X) if it returns inconsistencies joint the report results to the message. (theorically, only SAP can use the correction report)
Regards,
Raymond
2012 Nov 12 2:12 PM
I meant column names differed between BSID and BSEG, not the content..
Anyway it seems not to work.. I get the non-informative message 'No changes were made'.
My code is this:
TYPE-POOLS : tpit.
DATA:
lw_bseg_new_values TYPE bseg,
it_errtab TYPE tpit_t_errdoc WITH HEADER LINE,
it_fldtab TYPE tpit_t_fname WITH HEADER LINE,
it_buztab TYPE tpit_t_buztab WITH HEADER LINE.
" Retrieve BSEG records.
SELECT * FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_buztab UP TO 2 ROWS.
" Set the new field value for the BSEG.
lw_bseg_new_values-bschl = 'TE'.
" Mention the fields to change.
it_fldtab-fname = 'BSCHL'.
APPEND it_fldtab.
" Perform the update.
CALL FUNCTION 'FI_ITEMS_MASS_CHANGE'
EXPORTING
s_bseg = lw_bseg_new_values
IMPORTING
errtab = it_errtab[]
TABLES
it_buztab = it_buztab
it_fldtab = it_fldtab
EXCEPTIONS
bdc_errors = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Do you see an error here?
If this is correct it does not seem to work and it would be undoable to debug the whole FB02 which is called inside the function module.
Let me know if you need any debug shot to answer this and on what moment.
BR Dennis
2012 Nov 12 2:21 PM
BSCHL cannot be modified. Look via Customizing on available fields list : Financial Accounting, Financial Accounting Global Settings, Document, Line Item, Document Change Rules, Line Item.
Regards,
Raymond
PS: The FM seems to be more restrictive than transactions FB02/FB09, look at form SCREEN_DETAIL in include LFI_ITEMSF03.
2012 Nov 12 2:41 PM
Now I try to do it with KIDNO which should be okay according to this list:
" Set the new field value for the BSEG.
lw_bseg_new_values-KIDNO = 'TESTTESTTESTTESTTESTTESTTEST'.
" Mention the fields to change.
it_fldtab-fname = 'KIDNO'.
APPEND it_fldtab.
Instead of the BSCHL lines above.
But I still get the same error, also when I put X in AENKZ in IT_FLDTAB it does not make a difference..
2012 Nov 12 3:31 PM
What is your version, on my ECC6 Ehp4, KIDNO not allowed in Customizing. As it is not managed by the FM, you must create the BDC yourself.
So try to change this field via transaction FB02 or FB09, read the source of the form, look for the Customizing.
For old version, look for OSS notes to implement.
Regards;
Raymond
2012 Nov 12 3:55 PM
Would you know which BSEG field I can update for this function module? Then I will try it with this one.. I really hope to get it working at least for one field it would be helpful for us to get this working even if just for futural versions. I have no idea about my version..
2012 Nov 20 12:37 PM
I got a program here that works.
Be sure to edit the belnr and bukrs to an existing record in your own database.
Do not only use belnr since this use s less of the full primary index and can cause performance issues..
*&---------------------------------------------------------------------*
*& Report ZTEST_FB02
*&
*&---------------------------------------------------------------------*
*& Demo program for FI_ITEMS_MASS_CHANGE, a module to update BSEG.
*&
*&---------------------------------------------------------------------*
REPORT ztest_fb02.
TYPE-POOLS : tpit.
DATA : w_bseg TYPE bseg,
w_message TYPE t100-text.
DATA : it_errtab TYPE tpit_t_errdoc WITH HEADER LINE,
it_fldtab TYPE tpit_t_fname WITH HEADER LINE,
it_buztab TYPE tpit_t_buztab WITH HEADER LINE.
* Field name to be changed
it_fldtab-fname = 'ZUONR'.
APPEND it_fldtab.
CLEAR it_fldtab.
* Field value
w_bseg-zuonr = 'TESTtest'.
* ITEM 7
SELECT bukrs belnr gjahr buzei koart umskz bschl mwart mwskz
FROM bseg INTO CORRESPONDING FIELDS OF TABLE it_buztab
WHERE belnr = '0411219696' AND bukrs = '0010'.
CALL FUNCTION 'FI_ITEMS_MASS_CHANGE'
EXPORTING
s_bseg = w_bseg
IMPORTING
errtab = it_errtab[]
TABLES
it_buztab = it_buztab
it_fldtab = it_fldtab
EXCEPTIONS
bdc_errors = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Raymond thanks for your input:)