Based on the given sales document numbers display the sales document number, document dates
& customer numbers as shown in below.
If the user click on download button then we download the selected records into presentation server. If the user click on display button then we display the sales order details through VA03 transaction. If the user click on ‘Selt all’ then select the all check boxes.
PROGRAM:
*&---------------------------------------------------------------------*
*& Report ZR_REPORT_WITH_OUR_OWN_GUI
*&
*&---------------------------------------------------------------------*
REPORT ZR_REPORT_WITH_OUR_OWN_GUI.
data: a, b.
DATA: V1 TYPE VBAK-VBELN, V2 TYPE VBAK-AUDAT,
V TYPE SYLINNO.
tables vbak.
select-options s_vbeln for vbak-vbeln.
types: begin of ty_vbak,
vbeln type vbak-vbeln,
audat type vbak-audat,
kunnr type vbak-kunnr,
a type c,
end of ty_vbak.
data: wa_vbak type ty_vbak,
it_vbak type table of ty_vbak.
DATA: WA LIKE WA_VBAK,
IT LIKE TABLE OF WA.
select vbeln audat kunnr
from vbak
into table it_vbak
where vbeln in s_vbeln.
loop at it_vbak into wa_vbak.
write:/ a as checkbox,
wa_vbak-vbeln,
wa_vbak-audat,
wa_vbak-kunnr.
endloop.
V = SY-LINNO.
set pf-status 'STAT'.
AT USER-COMMAND.
IF SY-UCOMM = 'DOWNLOAD'.
DO V TIMES.
READ LINE SY-INDEX FIELD VALUE A INTO B
WA_VBAK-VBELN INTO WA-VBELN
WA_VBAK-AUDAT INTO WA-AUDAT
WA_VBAK-KUNNR INTO WA-KUNNR.
IF B = 'X'.
APPEND WA TO IT.
CLEAR WA.
ENDIF.
ENDDO.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
FILETYPE = 'DAT'
TABLES
data_tab = IT
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ELSEIF SY-UCOMM = 'SETALL'.
A = 'X'.
LOOP AT IT_VBAK INTO WA_VBAK.
WRITE:/ A AS CHECKBOX,
WA_VBAK-VBELN,
WA_VBAK-AUDAT,
WA_VBAK-KUNNR.
ENDLOOP.
ELSEIF SY-UCOMM = 'DISPLAY'.
DO V TIMES.
READ LINE SY-INDEX FIELD VALUE A INTO B
WA_VBAK-VBELN INTO V1.
IF B = 'X'.
SET PARAMETER ID 'AUN' FIELD V1.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDDO.
ENDIF.
OUTPUT:
IF THE USER CLICKS ON DOWNLOAD BUTTON
NOW THE FILE IS AS LIKE THIS
IF THE USER SELECT ANY ONE OF THE CHECKBOX AND CLICKS ON DISPLAY BUTTON THEN CALLS THE SCREEN VA03
IF THE USER CLICKS ON SELECT ALL BUTTON THEN ALL THE CHECKS WILL BE SELECTED
If the user click on download button then we download the selected records into presentation server. If the user click on display button then we display the sales order details through VA03 transaction. If the user click on ‘Selt all’ then select the all check boxes.
PROGRAM:
*&---------------------------------------------------------------------*
*& Report ZR_REPORT_WITH_OUR_OWN_GUI
*&
*&---------------------------------------------------------------------*
REPORT ZR_REPORT_WITH_OUR_OWN_GUI.
data: a, b.
DATA: V1 TYPE VBAK-VBELN, V2 TYPE VBAK-AUDAT,
V TYPE SYLINNO.
tables vbak.
select-options s_vbeln for vbak-vbeln.
types: begin of ty_vbak,
vbeln type vbak-vbeln,
audat type vbak-audat,
kunnr type vbak-kunnr,
a type c,
end of ty_vbak.
data: wa_vbak type ty_vbak,
it_vbak type table of ty_vbak.
DATA: WA LIKE WA_VBAK,
IT LIKE TABLE OF WA.
select vbeln audat kunnr
from vbak
into table it_vbak
where vbeln in s_vbeln.
loop at it_vbak into wa_vbak.
write:/ a as checkbox,
wa_vbak-vbeln,
wa_vbak-audat,
wa_vbak-kunnr.
endloop.
V = SY-LINNO.
set pf-status 'STAT'.
AT USER-COMMAND.
IF SY-UCOMM = 'DOWNLOAD'.
DO V TIMES.
READ LINE SY-INDEX FIELD VALUE A INTO B
WA_VBAK-VBELN INTO WA-VBELN
WA_VBAK-AUDAT INTO WA-AUDAT
WA_VBAK-KUNNR INTO WA-KUNNR.
IF B = 'X'.
APPEND WA TO IT.
CLEAR WA.
ENDIF.
ENDDO.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
FILETYPE = 'DAT'
TABLES
data_tab = IT
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ELSEIF SY-UCOMM = 'SETALL'.
A = 'X'.
LOOP AT IT_VBAK INTO WA_VBAK.
WRITE:/ A AS CHECKBOX,
WA_VBAK-VBELN,
WA_VBAK-AUDAT,
WA_VBAK-KUNNR.
ENDLOOP.
ELSEIF SY-UCOMM = 'DISPLAY'.
DO V TIMES.
READ LINE SY-INDEX FIELD VALUE A INTO B
WA_VBAK-VBELN INTO V1.
IF B = 'X'.
SET PARAMETER ID 'AUN' FIELD V1.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDDO.
ENDIF.
OUTPUT:
IF THE USER CLICKS ON DOWNLOAD BUTTON
NOW THE FILE IS AS LIKE THIS
IF THE USER SELECT ANY ONE OF THE CHECKBOX AND CLICKS ON DISPLAY BUTTON THEN CALLS THE SCREEN VA03
IF THE USER CLICKS ON SELECT ALL BUTTON THEN ALL THE CHECKS WILL BE SELECTED