Skip to Content
0
Former Member
Jan 08, 2008 at 11:11 AM

ALV tree column - code help

137 Views

Hi all,

Can any suggest me a code for displaying the below program in alv tree column.

merlin

REPORT Z_MANFIELD.

DATA: d_screen TYPE REF TO cl_dynpro_info.

  • for field list of screen

DATA: ftab TYPE TABLE OF d021s,

wa_ftab TYPE d021s,

pltab TYPE TABLE OF d022s.

  • name of modulpool

DATA: mpool TYPE repid,

mpool2 type repid.

  • for screen attributes of field

DATA: es_screen TYPE screen.

DATA: back TYPE t588m-varky.

DATA: status.

DATA: pos TYPE i.

DATA: p_infty TYPE infty.

DATA: dynnr type dynnr value '2000'.

FIELD-SYMBOLS: <scf>.

TABLES: t588m, pme04,t588d.

constants: calc_molga type molga value ' '.

  • for collection of mandatory fields

DATA: BEGIN OF mf_tab OCCURS 0,

fnam TYPE d021s-fnam,

  • added for distinction of default and T588M

group TYPE char4,

END OF mf_tab.

DATA : BEGIN OF wa,

infty TYPE infty,

END OF wa.

DATA itab LIKE wa OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(12) text-001.

PARAMETER action TYPE t588d-itygr.

SELECTION-SCREEN END OF LINE.

  • for field attributes

START-OF-SELECTION.

SELECT infty INTO CORRESPONDING FIELDS OF TABLE itab FROM t588d WHERE itygr = action.

IF sy-subrc EQ 0.

WRITE : / 'INFOTYPES FOR THIS ACTION TYPE ARE : '.

SORT itab BY infty.

DELETE ADJACENT DUPLICATES FROM itab COMPARING infty.

LOOP AT itab.

WRITE : / itab-infty HOTSPOT COLOR 6 INVERSE ON.

ENDLOOP.

WRITE /.

WRITE : / ' CLICK AN INFOTYPE FOR GETTING ITS MANDATORY FIELDS'.

ELSE.

WRITE : / 'SORRY,NO INFOTYPE FOR THIS ACTION TYPE'.

ENDIF.

AT LINE-SELECTION.

MOVE sy-lisel(6) TO p_infty.

WRITE: / 'INFOTYPE - '.

WRITE : p_infty.

WRITE : /'MANDATORY FIELDS ARE :'.

WRITE : / .

  • build modulpool-name

CREATE OBJECT d_screen.

CONCATENATE 'MP' p_infty '00' INTO mpool2.

CONCATENATE mpool2 '_CE' into mpool.

  • maybe, you have to determin the screen-no first

perform determin_scrno CHANGING dynnr.

SELECT SINGLE * FROM t588m WHERE repna = mpool

AND dynnr = dynnr

AND varky = calc_molga.

IF sy-subrc NE 0. "not found -> switch to default MOLGA

SELECT SINGLE * FROM t588m WHERE repna LIKE mpool

AND dynnr = dynnr

AND varky = space.

IF sy-subrc NE 0. "still not there -> fall back to dflt modulpool with MOLGA

mpool = mpool2.

SELECT SINGLE * FROM t588m WHERE repna = mpool

AND dynnr = dynnr

AND varky = calc_molga.

IF sy-subrc ne 0. "Last try -> dflt modulpool + empty MOLGA

SELECT SINGLE * FROM t588m WHERE repna LIKE mpool

AND dynnr = dynnr

AND varky = space.

IF sy-subrc ne 0. "obviously, there isn't ana entry at all

clear t588m.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

  • This part really depends on your

  • settings of feature Pnnnn

  • in your case (varkey = MOLGA) we will skip it (l.a.)

  • IF t588m-zykls NE space.

  • SELECT SINGLE bukrs werks btrtl persg persk

  • FROM pa0001

  • INTO pme04 WHERE

  • begda LE sy-datum

  • AND endda GE sy-datum

  • AND sprps EQ space.

*

  • PERFORM re549d USING t588m-zykls space back status.

*

  • IF NOT back IS INITIAL.

  • SELECT SINGLE * FROM t588m

  • WHERE repna = mpool

  • AND dynnr = '2000'

  • AND varky = back.

  • IF sy-subrc NE 0.

  • CLEAR t588m.

  • ENDIF.

  • ENDIF.

*

  • ENDIF.

  • only to ensure that these fields are filled

IF t588m IS INITIAL.

t588m-repna = mpool.

t588m-dynnr = dynnr.

ENDIF.

  • get fieldlist for screen

CALL FUNCTION 'RS_IMPORT_DYNPRO'

EXPORTING

dylang = sy-langu

dyname = t588m-repna

dynumb = t588m-dynnr

request = ' '

suppress_checks = ' '

  • IMPORTING

  • HEADER =

TABLES

ftab = ftab

pltab = pltab

EXCEPTIONS

button_error = 1

dylanguage_invalid = 2

dylanguage_not_inst = 3

dyname_invalid = 4

dynproload_not_found = 5

dynpro_old = 6

dynumb_invalid = 7

ftab_invalid = 8

gen_error = 9

gen_ok = 10

header_invalid = 11

internal_error = 12

no_dynpro = 13

no_ftab_row = 14

no_memory = 15

no_processlogic = 16

pltab_invalid = 17

request_invalid = 18

OTHERS = 19

.

IF sy-subrc EQ 0.

  • error handling

ENDIF.

  • get rid of comments, frames and the like

DELETE ftab WHERE aglt IS INITIAL.

LOOP AT ftab INTO wa_ftab.

  • Screen-Grp3 is the key to T588M-DBILD

IF wa_ftab-grp3 NE space.

pos = wa_ftab-grp3 - 1.

ASSIGN t588m-dbild+pos(1) TO <scf>.

  • mandatory fields are marked '+'

IF <scf> EQ '+'.

  • APPEND wa_ftab-grp3 to mf_tab.

  • changed to

MOVE wa_ftab-fnam TO mf_tab-fnam.

MOVE wa_ftab-grp3 TO mf_tab-group.

APPEND mf_tab.

CONTINUE.

ENDIF.

ENDIF.

  • maybe the field is mandatory by default

CALL METHOD d_screen->get_screen_field_attr

EXPORTING

iv_repid = t588m-repna

iv_dynnr = t588m-dynnr

iv_field = wa_ftab-fnam

IMPORTING

es_screen = es_screen

EXCEPTIONS

exc_insufficient_parameters = 1

exc_no_attributes = 2

OTHERS = 3.

IF sy-subrc EQ 0.

  • error handling

ENDIF.

IF es_screen-required NE space.

  • append wa_ftab-grp3 to mf_tab.

  • changed to

MOVE wa_ftab-fnam TO mf_tab-fnam.

MOVE 'Dflt' TO mf_tab-group.

APPEND mf_tab.

ENDIF.

ENDLOOP.

  • simple output

LOOP AT mf_tab.

WRITE: / mf_tab-fnam,

  • added

mf_tab-group.

ENDLOOP.

  • added

CLEAR: mf_tab, mf_tab[].

END-OF-SELECTION.

  • INCLUDE rpumkc00. "without evaluation of feature, it's not necessary

&----


*& Form determin_scrno

&----


  • do some terribly tricky stuff to get to know the screen no

----


  • <--P_DYNNR text

----


form determin_scrno changing p_dynnr.

  • do, what ever has to be done here

endform. " determin_scrno