Skip to main content

Intreactive using hide technique

based on the  given purchasing document  numbers to display.
purchasing document numbers
document dates
vendor numbers
in the basic list .

If the user clicks on any record then we display the PO document  item details ( ebeln, ebelp,menge,meins,netpr) in the
secondary list ,by using hide technique.


s_ebeln  (inputs select option)

basic list :
=========

ekko:
====
ebeln,bedat, lifnr.

secondary list:
===============

ekpo:
=====
ebeln,ebelp,menge,meins,netpr.




Tables ekko.

select-options for ekko-ebeln.

types : begin of ty_ekko,
        ebeln type ekko-ebeln,
bedat type ekko-bedat,
lifnr type ekko-lifnr,
end of ty_ekko.

types : begin of ty_ekpo,
        ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
menge type ekpo-menge,
meins type ekpo-meins,
netpr type ekpo-netpr,
end of ty_ekpo.

data : wa_ekko type ty_ekko,
       it_ekko type table of ty_ekko,
   wa_ekpo type ty_ekpo,
   it_ekpo type table of ty_ekpo.
 
select ebeln
            bedat
lifnr 
from ekko into table it_ekko
            where  ebeln ins_ebeln.

loop at it_ekko into wa_ekko.


write : / wa_ekko-ebeln, wa_ekko-bedat , wa_ekko-lifnr.
HIDE :  wa_ekko-ebeln, wa_ekko-bedat , wa_ekko-lifnr.

end of loop.



at line-selection.

if sy-lisind = '1'.


select ebeln
       ebelp 
       menge
       meins
       netpr
       from ekpo into table it_ekpo 
       where ebeln = wa_ekko-ebeln.


loop at it_ekpo into wa_ekpo.

write : / wa_ekpo-ebeln, wa_ekpo-ebelp, wa_ekpo-menge,
          wa_ekpo-meins , wa_ekpo-netpr.

endloop.  

endif.


=================================================

Requirement:
Develop an interactive report to display material basic details in basic list, material plant details
in secondary list for a material type input and display header and footer for primary and secondary list.

Requirement Analysis:
In the above requirement, we have to get material details for a material type input (Parameter input for MTART field), whenever the user double clicks on any record of basic list, it will
go to the second screen and display list plants for that material, display page header and footer for the report.


SAP Tables to be used are:
MARA(Material Master), MARC(Material Plants).

Step1: Define report heading.

Go to SE38,

 create a program ZSAPN_INTERACTIVE_REPORT.
 In order to display footer information we have to provide some space for the footer,
 it can be defined in the report definition(First line of the report),
 to provide space for footer we use below syntax.


REPORT ZSAPN_INTERACTIVE_REPORT LINE-COUNT 34(2) NO STANDARD PAGE HEADING.
         "Leave some pages for footer and hide standard heading
In the above deceleration we have provided 34 lines for report and 2 lines for footer i:e 34(2),
we don`t need a standard page heading so we used NO STANDARD PAGE HEADING.



Step2:Data decelerations and Selection screen.


Declare the required internal tables, work areas, variables etc.
and add selection screen element parameter for material type input.
DATA: IT_MARA TYPE TABLE OF MARA, "mara internal table
       WA_MARA TYPE MARA, "mara work area
       IT_MARC TYPE TABLE OF MARC, "marc internal table
       WA_MARC TYPE MARC. "marc work area

PARAMETERS P_MTART TYPE MARA-MTART. "Selection screen element input field


Step3: Add code to get material basic details.

Add logic to get materials for the material type input under START-OF-SELECTION event.
START-OF-SELECTION.
  SELECT * FROM MARA
    INTO TABLE IT_MARA
    WHERE MTART = P_MTART.

Display materials and use HIDE technique
Display materials and use HIDE technique( HIDE area) to store line data.

  LOOP AT IT_MARA INTO WA_MARA.
    WRITE:/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MATKL, WA_MARA-MBRSH.
    HIDE WA_MARA. "store line details in HIDE area
  ENDLOOP.
 
 
 
Step4: Get plant details using hide area


Get material plants from MARC table based on HIDE area storage under AT LINE-SELECTION event.
AT LINE-SELECTION.
  SELECT * FROM MARC
    INTO TABLE IT_MARC
    WHERE MATNR = WA_MARA-MATNR.


Step5: Display plant data


Display material plant data.
  LOOP AT IT_MARC INTO WA_MARC.
    WRITE :/ WA_MARC-MATNR, WA_MARC-WERKS.
  ENDLOOP.
 
 
Step6:Display top of page for basic list and secondary list

Display page heading for basic list under TOP-OF-PAGE event and
display secondary list heading under TOP-OF-PAGE DURING LINE-SELECTION event.


TOP-OF-PAGE.
  WRITE : 'Material Basic Details' COLOR 5.
 
TOP-OF-PAGE DURING LINE-SELECTION.
  WRITE: 'List of Plants for material:', WA_MARA-MATNR COLOR 6.
 
 
Step7: Display footer for basic list

Display footer information for basic material list.

  WRITE: 'Report Generated at:', SY-DATUM COLOR 1.

Final report after modularization is below

REPORT ZSAPN_INTERACTIVE_REPORT LINE-COUNT 33(3) NO STANDARD PAGE HEADING.
"leave some pages for footer and hide standard heading
DATA : IT_MARA TYPE TABLE OF MARA, "mara internal table
       WA_MARA TYPE MARA, "mara work area
       IT_MARC TYPE TABLE OF MARC, "marc internal table
       WA_MARC TYPE MARC. "marc work area

PARAMETERS P_MTART TYPE MARA-MTART. "selection screen element input field

INITIALIZATION. "initialization event

AT SELECTION-SCREEN. "at selection screen event to validate inputs
  PERFORM VALIDATE_INPUT. "Subroutine to validate input

START-OF-SELECTION.
  PERFORM GET_MATERIAL_DATA.
  PERFORM DISPLAY_MATERIALS.

TOP-OF-PAGE.
  PERFORM DISPLAY_HEADER.

END-OF-PAGE.
  PERFORM DISPLAY_FOOTER.

AT LINE-SELECTION.
  PERFORM GET_PLANT_DATA.
  PERFORM DISPLAY_PLANT_DATA.

TOP-OF-PAGE DURING LINE-SELECTION.
  PERFORM DISPLAY_LIST_HEADER.
FORM VALIDATE_INPUT .
  IF P_MTART IS INITIAL.
    MESSAGE 'Please enter input' TYPE 'E'.
  ENDIF.
ENDFORM.                    " VALIDATE_INPUT

FORM GET_MATERIAL_DATA .
  SELECT * FROM MARA
    INTO TABLE IT_MARA
    UP TO 50 ROWS
    WHERE MTART = P_MTART .
ENDFORM.                    " GET_MATERIAL_DATA


FORM DISPLAY_MATERIALS .
  LOOP AT IT_MARA INTO WA_MARA.
    WRITE:/ WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MATKL, WA_MARA-MBRSH.
    HIDE WA_MARA. "store line details in HIDE area
  ENDLOOP.
ENDFORM.                    " DISPLAY_MATERIALS


FORM DISPLAY_HEADER .
  WRITE : 'Material Basic Details' COLOR 5.
ENDFORM.                    " DISPLAY_HEADER


FORM DISPLAY_FOOTER .
  WRITE: 'Report Generated at:', SY-DATUM COLOR 1.
ENDFORM.                    " DISPLAY_FOOTER


FORM GET_PLANT_DATA .
  SELECT * FROM MARC
    INTO TABLE IT_MARC
    WHERE MATNR = WA_MARA-MATNR.
ENDFORM.                    " GET_PLANT_DATA


FORM DISPLAY_PLANT_DATA .
  LOOP AT IT_MARC INTO WA_MARC.
    WRITE :/ WA_MARC-MATNR, WA_MARC-WERKS.
  ENDLOOP.
ENDFORM.                    " DISPLAY_PLANT_DATA


FORM DISPLAY_LIST_HEADER .
  WRITE: 'List of Plants for material:', WA_MARA-MATNR COLOR 6.
ENDFORM.                    " DISPLAY_LIST_HEADER





Comments

Popular posts from this blog

ABAP BASICS CONTINUEATION

message: daily just follow my post maximum i will cover upto 90% of abap.                   DATA TYPES IN ABAP Data type specifies what type of the variable it is. data types in abap are divided into two categories.                                    NUMERIC DATATYPE                                   CHARACTER DATATYPE         1. Integer  [ I ]                                             1. Char  [ C ]           2. Float       [ F ]                                         ...

STEPS TO LOG ON TO SAP

            STEPS   TO   UP (ON) THE  SERVER: >> Double  click  on   the  SAP  Management  console  on desktop.   >> Select   the   server   , right   click ,   all tasks,  start. >> Provide  the  password. >>Expand  the server [ECC6], double click on the  ABAP WP               Table  in   the  leftside  , contiuncely  click  on  Refresh  button       until  the  status  is  wait   then  minimize  the  server. >>  Check  until  the  status  is  wait  ,if  it is  in  run  status  you             cannot  login.  so  check  until  status  is  wait. ...

INTRODUCTION TO SAP ABAP

                                                        SAP SAP   stands   as Systems Applications  and  Products in data processing. manufacturing unit Purchasing : The    purchasing department purchases  raw materials from the shops . Warehouse: The raw materials which are received  by  the unit is stored in the ware house. Finance: The amount of the raw materials are paid to shops by the finance department. Production: The production department looks after the production from the raw materials which are in the warehouse. Sales and Distribution: This department looks after the sales. Shipping: Shipping department looks after delevering the products from ware houseto the customers. And again finance department collects the amount from the customers. Human resou...