Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Drop Down ABAP Reporting

adnanmaqbool
Contributor
0 Kudos
118

Dear Guys

Is it possible to do drop down list programming in ABAP as it can be done in Logistic Information System If yes then how and where I can found documentation.

Note down I dont want to use any SAP tool and want to do it with ABAP Language.

E.g.

A Main record is showing in first line of List with a drop down button. When user prsses that button then a detailed list will show under the first line containing remaining details records.

I know that button can be controled by AT User Command but how a detailed list with futher records can be shown exactly below the first line.

Please also note that I dont want to display the detailed records in a next list. I just want the details records under the first line when user presses the drop down button.

Tnx

3 REPLIES 3

Former Member
0 Kudos
85

u need a hierarchy report....

Below is a hierarchy comparison report which can be modified and used for ur reqirement.

REPORT y_hierarchies_in_tables

NO STANDARD PAGE HEADING.

PARAMETER: g_group TYPE grpname. " DEFAULT 'Z_GLAB0000'.

DATA:

g_setid TYPE setid,

g_class TYPE setclass.

DATA: lt_hier TYPE STANDARD TABLE OF sethier,

lt_val TYPE STANDARD TABLE OF setvalues.

DATA: hier LIKE sethier OCCURS 0 WITH HEADER LINE,

val LIKE setvalues OCCURS 0 WITH HEADER LINE,

setinfo LIKE setinfo OCCURS 0 WITH HEADER LINE.

DATA: zaccbas(20) TYPE c OCCURS 0 WITH HEADER LINE.

DATA: miss_val LIKE setvalues-from OCCURS 0 WITH HEADER LINE.

DATA: table_name TYPE tabname,

field_name TYPE setfld.

DATA: ambiguity_flag TYPE c.

    • Ambiguity check

PERFORM ambiguity_check.

    • Display Records

PERFORM display_records.

&----


*& Form AMBIGUITY_CHECK

&----


  • Ambiguity check

----


FORM ambiguity_check .

DATA: it_abaplist LIKE abaplist OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF it_ascilist OCCURS 0,

zeile(256) TYPE c,

END OF it_ascilist.

DATA: flag.

SUBMIT rgsovl00 "VIA SELECTION-SCREEN

WITH p_shrtn = g_group

WITH path = 'X'

EXPORTING LIST TO MEMORY

AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = it_abaplist

EXCEPTIONS

not_found = 1

OTHERS = 2.

CALL FUNCTION 'LIST_TO_ASCI'

TABLES

listasci = it_ascilist

listobject = it_abaplist

EXCEPTIONS

empty_list = 1

list_index_invalid = 2

OTHERS = 3 .

LOOP AT it_ascilist.

IF it_ascilist-zeile = text-001.

flag = 'X'.

ENDIF.

IF flag = 'X' AND

it_ascilist-zeile = text-002.

ambiguity_flag = 'X'.

CLEAR flag.

ENDIF.

ENDLOOP.

FREE MEMORY.

ENDFORM. " AMBIGUITY_CHECK

&----


*& Form DISPLAY_RECORDS

&----


  • Display the Records

----


FORM display_records .

PERFORM get_records.

PERFORM header_data.

PERFORM item_data.

ENDFORM. " DISPLAY_RECORDS

&----


*& Form GET_RECORDS

&----


  • Get all the Node values

----


FORM get_records .

    • Get the ID name for the Hierarchy

CALL FUNCTION 'G_SET_GET_ID_FROM_NAME'

EXPORTING

shortname = g_group

setclass = g_class

old_setid = g_setid

IMPORTING

new_setid = g_setid.

    • Get the Table and Field name for the Top Node

CALL FUNCTION 'G_SET_GET_INFO'

EXPORTING

setname = g_setid

no_set_title = 'X'

use_table_buffer = 'X'

IMPORTING

info = setinfo.

table_name = setinfo-tabname.

field_name = setinfo-fld.

    • Get all the Nodes for the Hierarchy

CALL FUNCTION 'G_SET_TREE_IMPORT'

EXPORTING

no_descriptions = ' '

no_rw_info = 'X'

setid = g_setid

TABLES

set_hierarchy = lt_hier

set_values = lt_val.

hier[] = lt_hier.

val[] = lt_val.

SELECT (field_name) FROM (table_name) INTO TABLE zaccbas.

LOOP AT zaccbas.

READ TABLE val WITH KEY FROM = zaccbas.

IF sy-subrc = 0.

DELETE zaccbas.

CLEAR zaccbas.

DELETE val INDEX sy-tabix.

CLEAR val.

ENDIF.

ENDLOOP.

ENDFORM. " GET_RECORDS

&----


*& Form HEADER_DATA

&----


  • Header Data

----


FORM header_data .

DATA: desc TYPE settext.

READ TABLE hier WITH KEY fieldname = field_name

shortname = g_group.

IF sy-subrc = 0.

desc = hier-descript.

ENDIF.

SKIP.

WRITE: 'Node :',g_group.

WRITE:75 'User name :', sy-uname.

WRITE:/ 'Description :', desc.

WRITE:75 'Date:', sy-datum.

WRITE:/ 'Table Name :' , table_name.

WRITE:75 'Time:', sy-timlo.

WRITE:/ 'Field Name :', field_name.

write:75 'Client:', SY-MANDT.

skip.

IF ambiguity_flag = 'X'.

WRITE:/ 'Ambiguity Check :'. WRITE: 'Success' COLOR 5.

ELSE.

WRITE:/ 'Ambiguity Check :'. WRITE: 'Failed' COLOR 6 .

ENDIF.

WRITE:/ sy-uline.

WRITE:/37 'Validation for Hierarchy'.

WRITE:/ sy-uline.

ENDFORM. " HEADER_DATA

&----


*& Form ITEM_DATA

&----


  • Output Report for Nodes

----


FORM item_data .

IF NOT zaccbas[] IS INITIAL.

WRITE:/ 'Missing Records from Hierarchy' COLOR 3.

LOOP AT zaccbas.

WRITE:/ zaccbas.

ENDLOOP.

ENDIF.

IF NOT val[] IS INITIAL.

SKIP 1.

WRITE:/ 'Additional Records in Hierarchy' COLOR 3.

LOOP AT val.

WRITE:/ val-from. ", 28 val-DESCRIPT.

ENDLOOP.

ELSEIF ZACCBAS[] IS INITIAL.

WRITE:/ 'No Missing Records Found' COLOR 3.

ENDIF.

ENDFORM. " ITEM_DATA

adnanmaqbool
Contributor
0 Kudos
85

Tnx a lot for your comments. Will you explain thisreport a bit. Its looking like a Tree base Report.

Especially can explain the purpose of this code.

SUBMIT rgsovl00 "VIA SELECTION-SCREEN

WITH p_shrtn = g_group

WITH path = 'X'

EXPORTING LIST TO MEMORY

AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = it_abaplist

EXCEPTIONS

not_found = 1

OTHERS = 2.

CALL FUNCTION 'LIST_TO_ASCI'

TABLES

listasci = it_ascilist

listobject = it_abaplist

EXCEPTIONS

empty_list = 1

list_index_invalid = 2

OTHERS = 3 .

anversha_s
Active Contributor
0 Kudos
85

hi,

Check the link to know how to populate values as a LIST(drop down list)

here is the sample piece of code,

PROGRAM zlist.
TYPE-POOLS : VRM.
DATA: param TYPE vrm_id, 
       values     TYPE vrm_values, 
       value LIKE LINE OF values. 
 
PARAMETERS: p_name(10) AS LISTBOX VISIBLE LENGTH 10.
AT SELECTION-SCREEN OUTPUT. 
  param = 'P_NAME'. 
  value-key = '1'.
  value-text = 'NAME1'.
  APPEND value TO values.
  value-key = '2'. 
  value-text = 'NAME2'.
  APPEND value TO values. 
*--and so onnn
  CALL FUNCTION 'VRM_SET_VALUES' 
    EXPORTING id     = param 
              values = values.

Rgds

Anver

<b><i>pls mark all helpful answers</i></b>