0% found this document useful (0 votes)
31 views2 pages

Programa Ejemplo Manejo FIELD SYMBOLS

This document provides an example program for using FIELD SYMBOLS in ABAP. The program defines parameters, data objects including tables and field symbols. It selects data from tables BSAG and BSIK based on the parameters into the tables. It then assigns the tables to field symbols and loops through, assigning components of the table entries to internal variables using the field symbols and appending the variables to a secondary table which is output.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views2 pages

Programa Ejemplo Manejo FIELD SYMBOLS

This document provides an example program for using FIELD SYMBOLS in ABAP. The program defines parameters, data objects including tables and field symbols. It selects data from tables BSAG and BSIK based on the parameters into the tables. It then assigns the tables to field symbols and loops through, assigning components of the table entries to internal variables using the field symbols and appending the variables to a secondary table which is output.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Programa ejemplo manejo FIELD SYMBOLS (ABAP,

FIELD SYMBOLS)

REPORT  ztest_field_symbol.

PARAMETERS:
p_bukrs TYPE bseg-bukrs,
p_gjahr TYPE bseg-gjahr,
p_belnr TYPE bseg-belnr.

DATA:
t_bsak TYPE STANDARD TABLE OF bsak,
t_bsik TYPE STANDARD TABLE OF bsik,
BEGIN OF t_data OCCURS 0,
  belnr  TYPE belnr_d,
  augbl  TYPE augbl,
END OF t_data,
s_data LIKE LINE OF t_data.
FIELD-SYMBOLS:
<bs*k_tab> TYPE ANY TABLE,
<bs*k> TYPE any,
<any> TYPE any.

REFRESH: t_bsak[], t_bsik[].
SELECT * FROM bsak INTO TABLE t_bsak
WHERE augbl EQ p_belnr
AND bukrs EQ p_bukrs
AND belnr NE p_belnr.
IF sy-subrc NE 0.
  SELECT * FROM bsik INTO TABLE t_bsik
  WHERE bukrs EQ p_bukrs
  AND belnr EQ p_belnr
  AND gjahr EQ p_gjahr.
  IF sy-subrc EQ 0.
  ENDIF.
ENDIF.

BREAK-POINT.

IF t_bsak[] IS NOT INITIAL.
  ASSIGN TABLE FIELD t_bsak TO <bs*k_tab>.
ELSE.
  ASSIGN TABLE FIELD t_bsik TO <bs*k_tab>.
ENDIF.

REFRESH: t_data[]. CLEAR: s_data.
UNASSIGN <bs*k>.
LOOP AT <bs*k_tab> ASSIGNING <bs*k>.

  UNASSIGN: <any>.
  ASSIGN COMPONENT 'BELNR' OF STRUCTURE <bs*k> TO <any>.
  IF sy-subrc EQ 0.
    MOVE <any> TO s_data-belnr.
  ENDIF.

  UNASSIGN: <any>.
  ASSIGN COMPONENT 'AUGBL' OF STRUCTURE <bs*k> TO <any>.
  IF sy-subrc EQ 0.
    MOVE <any> TO s_data-augbl.
  ENDIF.
  APPEND s_data TO t_data.
  CLEAR: s_data.

ENDLOOP.

BREAK-POINT.

http://einleer-abap.blogspot.com/2017/06/programa-ejemplo-manejo-field-symbols.html

You might also like