Application Development 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: 

need suggestion to store change log history or creating a zlog table

former_member462254
Participant
0 Kudos

Hello,

My requirement is to create a Ztable which will store the Hisotry  / change log of data.

I have a program where i am using insert / update for a database table LFBW and displaying the log in the ALV ouput.

I need the same to be updated on Transaction level of FK02 (where entries of Table LFBW gets reflected).

so can any1 suggest me how this can be achieved?

If there is no way to store change history while insert /update on database table from prgram level then what type of z table(Type of Delivery Class ?

Data class ? i should create for the same

Thanks,

Anoop

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Do not update LFBW with (wild) Open SQL statements, but use standard tools and the change documents will be created

  • BDC (FK02/XK02)
  • Class VMD_EI_API Method MAINTAIN_BAPI or MAINTAIN_DIRECT_INPUT

NB: Do not confuse change document (generated in program, look at transaction SCDO - object KRED) and log of change data (generated by Open SQL statements)

A "bad" solution would be usage of SQL statement and call of FM which write the change document (KRED_WRITE_DOCUMENT)

Regards,

Raymond

7 REPLIES 7

raymond_giuseppi
Active Contributor
0 Kudos

Do not update LFBW with (wild) Open SQL statements, but use standard tools and the change documents will be created

  • BDC (FK02/XK02)
  • Class VMD_EI_API Method MAINTAIN_BAPI or MAINTAIN_DIRECT_INPUT

NB: Do not confuse change document (generated in program, look at transaction SCDO - object KRED) and log of change data (generated by Open SQL statements)

A "bad" solution would be usage of SQL statement and call of FM which write the change document (KRED_WRITE_DOCUMENT)

Regards,

Raymond

0 Kudos

Thanks Raymond Giuseppi   

* BDC

=> i tried with the BDC part but facing program while updating the existing withholding tax type (Tcode: FK02)

Could you please provide the BDC recoding for Fk02 (requirement to update / insert withholding tax type)

*  Class VMD_EI_API Method MAINTAIN_BAPI or MAINTAIN_DIRECT_INPUT

=> could you please provide the code for the same

It would be helpful for me if you provide the code for the same

Thanks,

Anoop

0 Kudos
  • BDC -> Execute the transaction FK02 or XK02 thru recorder transaction SHDB, then use it to  generate a sample code (I suggest two recording one for insert one for update) You could also LSMW which use report RFBIKR00
  • VMD_EI_API Method MAINTAIN_BAPI -> There are some sample at scn, use search tool to find documents like Creation of Vendor - VMD_EI_API and some dozen of threads. Look at VENDORS->COMPANY_DATA->COMPANY->WTAX_TYPE.

Regards,

Raymond

0 Kudos

Hello Raymond Giuseppi,

Thanks for providing the above details.

* KRED_WRITE_DOCUMENT
=> I checked this FM and found that OBJECT ID is mandatory to create change log
     But while updating LFBW ( using insert / update command on LFBWin Zprogram ) it doesnt create

     any data in CDHDR ( didnt get any object id)

* VMD_EI_API Method MAINTAIN_BAPI

=>  that is for creation / updation of vendor master. Here, I am looking for updation of withholding Tax-type in FK02 (Database Table - LFBW)

* RFBIKR00 Report

Checking the same.

Regards,

Anoop

0 Kudos
  • Change document wont come without coding, either SAP coding or yours, no hope..
    (Direct insert/udpate SQL statements have no chance to trigger this FM...)
  • The method and LSMW report actually allow filling of LFBW, look better (thru LSMW there is an input structure BLFBW and I already posted the path to those data in the class method)

So use standard tools (good) or fill yourself parameters of the FM (bad), it's up to you.

Regards,

Raymond

0 Kudos

Hello Raymond,

Thanks a lot again.....

need to discuss more on your last past

(1).  Change document wont come without coding, either SAP coding or yours, no hope..

(Direct insert/udpate SQL statements have no chance to trigger this FM...)

=> Even i do agree with this point. Standard calls Fm to update change document in badckground which is not in my Zprogram

(2).  The method and LSMW report actually allow filling of LFBW, look better (thru LSMW there is an input structure BLFBW and I already posted the path to those data in the class method)

=> RFBIKR00 Report ---- stilll analysing

=> VMD_EI_API Method MAINTAIN_BAPI

Could you provide the sample code  / e.g for the same....

Regards,

Anoop

0 Kudos

You have to code using some loop into the deep structure of this parameter:

Class VMD_EI_API, method MAINTAIN_BAPI, parameter IS_MASTER_DATA type VMDS_EI_MAIN, component VENDORS, type VMDS_EI_EXTERN_T, table of VMDS_EI_EXTERN, component COMPANY_DATA, type VMDS_EI_VMD_COMPANY, component COMPANY, type VMDS_EI_COMPANY_T, table of VMDS_EI_COMPANY, component WTAX_TYPE, type VMDS_EI_WTAX_TYPE_S, structure VMDS_EI_WTAX_TYPE_S, component WTAX_TYPE, type VMDS_EI_WTAX_TYPE_T, table of VMDS_EI_WTAX_TYPE

How to navigate in deep structure: look at sample Creation of Vendor - VMD_EI_API. Some level of fill an internal table, move it to component of previous level defined as internal table, recursively.

Regards,

Raymond