Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
kamesh_g
Contributor

Hi

This Document will give over view of issues faced while updating  long text in infotypes.

I have seen many threads where facing issues with updating long text in infotypes . Pre requisite to update long text in infotype is ,must have  field ITXEX = 'X'  in PA table for the  specific record which infotype text to be updated .

But you may find many employees in the system which have not ITXEX = 'X' . So not able to update the text in infotype using avaliable standard methods or macros.

Before updatin infotype  text we must set this field ITXEX = 'X'  in PA table . To set this  field value standard FMs HR_INFOTYPE_OPERATION, HR_MAINTAIN_MASTERDTA, or standard class will not work .

Here we have a standard method to update set ITXEX = X before inserting or modifying a record you must  call this method and update the infotype record .After updating this field value we can call standard method or macro to update the text .

Method

CL_HRPA_INFOTYPE_CONTAINER=>modify_text_tab will update field ITXEX = 'X if we pass text table with some text only.

Below is the  process  to update ITXEX field in infotype . Here I am considering infotype 0194 (Garnishment document).  Below code you can use in loop of IT1094 records  or  LDB loop.

Code :

Data  Declaration

    data:     lo_0194 type ref to cl_hrpa_infotype_0194,
           lw_pernr
type p_pernr.
 
data :    fr_msg_handler type ref to if_hrpa_message_handler,                        

ls_container     type  hrpad_infty_container_ref,   

lt_old_container type hrpad_infty_container_tab,
lw_ok           
type boole_d.     

data :    lr_container_temp_0194 type ref to cl_hrpa_infotype_container.

data:    lw_update_mode  type hrpad_update_mode,
         lw_message    
type char50,
         ls_pskey      
type pskey,

                    lw_masterdata_buffer type ref to if_hrpa_masterdata_bl,

                            
 
data      ls_exp type ref to cx_hrpa_violated_assertion.
 
data :    lr_message_list type ref to cl_hrpa_message_list.   
 
data :    fr_keyref  type ref to data.

  data:
          lc_pgmid
type old_prog value sy-repid,
          lr_upd_cluster 
type ref to cl_hrpa_text_cluster.

   *--------Internal table for Text----------**
       data : lt_text_194    type hrpad_text_tab,


field-symbols : <lfs_0194> type p0194.

**-----Create Object for Message handling-----**
 
create object lr_message_list.
  fr_msg_handler  = lr_message_list.**Populate PSKEY
  lw_pernr       =  p_ls_0194-pernr.
  ls_pskey-pernr =  p_ls_0194-pernr.    
"Personnel Number
  ls_pskey-infty =  p_ls_0194-infty.
  ls_pskey-begda =  p_ls_0194-begda.
  ls_pskey-endda =  p_ls_0194-endda.*Create instance
 
try.
     
create object lo_0194
       
exporting
          tclas = zcl_c=>k_tclas_a
          infty = zcl_c=>k_infty_0194.
   
catch cx_hrpa_violated_assertion into ls_exp.
      lw_message = ls_exp->get_text( ).
 
endtry.
 
if lw_message is  initial .**Read record from IT0194 to fill old container********
   
try.
        lo_0194->if_hrpa_infty_bl~
read(
        
exporting
           tclas           = zcl_c=>k_tclas_a
           pernr           = lw_pernr
           infty           = zcl_c=>k_infty_0194
           subty           = p_ls_0194-subty
           begda           = p_ls_0194-begda
           endda           = p_ls_0194-endda
           no_auth_check   =
' '
           message_handler = fr_msg_handler
          
mode            = gc_mode3
        
importing
           container_tab       = lt_old_container 
"Infty container
           is_ok               = lw_ok        
"OK flag
           ).
     
catch cx_hrpa_violated_assertion into ls_exp.
        lw_message = ls_exp->get_text( ).
   
endtry.
   
if lw_ok eq gc_true and lw_message is initial.

*Update the status*Read the container for primary record***read the container for primary record**************
     
read table lt_old_container into ls_container index 1.
     
if sy-subrc eq 0.

**Move container to temparary container
        lr_container_temp_0194 ?= ls_container.*get primary record reference
       
try.
          lr_container_temp_0194->primary_record_ref(
         
importing
            pnnnn_ref = fr_keyref
"Primary record reference variable
            ).
       
endtry.
**Assign key refernce to 0194 work area
       
assign fr_keyref->* to <lfs_0194>.

**Change the status to 4 –Example we can change any field here
        <lfs_0194>-gstat = gc_gstat_4.       

**--Modify Primary record and get the updated container reference back
        ls_container ?=
        lr_container_temp_0194->modify_primary_record( <lfs_0194> ).

**-----For Text---****--Modify Primary record and get the updated container reference back

**Below method  is method to update ITXEX and table lt_text_0194 must have some  text to update ITXEX.

             append 'TEXT' to lt_text_194.


       
try.
            lr_container_temp_0194 ?= ls_container.
            ls_container ?= lr_container_temp_0194->modify_text_tab( lt_text_194 ).
         
catch cx_hrpa_violated_assertion into ls_exp.
            lw_message = ls_exp->get_text( ).
       
endtry.

      *Modify the record -After this  method check PA0194  for specific record ITXEX should be 'X'
       
try.
            lo_0194->if_hrpa_infty_bl~
modify(
              
exporting
                 old_container   = lr_container_temp_0194
                 massn           = space
                 massg           = space
                 update_mode     = lw_update_mode
                 no_auth_check   =
''
                 message_handler = fr_msg_handler
"Message handler
             
importing
               is_ok           = lw_ok       
"Ok flag
             
changing
                container       = ls_container ).
"Infty Container.
         
catch cx_hrpa_violated_assertion into ls_exp.
            lw_message = ls_exp->get_text( ).
       
endtry.
       
if lw_ok ne gc_true and lw_message is not initial.

           

                 try.
                       cl_hrpa_masterdata_bl=>get_instance(
                       importing
                     masterdata_bl = lw_masterdata_buffer ).
 
                  catch cx_hrpa_violated_assertion into lw_exp.
                  endtry.
          lw_masterdata_buffer->if_hrpa_buffer_control~flush( space ). "DB update
              endif.

***Till here  we updated ITXEX = 'X' in IT1094 and  other fields of 194 if any field  need to be updated .Below method will update text in infoytpe

   create object lr_upd_cluster.

   try.
      call method lr_upd_cluster->update
        exporting
          tclas         = zcl_c=>k_tclas_a    "'A'
          pskey         = p_pskey
          histo          = abap_true           "'X'
          uname         = sy-uname
          aedtm         = sy-datum
          pgmid         = lc_pgmid
          text_tab      = lt_text_0194
          no_auth_check = space.             "'X'
    catch   cx_hrpa_violated_assertion.                 "#EC NO_HANDLER
  endtry.

Labels in this area