SAP for Utilities Discussions
Connect with fellow SAP users to share best practices, troubleshoot challenges, and collaborate on building a sustainable energy future. Join the discussion.
cancel
Showing results for 
Search instead for 
Did you mean: 

Write the correspondense container without ISU SAMPLE function modules

Former Member
0 Kudos

Hi,

i must write a function module, which must write a table into the correspondence container, with some information (contract, move-in document, etc.)

I wrote the function module to the end and i am by the test now, but it didnt works...

I tell you the logic of my report, please tell me if i made errors.

Logic:

1. i make a COKEY with funcmod FKK_CREATE_COKEY

2. Fill the header information with COKEY, COTYP, FORMKEY and datum

3. i make a HEADER with funcmod FKK_FLDS_2_HEADER with COKEY and COTYP '0017' and headerinformation

4. Then i make an export to the database:

EXPORT t_begr_custom_key FROM lt_custom_cluster

TO DATABASE dfkkcodclust(co)

ID ed_cokey.

5. SELECT * FROM dfkkcodclust INTO TABLE lt_dfkkcodclust

WHERE relid = 'CO' AND

cokey = ed_cokey.

6. Then i must use this:

CALL FUNCTION 'FKK_CORR_SINGLE_INDICATOR_SET'.

But i dont know why?

7. And for the end:

CALL FUNCTION 'FKK_WRITE_CORR'

EXPORTING

i_fkkcoinfo = lw_fkkcoinfo "Info field

TABLES

t_dfkkcodclust = lt_dfkkcodclust "The table what i want to write to the correspondence container

CHANGING

c_dfkkcoh = lw_dfkkcoh_satz. "Header info

At the end of the report, i didnt see any changes in the DB nor everywhere.

Why didnt it work?

Please help, thank you!

Regards,

Zoltan Berkes

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Just keep the Break-point on internal table of your select query to get to know whether values has been passing or not.

keep break point and check ,you will come to know y the datas r not coming .

Thanks

SIva

View solution in original post

3 REPLIES 3

Former Member
0 Kudos

PERFORM data_populate. "" Below it is there...

----


FORM data_to_cluster TABLES p_lt_dfkkcodclust STRUCTURE dfkkcodclust

USING p_gv_dfkkcoh_cotyp TYPE cotyp_kk

p_lv_cluster TYPE any.

  • Declaration of temporarykey

DATA:

lv_cokey_temporary TYPE cokey_kk.

  • Refresh P_LT_DFKKCODCLUST

REFRESH p_lt_dfkkcodclust.

  • Get a temporary correspondence key for the EXPORT below.

  • This temporary key and data will be subsequently cleaned up

  • by the call to function module FKK_CORR_WRITE.

CALL FUNCTION 'FKK_CREATE_COKEY'

EXPORTING

i_cotyp = p_gv_dfkkcoh_cotyp

IMPORTING

e_cokey = lv_cokey_temporary.

  • We have to write the application data to the correspondence

  • cluster using the EXPORT command. This gets it into the

  • internal cluster format, which we read back into the cluster

  • internal table YT_DFKKCODCLUST. This is not a good approach

  • in general, but it is the way SAP does it.

EXPORT data FROM p_lv_cluster TO DATABASE dfkkcodclust(co)

ID lv_cokey_temporary.

  • Now we've exported the application data to the cluster table,

  • we need to read it back in again to get it in internal format.

SELECT *

INTO TABLE p_lt_dfkkcodclust

FROM dfkkcodclust

WHERE relid EQ gc_relid

AND cokey EQ lv_cokey_temporary.

CLEAR lv_cokey_temporary.

ENDFORM. " data_to_cluster

&----


*& Form data_populate

&----


  • Populating internal tables

----


FORM data_populate .

DATA :

lv_cluster TYPE char3000,

lv_partner(10) TYPE c,

lt_dfkkcodclust TYPE STANDARD TABLE OF dfkkcodclust.

  • Get the Address details by passing the business partner number.

CALL FUNCTION 'ZICA001_ADDRESS_RETRIEVAL'

EXPORTING

x_address_type = 'B'

x_partner = p_partnr

IMPORTING

address_line = gv_adrs_print

region = gv_regio

postcode = gv_pstcd1

country = gv_land1.

IF sy-subrc = 0.

gv_dfkkcoh-data1 = gv_adrs_print-line0.

gv_dfkkcoh-data2 = gv_adrs_print-line1.

gv_dfkkcoh-data3 = gv_adrs_print-line2.

gv_dfkkcoh-data4 = gv_adrs_print-line3.

ENDIF.

gv_fkkcoinfo-coidt = sy-datum.

gv_dfkkcoh-cotyp = gc_cotyp.

gv_dfkkcoh-gpart = gt_fkkvkp-gpart.

gv_dfkkcoh-vkont = gt_fkkvkp-vkont.

gv_dfkkcoh-entid1 = p_tempid.

gv_dfkkcoh-spras = sy-langu.

gv_dfkkcoh-coitm = sy-uzeit.

*Add SIR#Phoen00003382

gv_dfkkcoh-formkey = gc_formkey .

*End Add SIR#Phoen00003382

lv_partner = gt_fkkvkp-gpart.

  • Create the cluster line.

CLEAR lv_cluster.

CONCATENATE '||11111111|11111111|11111111|11111111|'

lv_partner

'|||||||||||||||||||||||||||||||||||||||||||||'

INTO lv_cluster.

  • Put the application data into internal cluster format

PERFORM data_to_cluster

TABLES lt_dfkkcodclust

USING gv_dfkkcoh-cotyp

lv_cluster.

  • Call The Function Module for write in the tables DFKKCOH and

  • Write the entry to the correspondence container

CALL FUNCTION 'FKK_WRITE_CORR'

EXPORTING

i_fkkcoinfo = gv_fkkcoinfo

TABLES

t_dfkkcodclust = lt_dfkkcodclust

CHANGING

c_dfkkcoh = gv_dfkkcoh.

IF sy-subrc = 0.

ENDIF.

CLEAR:

lt_dfkkcodclust,gt_fkkvkp,lv_partner,

lv_cluster,gv_land1,gv_pstcd1,gv_regio,

gv_fkkcoinfo,gv_dfkkcoh,gv_adrs_print,gv_desc.

REFRESH : lt_dfkkcodclust,gt_fkkvkp.

ENDFORM. " data_populate

Regards,

Shiva Kumar

Former Member
0 Kudos

Hi,

Just keep the Break-point on internal table of your select query to get to know whether values has been passing or not.

keep break point and check ,you will come to know y the datas r not coming .

Thanks

SIva

Former Member
0 Kudos

Thanks guys, you were very helpful, my programm is working now.

Thanks again!

Zoltan Berkes