SAP Function Modules

TXW_SEGMENT_REBUILD SAP Function module - Export segment rebuilding from data using forms if necessary







TXW_SEGMENT_REBUILD is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name TXW_SEGMENT_REBUILD into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: TXW2
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM TXW_SEGMENT_REBUILD - TXW SEGMENT REBUILD





CALL FUNCTION 'TXW_SEGMENT_REBUILD' "Export segment rebuilding from data using forms if necessary
  EXPORTING
    p_form =                    "               Flag to show if internal program to be used
    p_form_prog =               "               Internal program name for conversion
    p_segment_structure =       " txw_dirsg2-exp_struct  Segment to be rebuilt
*   p_flag_collect = SPACE      "               Flag: collect export data in t_out_data
    p_segdat_len6 =             " flag          segdat length = 6
  TABLES
    t_buf_txw_meta =            " txw_meta      Meta data in global buffer
    t_itxw_meta =               " txw_meta      Meta data
    t_itxw_dirsg2 =             " txw_dirsg2    Segment data, segtype ...
    t_itxw_dir2 =               " txw_dir2      Input for filename and compression
*   t_out_data =                " txw_data      Holder for records, if collect flag
    .  "  TXW_SEGMENT_REBUILD

ABAP code example for Function Module TXW_SEGMENT_REBUILD





The ABAP code below is a full code listing to execute function module TXW_SEGMENT_REBUILD including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
it_t_buf_txw_meta  TYPE STANDARD TABLE OF TXW_META,"TABLES PARAM
wa_t_buf_txw_meta  LIKE LINE OF it_t_buf_txw_meta ,
it_t_itxw_meta  TYPE STANDARD TABLE OF TXW_META,"TABLES PARAM
wa_t_itxw_meta  LIKE LINE OF it_t_itxw_meta ,
it_t_itxw_dirsg2  TYPE STANDARD TABLE OF TXW_DIRSG2,"TABLES PARAM
wa_t_itxw_dirsg2  LIKE LINE OF it_t_itxw_dirsg2 ,
it_t_itxw_dir2  TYPE STANDARD TABLE OF TXW_DIR2,"TABLES PARAM
wa_t_itxw_dir2  LIKE LINE OF it_t_itxw_dir2 ,
it_t_out_data  TYPE STANDARD TABLE OF TXW_DATA,"TABLES PARAM
wa_t_out_data  LIKE LINE OF it_t_out_data .

DATA(ld_p_form) = 'some text here'.
DATA(ld_p_form_prog) = 'some text here'.

SELECT single EXP_STRUCT
FROM TXW_DIRSG2
INTO @DATA(ld_p_segment_structure).

DATA(ld_p_flag_collect) = 'some text here'.
DATA(ld_p_segdat_len6) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_t_buf_txw_meta to it_t_buf_txw_meta.

"populate fields of struture and append to itab
append wa_t_itxw_meta to it_t_itxw_meta.

"populate fields of struture and append to itab
append wa_t_itxw_dirsg2 to it_t_itxw_dirsg2.

"populate fields of struture and append to itab
append wa_t_itxw_dir2 to it_t_itxw_dir2.

"populate fields of struture and append to itab
append wa_t_out_data to it_t_out_data. . CALL FUNCTION 'TXW_SEGMENT_REBUILD' EXPORTING p_form = ld_p_form p_form_prog = ld_p_form_prog p_segment_structure = ld_p_segment_structure * p_flag_collect = ld_p_flag_collect p_segdat_len6 = ld_p_segdat_len6 TABLES t_buf_txw_meta = it_t_buf_txw_meta t_itxw_meta = it_t_itxw_meta t_itxw_dirsg2 = it_t_itxw_dirsg2 t_itxw_dir2 = it_t_itxw_dir2 * t_out_data = it_t_out_data . " TXW_SEGMENT_REBUILD
IF SY-SUBRC EQ 0. "All OK ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_p_form  TYPE STRING ,
it_t_buf_txw_meta  TYPE STANDARD TABLE OF TXW_META ,
wa_t_buf_txw_meta  LIKE LINE OF it_t_buf_txw_meta,
ld_p_form_prog  TYPE STRING ,
it_t_itxw_meta  TYPE STANDARD TABLE OF TXW_META ,
wa_t_itxw_meta  LIKE LINE OF it_t_itxw_meta,
ld_p_segment_structure  TYPE TXW_DIRSG2-EXP_STRUCT ,
it_t_itxw_dirsg2  TYPE STANDARD TABLE OF TXW_DIRSG2 ,
wa_t_itxw_dirsg2  LIKE LINE OF it_t_itxw_dirsg2,
ld_p_flag_collect  TYPE STRING ,
it_t_itxw_dir2  TYPE STANDARD TABLE OF TXW_DIR2 ,
wa_t_itxw_dir2  LIKE LINE OF it_t_itxw_dir2,
ld_p_segdat_len6  TYPE FLAG ,
it_t_out_data  TYPE STANDARD TABLE OF TXW_DATA ,
wa_t_out_data  LIKE LINE OF it_t_out_data.

ld_p_form = 'some text here'.

"populate fields of struture and append to itab
append wa_t_buf_txw_meta to it_t_buf_txw_meta.
ld_p_form_prog = 'some text here'.

"populate fields of struture and append to itab
append wa_t_itxw_meta to it_t_itxw_meta.

SELECT single EXP_STRUCT
FROM TXW_DIRSG2
INTO ld_p_segment_structure.


"populate fields of struture and append to itab
append wa_t_itxw_dirsg2 to it_t_itxw_dirsg2.
ld_p_flag_collect = 'some text here'.

"populate fields of struture and append to itab
append wa_t_itxw_dir2 to it_t_itxw_dir2.
ld_p_segdat_len6 = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_t_out_data to it_t_out_data.

SAP Documentation for FM TXW_SEGMENT_REBUILD


Note: This requires the p_form_prog to have been generated prior to being called. This has been done for programs rtxwcf05 and rtxwmg01. ...See here for full SAP fm documentation















Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name TXW_SEGMENT_REBUILD or its description.