Current Position:Home > To get details after second list in interactive report

To get details after second list in interactive report

Update:10-11Source: network consolidation
Advertisement
hai abap experts,
i got a problem, i have written acode in which 3rd list is not executing how to write code for 3rd list(my 3rd list is to get item details by call transaction 'me23')
i'll send u all my  code lz check n help out.
TABLES : EKKO,
         EKPO,
         LFA1,
         EKET.
SELECT-OPTIONS :  S_LIFNR FOR EKKO-LIFNR,
                  S_BSART FOR EKKO-BSART,
                  S_AEDAT FOR EKKO-AEDAT.
************************INTERNAL TABLES*******************************
DATA : BEGIN OF RESULTS OCCURS 1000,    "DATA RETRIEVAL RESULTS
             LIFNR LIKE EKKO-LIFNR,
             EBELN LIKE EKKO-EBELN,
             EBELP LIKE EKPO-EBELP,
             AEDAT LIKE EKKO-AEDAT,
             ERNAM LIKE EKKO-ERNAM,
             LINES(3) TYPE N,
             NETWR LIKE EKPO-NETWR,
             MENGE LIKE EKPO-MENGE,
             WEMNG LIKE EKET-WEMNG,
             TXZ01 LIKE EKPO-TXZ01,
      END OF RESULTS.
DATA : BEGIN OF WRK,                       "WORK FIELD DEFINATIONS
          HDRSW(1),                        "LIST HEADER SWITCH
          TITLE2(40),                      "2ND TITLE LINE FOR REPORT
       END OF WRK.
DATA : BEGIN OF SELECT,                    "USER SELECTION FIELDS
            EBELN LIKE EKKO-EBELN,         "PURCHASE ORDER NO
            CHECKBOX(1) TYPE C,
       END OF SELECT.
DATA : BEGIN OF STATS,                      "STATISTICS
       START_TIME LIKE SY-UZEIT,
       END_TIME LIKE SY-UZEIT,
       PROC_TIME LIKE SY-UZEIT,
       RECS_EKPO LIKE SY-DBCNT,
       RECS_EKKO LIKE SY-DBCNT,
   END OF STATS.
**************************EVENTS**************************************
INITIALIZATION.
  CLEAR S_AEDAT.
  S_AEDAT-SIGN = 'I'.
  S_AEDAT-OPTION = 'BT'.
  S_AEDAT-LOW = SY-DATUM - 30.
  S_AEDAT-HIGH = SY-DATUM.
  APPEND S_AEDAT.
AT SELECTION-SCREEN.
  LOOP AT S_LIFNR.
    CHECK S_LIFNR-OPTION = 'EQ'.
    SELECT SINGLE * FROM LFA1 WHERE LIFNR = S_LIFNR-LOW.
    IF SY-SUBRC NE 0.
      MESSAGE E002 WITH 'VENDOR' S_LIFNR-LOW 'NOT FOUND IN LFA1'.
    ENDIF.
  ENDLOOP.
START-OF-SELECTION.
  GET TIME.
  STATS-START_TIME = SY-UZEIT.
  SET PF-STATUS 'MAIN'.
  PERFORM DATA_RETRIEVAL.
  PERFORM PROCESS_DATA.
  PERFORM DISPLAY_LIST.
  PERFORM WRITE_SELECTIONS.
  PERFORM WRITE_STATISTICS.
AT LINE-SELECTION.
  CHECK NOT SELECT-EBELN IS INITIAL.
  PERFORM DISPLAY_ITEM_DETAIL USING SELECT-EBELN.
  CLEAR : SELECT-EBELN.
AT USER-COMMAND.
   CASE SY-UCOMM.
      WHEN 'DSA'.
        PERFORM CLEAR_ALL_SELECTED.
      WHEN 'DSL'.
         PERFORM DISPLAY_ALL_SELECTED.
   ENDCASE.
TOP-OF-PAGE.
  CASE WRK-HDRSW.
    WHEN '1'.
      WRK-TITLE2 = 'PROGRAM SELECTIONS'(002).
    WHEN '2'.
      WRK-TITLE2 = 'PROGRAM DETAIL'(003).
    WHEN '3'.
      WRK-TITLE2 = 'PROGRAM SUMMARY'(004).
    WHEN '4'.
      WRK-TITLE2 = 'PROGRAM STATISTICS'(005).
  ENDCASE.
  FORMAT COLOR COL_HEADING.
  PERFORM PGH_STANDARD_HEADING
      USING        TEXT-001
                    WRK-TITLE2.
  IF WRK-HDRSW = '2'.
    WRITE : /01 SY-VLINE,
             02 'VENDOR #'(103),
             16 SY-VLINE,
             17 'PO #'(104),
             32 SY-VLINE,
             33 'ENTRY DATE'(105),
             43 SY-VLINE,
             44 'USER'(106),
             59 SY-VLINE,
             60 'LINES'(107),
             70 SY-VLINE,
             71 'AMOUNT'(108),
             91 SY-VLINE.
    WRITE : /01 SY-ULINE(91).
  ENDIF.
  FORMAT RESET.
**************************SECONDRY LIST*******************************
TOP-OF-PAGE DURING LINE-SELECTION.
  CASE WRK-HDRSW.
    WHEN '5'.
      WRK-TITLE2 = 'DETAIL LISTING'(201).
  ENDCASE.
  FORMAT COLOR COL_HEADING.
  PERFORM PGH_STANDARD_HEADING
      USING        TEXT-001
                    WRK-TITLE2.
  IF WRK-HDRSW = '5'.
    WRITE : /01 SY-VLINE,
             02 'VENDOR #'(103),
             16 SY-VLINE,
             17 'PO #'(104),
             32 SY-VLINE,
             33 'ENTRY DATE'(105),
             43 SY-VLINE,
             44 'USER'(106),
             59 SY-VLINE.
    WRITE : /01 SY-ULINE(59).
    FORMAT COLOR COL_KEY.
    WRITE : /01 SY-VLINE,
             02 RESULTS-LIFNR,
             16 SY-VLINE,
             17 RESULTS-EBELN,
             32 SY-VLINE,
             33 RESULTS-AEDAT DD/MM/YY,
             43 SY-VLINE,
             44 RESULTS-ERNAM,
             59 SY-VLINE.
    WRITE : /01 SY-ULINE(101).
    FORMAT COLOR COL_HEADING.
    WRITE : /01 SY-VLINE,
             02 'LINE'(301),
             07 SY-VLINE,
             08 'DESCRIPTION'(302),
             48 SY-VLINE,
             49 'QTY ORDERDED'(303),
             64 SY-VLINE,
             65 'QTY RECEIVED'(304),
             80 SY-VLINE,
             81 'AMOUNT'(305),
             101 SY-VLINE.
    WRITE : /01 SY-ULINE(101).
  ENDIF.
  FORMAT RESET.
*************************SUBROUTINES**********************************
FORM DISPLAY_ALL_SELECTED.
DATA : LINE_NUMBER LIKE SY-LILLI.
          LINE_NUMBER = 1.
  DO.
  CLEAR : SELECT-CHECKBOX,
          SELECT-EBELN.
READ LINE LINE_NUMBER   FIELD VALUE SELECT-CHECKBOX
                                       SELECT-EBELN.
  IF SY-SUBRC NE 0.
        EXIT.
  ENDIF.
ADD 1 TO LINE_NUMBER.
CHECK SELECT-CHECKBOX = 'X'.
NEW-PAGE.
PERFORM DISPLAY_ITEM_DETAIL USING SELECT-EBELN.
ENDDO.
ENDFORM.
FORM CLEAR_ALL_SELECTED.
DATA : LINE_NUMBER LIKE SY-LILLI.
         LINE_NUMBER = 1.
  DO.
  READ LINE LINE_NUMBER   FIELD VALUE SELECT-CHECKBOX
                                       SELECT-EBELN.
  IF SY-SUBRC NE 0.
        EXIT.
  ENDIF.
IF SELECT-CHECKBOX = 'X'.
CLEAR : SELECT-CHECKBOX.
MODIFY LINE LINE_NUMBER FIELD VALUE SELECT-CHECKBOX
                                  SELECT-EBELN.
ENDIF.
ADD 1 TO LINE_NUMBER.
ENDDO.
ENDFORM.
FORM DATA_RETRIEVAL.
  SELECT * FROM EKKO WHERE BSART IN S_BSART
                       AND AEDAT IN S_AEDAT
                       AND LIFNR IN S_LIFNR.
    CLEAR RESULTS.
    RESULTS-LIFNR = EKKO-LIFNR.
    RESULTS-EBELN = EKKO-EBELN.
    RESULTS-AEDAT = EKKO-AEDAT.
    RESULTS-ERNAM = EKKO-ERNAM.
    SELECT * FROM EKPO WHERE EBELN = EKKO-EBELN.
      MOVE 1 TO RESULTS-LINES.
      MOVE EKPO-NETWR TO RESULTS-NETWR.
      RESULTS-EBELP = EKPO-EBELP.
      RESULTS-TXZ01 = EKPO-TXZ01.
      RESULTS-MENGE = EKPO-MENGE.
      APPEND RESULTS.
    ENDSELECT.
  ENDSELECT.
ENDFORM.                    "DATA_RETRIEVAL
FORM PROCESS_DATA.
  LOOP AT RESULTS.
    CLEAR RESULTS-WEMNG.
    SELECT * FROM EKET WHERE EBELN = RESULTS-EBELN
                   AND EBELP = RESULTS-EBELP.
      ADD EKET-WEMNG TO RESULTS-WEMNG.
    ENDSELECT.
    MODIFY RESULTS.
  ENDLOOP.
ENDFORM.                    "PROCESS_DATA
FORM DISPLAY_LIST.
  DATA : TOT_LINES(3) TYPE N.
  DATA : TOT_AMT      LIKE EKPO-NETWR.
  DATA : WRT_FLAG(1)  TYPE C.
  SORT RESULTS BY LIFNR EBELN.
  NEW-PAGE.
  WRK-HDRSW = '2'.
  LOOP AT RESULTS.
    AT END OF EBELN.
      MOVE 'X' TO WRT_FLAG.
    ENDAT.
    ADD 1 TO TOT_LINES.
    ADD RESULTS-NETWR TO TOT_AMT.
    IF WRT_FLAG = 'X'.
      WRITE : /01 SY-VLINE,
               02 SELECT-CHECKBOX AS CHECKBOX,
               04 RESULTS-LIFNR,
               16 SY-VLINE,
               17 RESULTS-EBELN,
               32 SY-VLINE,
               33 RESULTS-AEDAT MM/DD/YY,
               43 SY-VLINE,
               44 RESULTS-ERNAM,
               59 SY-VLINE,
               60 TOT_LINES,
               70 SY-VLINE,
               71 TOT_AMT,
               91 SY-VLINE.
      SELECT-EBELN = RESULTS-EBELN.
      HIDE : SELECT-EBELN.
      CLEAR : SELECT-EBELN.
      WRITE : /01 SY-ULINE(91).
      CLEAR : WRT_FLAG,
              TOT_LINES,
              TOT_AMT.
    ENDIF.
    AT END OF LIFNR.
     SUM.
      FORMAT COLOR COL_GROUP.
      WRITE : /01 SY-VLINE,
               02 'TOTAL FOR VENDOR:'(101),
                   RESULTS-LIFNR,
               70 SY-VLINE,
               71 RESULTS-NETWR,
               91 SY-VLINE.
      WRITE : /01 SY-ULINE(91).
      FORMAT RESET.
    ENDAT.
  ENDLOOP.
  IF SY-SUBRC NE 0.
    FORMAT COLOR COL_NEGATIVE.
    WRITE : /01 SY-VLINE,
             02 'NO RECORDS FOUND'(102),
             91 SY-VLINE.
    WRITE : /01 SY-ULINE(91).
    FORMAT RESET.
  ENDIF.
ENDFORM.                    "DISPLAY_LIST
FORM DISPLAY_ITEM_DETAIL USING L_EBELN.
CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
SET PARAMETER ID 'BES' FIELD L_EBELN.
*GET PARAMETER ID 'BES' FIELD L_EBELN.
  WRK-HDRSW = '5'.
  SET PF-STATUS 'STLI'.
  LOOP AT RESULTS WHERE EBELN = L_EBELN.
    WRITE : /01 SY-VLINE,
             02 RESULTS-EBELP,
             07 SY-VLINE,
             08 RESULTS-TXZ01,
             48 SY-VLINE,
             49(15) RESULTS-MENGE,
             64 SY-VLINE,
             65(15) RESULTS-WEMNG,
             80 SY-VLINE,
             81 RESULTS-NETWR,
             101 SY-VLINE.
      WRITE : /01 SY-ULINE(101).
    ENDLOOP.
  IF SY-SUBRC NE 0.
    FORMAT COLOR COL_NEGATIVE.
    WRITE : /01 SY-VLINE,
             02 'NO RECORDS FOUND'(102),
             91 SY-VLINE.
    WRITE : /01 SY-ULINE(91).
    FORMAT RESET.
  ENDIF.
ENDFORM.                    "DISPLAY_ITEM_DETAIL
FORM WRITE_SELECTIONS.
  NEW-PAGE.
  WRK-HDRSW = '1'.
  WRITE : /01 SY-VLINE,
           02 'VENDOR NUMBER'(112),
           25 SY-VLINE.
  LOOP AT S_LIFNR.
    WRITE : 26 S_LIFNR,
            91 SY-VLINE.
    WRITE : /01 SY-ULINE(91).
  ENDLOOP.
  IF SY-SUBRC NE 0.
    WRITE : 26 '*ALL*'(200),
            91 SY-VLINE.
    WRITE : /01 SY-ULINE(91).
  ENDIF.
  WRITE : /01 SY-VLINE,
           02 'PO TYPE'(111),
           25 SY-VLINE.
  LOOP AT S_BSART.
    WRITE : 26 S_BSART,
            91 SY-VLINE.
    WRITE : /01 SY-ULINE(91).
  ENDLOOP.
  IF SY-SUBRC NE 0.
    WRITE : 26 '*ALL*'(200),
            91 SY-VLINE.
    WRITE : /01 SY-ULINE(91).
  ENDIF.
  WRITE : /01 SY-VLINE,
           02 'ENTRY DATES'(112),
           25 SY-VLINE.
  LOOP AT S_AEDAT.
    WRITE : 26 S_AEDAT,
            91 SY-VLINE.
    WRITE : /01 SY-ULINE(91).
  ENDLOOP.
  IF SY-SUBRC NE 0.
    WRITE : 26 '*ALL*'(200),
            91 SY-VLINE.
    WRITE : / SY-ULINE(91).
  ENDIF.
ENDFORM.                    "WRITE_SELECTIONS
FORM WRITE_STATISTICS.
  NEW-PAGE.
  WRK-HDRSW = '4'.
  GET TIME.
  STATS-END_TIME = SY-UZEIT.
  IF STATS-END_TIME > STATS-START_TIME.
    STATS-PROC_TIME = STATS-END_TIME - STATS-START_TIME.
  ELSE.
    STATS-PROC_TIME = '240000'.
    STATS-PROC_TIME = STATS-PROC_TIME - STATS-START_TIME.
    STATS-PROC_TIME = STATS-PROC_TIME + STATS-END_TIME.
  ENDIF.
  WRITE : /01 SY-VLINE,
           02 'START TIME'(113),
           25 SY-VLINE,
           26 STATS-START_TIME USING EDIT MASK '__:__:__',
           91 SY-VLINE.
  WRITE : /01 SY-ULINE(91).
  WRITE : /01 SY-VLINE,
           02 'END TIME'(114),
           25 SY-VLINE,
           26 STATS-END_TIME USING EDIT MASK '__:__:__',
           91 SY-VLINE.
  WRITE : /01 SY-ULINE(91).
  WRITE : /01 SY-VLINE,
           02 'PROCESSING TIME'(115),
           25 SY-VLINE,
           26 STATS-PROC_TIME USING EDIT MASK '__:__:__',
           91 SY-VLINE.
  WRITE : /01 SY-ULINE(91).
  WRITE : /01 SY-VLINE,
           02 'EKKO RECORDS READ'(116),
           25 SY-VLINE,
           26 STATS-RECS_EKKO,
           91 SY-VLINE.
  WRITE : /01 SY-ULINE(91).
  WRITE : /01 SY-VLINE,
           02 'EKPO RECORDS READ'(117),
           25 SY-VLINE,
           26 STATS-RECS_EKPO,
           91 SY-VLINE.
  WRITE : /01 SY-ULINE(91).
ENDFORM.                    "WRITE_STATISTICS
FORM PGH_STANDARD_HEADING USING L_TITLE1
                                L_TITLE2.
  FORMAT COLOR COL_HEADING.
  PERFORM PGH_WRITE_DATE_TIME.
  PERFORM PGH_WRITE_TITLE USING L_TITLE1.
  PERFORM PGH_WRITE_REPORT_PAGE.
  PERFORM PGH_WRITE_USERID.
  PERFORM PGH_WRITE_TITLE USING L_TITLE2.
  PERFORM PGH_WRITE_SYSTEM_CLIENT.
  FORMAT RESET.
ENDFORM.                    "PGH_STANDARD_HEADING
FORM PGH_WRITE_USERID.
  WRITE : /01 SY-ULINE(91).
  WRITE : /01 SY-VLINE,
           02 'USERID:',
           10 SY-UNAME,
           91 SY-VLINE.
ENDFORM.                    "PGH_WRITE_USERID
FORM PGH_WRITE_DATE_TIME.
  WRITE : /01 SY-ULINE(91).
  WRITE : /01 SY-VLINE,
           02 'DATE:',
           10 SY-DATUM MM/DD/YYYY,
           21 '/',
           23 SY-UZEIT USING EDIT MASK'__:__:__',
           91 SY-VLINE.
ENDFORM.                    "PGH_WRITE_DATE_TIME
FORM PGH_WRITE_TITLE USING L_TITLE.
  DATA : L_LINSZ LIKE SY-LINSZ.
  DATA : L_TITLEL LIKE SY-TABIX.
  DATA : L_START LIKE SY-TABIX.
  L_LINSZ = SY-LINSZ.
  L_TITLEL = STRLEN( L_TITLE ).
  L_START = ( L_LINSZ / 2 ) - ( L_TITLEL / 2 ).
  POSITION L_START.
  WRITE :/01 SY-VLINE,
          02 L_TITLE,
          91 SY-VLINE.
ENDFORM.                    "PGH_WRITE_TITLE
FORM PGH_WRITE_REPORT_PAGE.
  DATA : L_LINSZ LIKE SY-LINSZ.
  DATA : L_START LIKE SY-TABIX.
  L_LINSZ = SY-LINSZ.
  L_START = L_LINSZ - 24.
  POSITION L_START.
  WRITE : /01 SY-VLINE,
           02 'REPORT:', SY-REPID, 'PG', (4) SY-PAGNO,
           91 SY-VLINE.
  POSITION L_LINSZ.
ENDFORM.                    "PGH_WRITE_REPORT_PAGE
FORM PGH_WRITE_SYSTEM_CLIENT.
  DATA : L_LINSZ LIKE SY-LINSZ.
  DATA : L_START LIKE SY-TABIX.
  L_LINSZ = SY-LINSZ.
  L_START = L_LINSZ - 24.
  POSITION L_START.
  WRITE :/01 SY-VLINE,
          02 'SYSTEM:', SY-SYSID,'/',SY-MANDT,
          91 SY-VLINE.
  POSITION L_LINSZ.
WRITE :/01 SY-VLINE.
  WRITE : /01 SY-ULINE(91).
ENDFORM.                    "PGH_WRITE_SYSTEM_CLIENT

The Best Answer

Advertisement
There is a very minor correction in your logic.
FORM DISPLAY_ITEM_DETAIL USING L_EBELN.
CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
SET PARAMETER ID 'BES' FIELD L_EBELN.
*GET PARAMETER ID 'BES' FIELD L_EBELN.
instead of this try
SET PARAMETER ID 'BES' FIELD L_EBELN.
CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
you should always set the parameter id first and then call the transaction.
i tried it in my system and it seems to be working.
  • To get details after second list in interactive report Update:10-11

    hai abap experts, i got a problem, i have written acode in which 3rd list is not executing how to write code for 3rd list(my 3rd list is to get item details by call transaction 'me23') i'll send u all my  code lz check n help out. TABLES : EKKO,     

  • How to dynamically disable interactive report filed in master detail page Update:11-30

    I am using APEX 4.0 & very new to APEX. I am not able to make disable a filed in detail region (which is a interactive report) of a master detail Page. I.e. want to disable field of a row based on value of another field for same record, just like set

  • Interactive report for vendorwise purchase order details Update:10-11

    Hi Experts,   I am trying to create vendor wise purchase order interactive report, if  i click any of vendor detail it has to call display vendor screen for selected vendor or if i click any of purchase details it has to open purchase order details..

  • Can I link from Interactive report Page 1 to Master Detail page 2? Update:10-11

    Hi folks- I know how to create a Page as an Interactive Report; it creates 2 pages automatically (primary page with the great interactive bar) and a 2nd page that's a single record. I know how to create a Page as Master Detail, whereby I get a tabula

  • I Need interactive report to list the purchase orders details for a vendor Update:10-11

    I Need interactive report to list the purchase orders details for a vendor that has    interactive drill down options to give the detail of vendor from vendor master.Hi see this sample report this is Customer wise sales orders just make similar repor

  • Interactive Reporting: master-detail report Update:11-30

    Hi, I wonder if it is possible to have a kind of master-detail pair of reports. For example I have one report containing a crosstab with product groups in the down "dimension". When I click on one of those product groups a second report should a

  • How to enable detail view interactive report as default for public user? Update:11-30

    Hello all, I'm currently developing a search results page. I'm trying to do a nice view instead of a default table like view from the interactive reports. So in this case i enabled the detail view so i could make fancy designs. all worked well and lo

  • Interactive report with detail sub-report on the same page Update:10-11

    Hi all, I'm fairly new to APEX, sorry if my question is too obvious. I'm using Apex 4.0.2 on top of Oracle 11.2. I have an interactive report listing the content of a table. Since there are many columns in that table I would the report to show only a

  • Questions on Interactive Report Icons Update:10-11

    When I created an Interactive Report, rectangular icons have been automatically created on the left side of the report on every line. When clicked one of the icons, it displays the details of the line in vertical order. Here are my questions: 1. When

  • Problems with Page Break in an Interactive Reporting report Update:10-11

    Hello everybody, Platform: Hyperion System 9.3.1. I have serious problems in managing the 'page break' in an Interactive Reporting report. The report shows sales data by store, with article and colour details and it is organized like this: group 1: g