01-13-2006 11:53 AM
Hello,
I need to implement inbound debmas and we have appends to tables kna1 and knvv. We also implemented corresponding IDoc-segments Z1KNA1 and Z1KNVV to fill the appends with this data and bild an idoc extension with these segments.
I tried to implement badi ZCL_IM__CUST_ADD_DATA_BI, but I have no clue, what I really need to implement. I assume PASS_NON_STANDARD_SEGMENT, FILL_BI_TABLE_WITH_OWN_SEGMENT and FILL_FT_TABLE_USING_DATA_ROWS are the correct methods.
Has anybody implemented something like this or has a coding example for me.
Kind regards,
Dieter
01-13-2006 12:11 PM
Hi Dieter!
In the following our coding for this BADI
METHOD if_ex_customer_add_data_bi~check_data_row.
CASE i_structname.
WHEN 'ZZMD_ZZKNVV'.
e_structure_checked = 'X'.
ENDCASE.
method IF_EX_CUSTOMER_ADD_DATA_BI~FILL_ALE_SEGMENTS_OWN_DATA.
CASE i_segment_name.
WHEN 'E1KNVVM'.
* The additional field zzcatreq is moved
ls_idoc_data-segnam = 'Z1KNVVM'.
* fill fields from Z1KNVV
CLEAR ls_z1knvvm.
ASSIGN i_data_ref->* TO <fs_knvv>.
MOVE: <fs_knvv>-zzcatreq TO ls_z1knvvm-zzcatreq.
ls_idoc_data-sdata = ls_z1knvvm.
* if necessary reduce fields of segment
CALL FUNCTION 'IDOC_REDUCTION_FIELD_REDUCE'
EXPORTING
message_type = i_message_type
segment_type = ls_idoc_data-segnam
segment_data = ls_idoc_data-sdata
IMPORTING
segment_data = ls_idoc_data-sdata.
APPEND ls_idoc_data TO t_idoc_data.
WHEN 'E1KNVKM'.
...
METHOD if_ex_customer_add_data_bi~fill_bi_table_with_own_segment.
IF NOT gs_zzknvv IS INITIAL.
* Initialize Batch Input structure
* All should have the nodata indicator before being assigned
* values from the IDOC segment.
ls_izzknvv-stype = '2'.
ls_izzknvv-tbnam = 'ZZMD_ZZKNVV'.
ls_izzknvv-zzcatreq = gc_nodata.
ls_izzknvv-sende = gc_nodata.
lw_zzknvv = ls_izzknvv.
* End of initialization of batch input structure
* Assign Segment data to batch input structure
IF gs_zzknvv-zzcatreq <> gc_nodata.
MOVE gs_zzknvv-zzcatreq TO lwa_zzknvv-zzcatreq.
WRITE lwa_zzknvv-zzcatreq TO lw_zzknvv-zzcatreq.
ENDIF.
* End of batch input structure assign
* Move batch input structure data to table to be passed
* back to the main program.
bi_data = lw_zzknvv.
APPEND bi_data.
CLEAR gs_zzknvv.
ENDIF.
method IF_EX_CUSTOMER_ADD_DATA_BI~FILL_FT_TABLE_USING_DATA_ROWS.
* at the beginning the button is not pushed:
CLEAR: g_flg_pushed.
LOOP AT it_data_rows INTO l_f_data_row.
l_structname = l_f_data_row+1(30).
CASE l_structname.
WHEN 'ZZMD_ZZKNVV'.
ls_zzmd_zzknvv = l_f_data_row.
perform fill_ft_zzmd_zzknvv tables et_ft
using ls_zzmd_zzknvv
i_nodata.
ENDCASE.
ENDLOOP.
----------------------
FORM fill_ft_zzmd_zzknvv TABLES t_ft STRUCTURE bdcdata
* using u_f_pso43 like pso43
* using u_f_bfmpsoisd like bfmpsoisd
USING u_f_zzmd_zzknvv TYPE zzmd_zzknvv
u_nodata.
DATA: l_f_ft_ins TYPE bdcdata, "ok
l_okcode LIKE sy-tcode, "ok
l_type(1) TYPE c,
l_dynpro LIKE sy-dynnr, "ok
l_field LIKE bdcdata-fval. "ok
* check that sub-ledger account proc. is active
* check u_f_pso43-accproc = 'X'.
* push the button for Getro data (if not pushed yet)
PERFORM ft_push_is_ps TABLES t_ft.
* now go to tabstrip with sub-ledger account procedure
PERFORM ft_dynpro_begin TABLES t_ft
USING con_rep_name_d
'4000'.
l_okcode = '=T01'. "this is tabstrip no. 1
PERFORM ft_fill_okcode TABLES t_ft
USING l_okcode.
l_field = 'KNVV-ZZCATREQ'.
PERFORM ft_set_cursor TABLES t_ft
USING l_field.
IF u_f_zzmd_zzknvv NE u_nodata.
CLEAR l_f_ft_ins.
l_f_ft_ins-fnam = l_field.
l_f_ft_ins-fval = u_f_zzmd_zzknvv-zzcatreq.
APPEND l_f_ft_ins TO t_ft.
ENDIF.
* press back button
l_okcode = 'UPDA'.
PERFORM ft_fill_okcode TABLES t_ft
USING l_okcode.
method IF_EX_CUSTOMER_ADD_DATA_BI~PASS_NON_STANDARD_SEGMENT.
CASE segment_name.
WHEN gc_z1knvvm.
gs_zzknvv = segment_data.
ENDCASE.
It's a shortened version - data declarations where skipped and sometimes similiar coding, too.
Regards,
Christian
03-01-2006 5:50 AM
Hi,
Can you please post complete coding including the data dclaration part.
Thanks
Prem
03-03-2006 8:02 AM
Hi Prem!
I'm not sure, if this can be of any help for you - it refers to Z-dictionary definitions. But anyway, here the definition for method FILL_ALE_SEGMENTS_OWN_DATA:
data: ls_idoc_data type edidd,
ls_z1knvvm type z1knvvm,
ls_z1knvkm type z1knvkm.
field-symbols: <fs_knvv> type knvv,
<fs_knvk> type knvk.
and for method FILL_FT_TABLE_USING_DATA_ROWS:
data: lwa_zzknvv type zzknvv,
lw_zzknvv type zzmd_zzknvv,
char(61) type c.
data: begin of ls_izzknvv.
include structure zzmd_zzknvv.
data: end of ls_izzknvv.
data: begin of nametab occurs 60.
include structure dntab.
data: end of nametab.
but I might have missed some forms...
form ft_push_is_ps tables t_ft structure bdcdata.
data: l_f_ft_ins type bdcdata.
if g_flg_pushed = ' '.
g_flg_pushed = 'X'.
* okcode is dynamically determined by FI: okcode
* must have the form BAO + filter value (for us PS)
clear l_f_ft_ins.
l_f_ft_ins-fnam = 'BDC_OKCODE'.
l_f_ft_ins-fval = con_okcode_isps.
append l_f_ft_ins to t_ft.
endif.
endform. " ft_push_is_ps
form ft_dynpro_begin tables t_ft structure bdcdata
using u_program
u_dynpro.
data: l_f_ft_ins type bdcdata.
clear l_f_ft_ins.
l_f_ft_ins-program = u_program.
l_f_ft_ins-dynpro = u_dynpro.
l_f_ft_ins-dynbegin = 'X'.
append l_f_ft_ins to t_ft.
endform. " ft_dynpro_begin
form ft_fill_okcode tables t_ft structure bdcdata
using u_okcode like sy-tcode.
data: l_f_ft_ins type bdcdata.
clear l_f_ft_ins.
l_f_ft_ins-fnam = 'BDC_OKCODE'.
l_f_ft_ins-fval = u_okcode.
append l_f_ft_ins to t_ft.
endform. " ft_fill_okcode
form ft_set_cursor tables t_ft structure bdcdata
using u_field like bdcdata-fval.
data: l_f_ft_ins type bdcdata.
clear l_f_ft_ins.
l_f_ft_ins-fnam = 'BDC_CURSOR'.
l_f_ft_ins-fval = u_field.
append l_f_ft_ins to t_ft.
endform. " ft_set_cursor
The programmer placed Z-function modules inside of the BADI. This might lead to slightly different parameter names (e.g. i_segment_data of pass_non_standard_segment was called segment_data), but that shouldn't be a problem for you.
You won't get more information in case two fields are handled identical, so I only posted the code for one field.
Because of the function module / form routine usage I'm in a totally different surrounding with >1000 lines of code - but big parts aren't relevant for this BADI. Also break-points, comments and deactivated coding is of no need for you -> some shortening makes it easier.
Regards,
Christian