Introduction

I have come across number of discussions in SDN forum with respect to Table Control Functionality in Module Pool Programming.The example that I I am sharing here is no exception but this will give a little bit in-depth idea about various table control functionality and a little bit of flavor of OO ALV reporting.I would be more then happy if this post could help anyone to solve the issue related to table control.The step by step screen shot that I am providing here won’t be in the primary level so it may causes confusion for the beginners but I hope it will give them a chance to explore the steps that I missed in this document.

Requirement

This requirement based on the automation of the transaction code FMBBC.This transaction code use to Maintain the Budget for a year and it follows the below steps.

1–>Budget Transfer which runs once and at the beginning of the year

2–>Budget Released

3–>Released Return

4–>Budget Transfer

Execution Step

The step by step process mentioned below explain  the execution steps to automate the FMBBC .

Image1.png

      A Tcode is created to execute this report.You can create a Tcode of your choice to display this screen.I made the Budget Enter radio button is selected because this will help the user to run the Budget Enter  process first which usually he will do in the beginning of the year.

Image1.png  

      Here I am trying to automate the Budget Enter process which runs once and at the beginning of each year.So i have choose the Budget Enter file from the local system.

Note:I have developed the report in such a way that it only accept the .xlsx file and exact name so that the user can’t run any other file which is not fulfill the naming standard.

Image1.png

   Your xlsx file should look like above.When user enter this file and execute the report it should run for Budget enter and Budget Released ,so make sure that your file should contain these fields as shown above so that there should not be any error while uploading data into SAP System.

Image1.png

    Once the report is successfully run it will give the above output with Successful message with Budget Enter and Budget Released document numbers and the data user runs using the excel file.

Image1.png

    Once the user select the Budget Automation radio button it will display the above screen.

  Note:The first part of the screen should be always select from the variant because these three values are always same.The second part of the screen which is a a Table control should be filled by the user as per the requirement.

Image1.png

Here selecting the Variant  to fill the first selection screen(Budget Category,Fiscal Year,Document Date)

Image1.png

All the field have been filled now and ready to upload the data into SAP System for Released Return,Budget Transfer,Budget Released)

Image1.png

After successfully execution of the report it will generate three different document numbers with the successful symbol with green lights.

Executable code and module pool screen design

Image1.png

Radio Button Design Parameters

Image1.png

  File Selection screen Design Parameter.Here the Text and Text Field has been placed over a box.

Image1.png

    Automation Entries screen design parameter

Image1.png

Table Control screen design parameter

Image1.png

Screen design for 200 screen.For this screen the selection screen design is in the code which will display through a blank box as a pop up.

Code

Executable Report–>

REPORT zr_budget_transfer_automation NO STANDARD PAGE HEADING LINESIZE 255.

TYPE-POOLS: slis,trux,icon.
TABLES:   fmbl,fmbh,fmfctr,fmci,fmfincode.
*=========================================================================*
*         TYPES DECLARATION FROM EXCEL TO FILL THE INTERNAL TABLES        *
*=========================================================================*
TYPES: BEGIN OF lt_enter,
valtype(
15)        TYPE c,               “BCS Value Type
process_ui(
15)     TYPE c,               “Process
doctype           
TYPE bued_doctype,    “Document Type
sfiscyear         
TYPE gjahr,           “Fiscal Year
sbudtype          
TYPE buku_budtype,    “Budget Type
sfund             
TYPE bp_geber,        “Fund
version           
TYPE buku_version,    “Version
docdate(
10)        TYPE c,               “Document Date
speriod(
4)         TYPE c,               “Period
fundsctr          
TYPE fistl,           “Fund Center
cmmtitem          
TYPE fm_fipex,        “Commitment Item
tvalue            
TYPE p DECIMALS 2,    “Amount
distkey           
TYPE buku_spred,      “Distribution Key
END OF lt_enter.

TYPES: BEGIN OF lt_release,
valtype(
15)        TYPE c,                “BCS Value Type
process_ui(
15)     TYPE c,                “Process
bud_cat(
15)        TYPE c,                “Budget Category
doctype           
TYPE bued_doctype,     “Document Type
sfiscyear         
TYPE gjahr,            “Fiscal Year
sbudtype          
TYPE buku_budtype,     “Budget Type
sfund             
TYPE bp_geber,         “Fund
version           
TYPE buku_version,     “Version
docdate(
10)        TYPE c,                “Document Date
speriod(
4)         TYPE c,                “Period
fundsctr          
TYPE fistl,            “Fund Center
cmmtitem          
TYPE fm_fipex,         “Commitment Item
tvalue            
TYPE p DECIMALS 2,       “Amount
distkey           
TYPE buku_spred,       “Distribution Key
ENDOF lt_release.

TYPES: BEGIN OF lt_rrelease,
valtype(
15)        TYPE c,                “BCS Value Type
process_ui(
15)     TYPE c,                “Process
bud_cat(
15)        TYPE c,                “Budget Category
doctype           
TYPE bued_doctype,     “Document Type
sfiscyear         
TYPE gjahr,            “Fiscal Year
sbudtype          
TYPE buku_budtype,     “Budget Type
sfund             
TYPE bp_geber,         “Fund
version           
TYPE buku_version,     “Version
docdate(
10)        TYPE c,                “Document Date
speriod(
4)         TYPE c,                “Period
fundsctr          
TYPE fistl,            “Fund Center
cmmtitem          
TYPE fm_fipex,         “Commitment Item
tvalue            
TYPE p DECIMALS 2,       “Amount
distkey           
TYPE buku_spred,       “Distribution Key
END OF lt_rrelease.

TYPES: BEGIN OF lt_transfer,
valtype(
15)        TYPE c,
process_ui(
15)     TYPE c,
bud_cat(
15)        TYPE c,
doctype           
TYPE bued_doctype,
version           
TYPE buku_version,
docdate(
10)        TYPE c,
sfiscyear         
TYPE gjahr,
sbudtype          
TYPE buku_budtype,
sfund             
TYPE bp_geber,
speriod(
4)         TYPE c,
sfiscyear1        
TYPE gjahr,
sbudtype1         
TYPE buku_budtype,
sfund1            
TYPE bp_geber,
speriod1(
4)        TYPE c,
cha(
3)             TYPE c,
fundsctr          
TYPE fistl,
cmmtitem          
TYPE fm_fipex,
tvalue            
TYPE p DECIMALS 2,
distkey           
TYPE buku_spred,
cha1(
3)            TYPE c,
fundsctr1         
TYPE fistl,
cmmtitem1         
TYPE fm_fipex,
tvalue1           
TYPE p DECIMALS 2,
distkey1          
TYPE buku_spred,
END OF lt_transfer.
*========================================================================*
*           TYPE STRUCTURE FOR MESSSAGE DISPLAY                          *
*========================================================================*
TYPES: BEGIN OF lt_check,
msg1(
220),
msgtype(
1),
icon(4),
END OF lt_check.
DATA:  gt_check            TYPE TABLE OF lt_check,
gw_check           
TYPE lt_check.

TYPES: BEGIN OF lt_log,
order(20)          TYPE c,“BAPI_0050_FIELDS-DOCUMENT,
msg(
220),
msgtyp(
1)          TYPE c,
END OF lt_log.

TYPES: BEGIN OF gt_ztable,
status_icon      
TYPE icons-text,
fundsctr         
LIKE fmbl-fundsctr,
cmmtitem         
LIKE fmbl-cmmtitem,
fictr            
LIKE fmfctr-fictr,
fipex            
LIKE fmci-fipex,
tval01           
LIKE fmbl-tval01,
stus(
20)          TYPE c,
END OF gt_ztable.

DATA:     wa_ztable        TYPE gt_ztable, “work area
t_ztable        
TYPE TABLE OF gt_ztable.

DATA:  wa_final            TYPE gt_ztable,
t_final            
TYPE TABLE OF gt_ztable,
wa_fmbl            
TYPE fmbl.
*=========================================================================================*
*                 INTERNAL TABLE DECLARATION FOR THE F4 HELP                              *
*=========================================================================================*
TYPES: BEGIN OF lt_fmbl_coscen,
fundsctr           
TYPE fistl,
END OF  lt_fmbl_coscen,

BEGIN OF lt_fmbl_glaccn,
cmmtitem           
TYPE fm_fipex,
END OF  lt_fmbl_glaccn,

BEGIN OF lt_fmbl_funcen,
cmmtitem           
TYPE fm_fipex,
END OF  lt_fmbl_funcen,

BEGIN OF lt_fmbl_cmmitm,
cmmtitem           
TYPE fm_fipex,
END OF  lt_fmbl_cmmitm,

BEGIN OF lt_show_result,
gv_return          
TYPE  bapi_0050_fields-document,
gv_transfer        
TYPE  bapi_0050_fields-document,
gv_rels            
TYPE  bapi_0050_fields-document,
gv_msg             
TYPE  string,
END OF lt_show_result.

DATA:
wa_fmbl_coscen
TYPE lt_fmbl_coscen,
t_fmbl_coscen
TYPE TABLE OF lt_fmbl_coscen,

wa_fmbl_glaccn TYPE lt_fmbl_glaccn,
t_fmbl_glaccn
TYPE TABLE OF lt_fmbl_glaccn,

wa_fmbl_funcen TYPE lt_fmbl_funcen,
t_fmbl_funcen
TYPE TABLE OF lt_fmbl_funcen,

wa_fmbl_cmmitm TYPE lt_fmbl_cmmitm,
t_fmbl_cmmitm
TYPE TABLE OF lt_fmbl_cmmitm,

wa_show_result TYPE lt_show_result,
t_show_result
TYPE TABLE OF lt_show_result.

DATA:
rad1                
TYPE c VALUE ‘X’,
rad2,
ok_code             
TYPE sy-ucomm,
p_file              
TYPE rlgrap-filename ,
tab_lines           
TYPE i,
step_lines          
TYPE i.

DATA:
lt_events           
TYPE slis_t_event,
ls_event            
TYPE slis_alv_event,
g_sel_var           
TYPE rsvar-variant,
g_sel_vartxt        
TYPE rsvar-vtext,
gv_truxs            
TYPE truxs_t_text_data,
gv_info(
15)          TYPE c,
gv_message(
70)       TYPE c,
gv_rrmess           
TYPE string,
gv_btmess           
TYPE string,
gv_brmess           
TYPE string,
gv_errmes           
TYPE string,
gv_strlen           
TYPE i.

DATA: flag TYPE i.
flag =
1.
*===========================================================================*
*              CONSTANT DECLARATION                                         *
*===========================================================================*
CONSTANTS :
gv_lheader(
1)     TYPE c    VALUE ‘X’,
gv_fmarea1(
4)     TYPE c    VALUE ‘ABCD’,
gv_docstat(
1)     TYPE c    VALUE ‘1’,
gv_process(
4)     TYPE c    VALUE ‘ENTR’,
gv_budcat(
2)      TYPE c    VALUE ‘9F’,
gv_trcurr(
3)      TYPE c    VALUE ‘QAR’,
gv_evaltyp(
6)     TYPE c    VALUE ‘BUDGET’,
gv_ivaltyp(
2)     TYPE c    VALUE ‘B1’,
gv_bperiod(
3)     TYPE c    VALUE ‘001’,
gv_rvaltyp(
8)     TYPE c    VALUE ‘RELEASED’,
gv_ivaltyp1(
2)    TYPE c    VALUE ‘R1’,
gv_rprocsui(
6)    TYPE c    VALUE ‘RETURN’,
gv_rprocess(
4)    TYPE c    VALUE ‘RETN’,
gv_tprocsui(
8)    TYPE c    VALUE ‘TRANSFER’,
gv_tprocess(
4)    TYPE c    VALUE ‘TRAN’,
gv_tlist(
11)      TYPE c    VALUE ‘TOP_OF_LIST’,
gv_xlsf(
4)        TYPE c    VALUE ‘XLSX’,
gv_fnme(
12)       TYPE c    VALUE ‘Budget Enter’,
gv_fnme1(
15)      TYPE c    VALUE ‘Budget Released’,
gv_fnme2(
15)      TYPE c    VALUE ‘Released Return’,
gv_fnme3(
15)      TYPE c    VALUE ‘Budget Transfer’,
gv_relret(
4)      TYPE c    VALUE ‘2000’,
gv_budrel(
4)      TYPE c    VALUE ‘2000’,
gv_budtrn(
4)      TYPE c    VALUE ‘1000’,
gv_bcsrel(
8)      TYPE c    VALUE ‘Released’,
gv_bcstrn(
8)      TYPE c    VALUE ‘Budget’,
gv_bcsrtn(
8)      TYPE c    VALUE ‘Released’,
gv_verson(
3)      TYPE c    VALUE ‘000’,
gv_rbudty(
2)      TYPE c    VALUE ’15’,
gv_tbudty(
4)      TYPE c    VALUE ‘ABCD’,
gv_fund(
4)        TYPE c    VALUE ‘ABCD’,
gv_prorel(
5)      TYPE c    VALUE ‘Enter’,
gv_prortn(
6)      TYPE c    VALUE ‘Return’,
gv_protrn(
8)      TYPE c    VALUE ‘Transfer’,
gv_distkey       
TYPE c    VALUE ‘1’,
gv_period(
3)      TYPE c    VALUE ‘ALL’.

*===========================================================================*
*                  VARIABLE DECLARATRION                                    *
*===========================================================================*
DATA:  gv_counter             TYPE sy-tabix.
DATA:  lv_count(20)           TYPE c.

DATA:
gv_fmarea             
TYPE  bapi_0050_fields-fm_area,
gv_documentyear       
TYPE  bapi_0050_fields-doc_year,
gv_documentnumber     
TYPE  bapi_0050_fields-document,
gv_return_docnum      
TYPE  bapi_0050_fields-document,
gv_transfer_docnum    
TYPE  bapi_0050_fields-document,
gv_enter_docnum       
TYPE  bapi_0050_fields-document,
gv_rels_docnum        
TYPE  bapi_0050_fields-document.
DATA:  lt_return              TYPE TABLE OF bapiret2,
wa_return             
TYPE bapiret2.

DATA:  docdate(8)             TYPE c.
DATA:  status                 TYPE icons-text.
*=============================================================================*
*          INTERNAL TABLE AND WORK AREA DECLARATION
*=============================================================================*
DATA:
gt_enter               
TYPE STANDARD TABLE OF lt_enter,
gw_enter               
TYPE lt_enter,
gt_release             
TYPE TABLE OF lt_release,
gw_release             
TYPE lt_release,
gt_rrelease            
TYPE TABLE OF lt_rrelease,
gw_rrelease            
TYPE lt_rrelease,
gt_transfer            
TYPE TABLE OF lt_transfer,
gw_transfer            
TYPE lt_transfer,
gt_header              
TYPE TABLE OF bapi_0050_header,
gw_header              
TYPE bapi_0050_header,
gt_transfer_from       
TYPE TABLE OF bapi_0050_item,
gw_transfer_from       
TYPE bapi_0050_item,
gt_transfer_to         
TYPE TABLE OF bapi_0050_item,
gw_transfer_to         
TYPE bapi_0050_item,
gt_period              
TYPE TABLE OF bapi_0050_period,
gw_period              
TYPE bapi_0050_period,
gt_speriod             
TYPE TABLE OF bapi_0050_period,
gw_speriod             
TYPE bapi_0050_period.

DATA:
gv_flname               
TYPE string.

DATA: container(10000)        TYPE c.
DATA:
green_icon(
23)          TYPE c,
yellow_icon(
23)         TYPE c,
red_icon(
23)            TYPE c,
hlp_quick              
TYPE iconquick,
status_icon            
TYPE icons-text.

DATA: lo_dock                 TYPE REF TO cl_gui_docking_container,
lo_grid                
TYPE REF TO cl_gui_alv_grid,
lo_fcat                
TYPE lvc_t_fcat,
wa_fcat                
TYPE lvc_s_fcat,
lo_cont                
TYPE REF TO cl_gui_container,
lo_alv                 
TYPE REF TO cl_salv_table.
DATA: go_columns              TYPE REF TO cl_salv_columns_table,
go_column               
TYPE REF TO cl_salv_column_table.

DATA: lo_functions            TYPE REF TO cl_salv_functions_list.
DATA: g_splitter              TYPE REF TO cl_gui_splitter_container,
g_container_1          
TYPE REF TO cl_gui_container,
g_container_2          
TYPE REF TO cl_gui_container.
DATA: l_header                TYPE sdydo_text_element.
DATA:   l_document            TYPE REF TO cl_dd_document.
*===============================================================================*
*        SELECTION SCREEN DECLARATION                                           *
*===============================================================================*
SET SCREEN 100.
SELECTION-
SCREEN BEGIN OF SCREEN 901 AS SUBSCREEN.
SELECTION-
SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text001.
PARAMETERS: p_name TYPE rsvar-variant, p_mean TYPE rsvar-vtext.
SELECTION-
SCREEN END OF BLOCK b2.
SELECTION-
SCREEN END OF SCREEN 901.

PARAMETERS: budcat1     TYPE fmbl-budcat NO-DISPLAY,
fund1      
TYPE fmbl-fund NO-DISPLAY,
fisyear1   
TYPE fmbl-fiscyear NO-DISPLAY,
docdate1   
TYPE fmbh-docdate NO-DISPLAY,
rpmax1     
TYPE fmbl-rpmax NO-DISPLAY,
distkey1   
TYPE fmbl-distkey NO-DISPLAY.
*&———————————————————————*
*&      Module  F4_FILENAME  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE f4_filename INPUT.
CALL FUNCTION ‘F4_FILENAME’
EXPORTING
program_name  = sy-repid
dynpro_number = sy-dynnr
field_name    =
‘ ‘ “gv_fname
IMPORTING
file_name     = p_file.
ENDMODULE.                 ” F4_FILENAME  INPUT
*————————————————————————*
*              DECLARATION OF THE TABLE CONTROL                          *
*————————————————————————*
CONTROLS: ztable TYPE TABLEVIEW USING SCREEN 0100.
*DATA: wa_table LIKE LINE OF ztable-cols.

*&———————————————————————*
*&      Module  MODIFY_SCREEN  OUTPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE modify_screen OUTPUT.
IF sy-ucomm = ‘RADIO’ AND rad1 = ‘X’.
LOOP AT SCREEN.
ztable-invisible =
‘X’.
IF screen-group1 = ‘GRP’.
screeninput  = ‘0’.
screen-invisible = ‘1’.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF sy-ucomm = ‘RADIO’ AND rad2 = ‘X’.
LOOP AT SCREEN.
ztable-invisible =
‘ ‘.
IF screen-group1 = ‘GR1’.
screeninput  = ‘0’.
screen-invisible = ‘1’.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
ENDMODULE.                 ” MODIFY_SCREEN  OUTPUT
*&———————————————————————*
*&      Module  STATUS_0100  OUTPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE status_0100 OUTPUT.
SET PF-STATUS ‘ZRADIO’.
sy-ucomm =
‘RADIO’.
ENDMODULE.                 ” STATUS_0100  OUTPUT
*&———————————————————————*
*&      Module  STATUS_0200  OUTPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE status_0200 OUTPUT.
SET PF-STATUS ‘Z200’.
ENDMODULE.                 ” STATUS_0200  OUTPUT
*&———————————————————————*
*&      Module  USER_COMMAND_0200  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE user_command_0200 INPUT.
IF NOT p_name IS INITIAL.
ok_code =
‘OK’.
ELSE.
ok_code =
‘CANCEL’.
ENDIF.
CASE ok_code.
WHEN ‘OK’.
IF NOT p_name IS INITIAL.
PERFORM save_variant.
MESSAGE ‘Variant has been saved’ TYPE ‘S’.
ENDIF.
WHEN ‘CANCEL’.
MESSAGE ‘”Variant Not saved.’ TYPE ‘S’ DISPLAY LIKE ‘E’.
ENDCASE.
CALL SCREEN 100.
CLEAR fmbl-budcat.
CLEAR fmbl-fundsctr.
CLEAR fmbl-fiscyear.
CLEAR fmbh-docdate.
CLEAR fmbl-rpmax.
CLEAR fmbl-distkey.
ENDMODULE.                    “USER_COMMAND_0200 INPUT
*&———————————————————————*
*&      Form  SAVE_VARIANT
*&———————————————————————*
*       text
*———————————————————————-*
*  –>  p1        text
*  <–  p2        text
*———————————————————————-*
FORM save_variant .
DATA: BEGIN OF rsparams_tab OCCURS 10.
INCLUDE STRUCTURE rsparams.
DATA: END OF rsparams_tab.
DATA: BEGIN OF varid_tab.
INCLUDE STRUCTURE varid.
DATA: END OF varid_tab.
DATA: BEGIN OF varit_tab OCCURS 2.
INCLUDE STRUCTURE varit.
DATA: END OF varit_tab.
DATA: rc  TYPE syst-subrc.
* Tabellen initialisieren
CLEAR: varid_tab.
REFRESH varit_tab.
REFRESH rsparams_tab.
*fill VARID structure – variant description
varid_tab-
report  = ‘ZR_BUDGET_TRANSFER_AUTOMATION’.
varid_tab-variant = p_name.
*  varid_tab-environmnt   = ‘A’.
varit_tab-mandt   = sy-mandt.
varit_tab-langu   = sy-langu.
varit_tab-
report  = varid_tab-report.
varit_tab-variant = varid_tab-variant.
varit_tab-vtext   = p_mean.
APPEND varit_tab.
*fill RSPARAMS structure – Selektionswerte; variant contents
budcat1 = fmbl-budcat.
rsparams_tab-selname =
‘BUDCAT1’.
rsparams_tab-kind    =
‘P’.
rsparams_tab-
sign  = ‘I’.
rsparams_tab-option  =
‘EQ’.
rsparams_tab-low  = budcat1.
rsparams_tab-high  =
‘ ‘.
APPEND rsparams_tab.
fund1 = fmbl-fundsctr.
rsparams_tab-selname =
‘FUND1’.
rsparams_tab-kind    =
‘P’.
rsparams_tab-
sign  = ‘I’.
rsparams_tab-option  =
‘EQ’.
rsparams_tab-low  = fund1.
rsparams_tab-high  =
‘ ‘.
APPEND rsparams_tab.
fisyear1 = fmbl-fiscyear.
rsparams_tab-selname =
‘FISYEAR1’.
rsparams_tab-kind    =
‘P’.
rsparams_tab-
sign  = ‘I’.
rsparams_tab-option  =
‘EQ’.
rsparams_tab-low  = fisyear1.
rsparams_tab-high  =
‘ ‘.
APPEND rsparams_tab.
docdate1 = fmbh-docdate.
rsparams_tab-selname =
‘DOCDATE1’.
rsparams_tab-kind    =
‘P’.
rsparams_tab-
sign  = ‘I’.
rsparams_tab-option  =
‘EQ’.
rsparams_tab-low  = docdate1.
rsparams_tab-high  =
‘ ‘.
APPEND rsparams_tab.
rpmax1 = fmbl-rpmax.
rsparams_tab-selname =
‘RPMAX1’.
rsparams_tab-kind    =
‘P’.
rsparams_tab-
sign  = ‘I’.
rsparams_tab-option  =
‘EQ’.
rsparams_tab-low  = rpmax1.
rsparams_tab-high  =
‘ ‘.
APPEND rsparams_tab.
distkey1 = fmbl-distkey.
rsparams_tab-selname =
‘DISTKEY1’.
rsparams_tab-kind    =
‘P’.
rsparams_tab-
sign  = ‘I’.
rsparams_tab-option  =
‘EQ’.
rsparams_tab-low  = distkey1.
rsparams_tab-high  =
‘ ‘.
APPEND rsparams_tab.
*Check variant
CALL FUNCTION ‘RS_VARIANT_EXISTS’
EXPORTING
report              = varid_tab-report
variant             = varid_tab-variant
IMPORTING
r_c                 = rc
EXCEPTIONS
not_authorized      =
01
no_report           =
02
report_not_existent =
03
report_not_supplied =
04.
IF sy-subrc <> 0.
MESSAGE e001(vl) WITH text-e22 DISPLAY LIKE ‘S’.
ENDIF.
IF rc = 0.                    ” Variante existiert
CALL FUNCTION ‘RS_CHANGE_CREATED_VARIANT’
EXPORTING
curr_report               = varid_tab-
report
curr_variant              = varid_tab-variant
vari_desc                 = varid_tab
TABLES
vari_contents             = rsparams_tab
vari_text                 = varit_tab
EXCEPTIONS
illegal_report_or_variant =
01
illegal_variantname       =
02
not_authorized            =
03
not_executed              =
04
report_not_existent       =
05
report_not_supplied       =
06
variant_doesnt_exist      =
07
variant_locked            =
08
selections_no_match       =
09.
ELSE.
CALL FUNCTION ‘RS_CREATE_VARIANT’
EXPORTING
curr_report               = varid_tab-
report
curr_variant              = varid_tab-variant
vari_desc                 = varid_tab
TABLES
vari_contents             = rsparams_tab
vari_text                 = varit_tab
EXCEPTIONS
illegal_report_or_variant =
01
illegal_variantname       =
02
not_authorized            =
03
not_executed              =
04
report_not_existent       =
05
report_not_supplied       =
06
variant_exists            =
07
variant_locked            =
08.
ENDIF.
rc = sy-subrc.
ENDFORM.           ” SAVE_VARIANT
*&———————————————————————*
*&      Module  USER_COMMAND_0100  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE user_command_0100 INPUT.
CLEAR ok_code.
ok_code = sy-ucomm.
*———————————————————————–*
*       OK CODE VALIDATION                                              *
*———————————————————————–*
CASE ok_code.
WHEN  ‘BACK’.
LEAVE PROGRAM.
WHEN ‘EXIT’.
LEAVE PROGRAM.
WHEN ‘CANCEL’.
LEAVE PROGRAM.
WHEN ‘SAVE’.
CALL SCREEN 200 STARTING AT 10 5.
WHEN ‘VARIANT’.
PERFORM load_variant.
IF sy-ucomm EQ ‘CANC’.
MESSAGE ‘Variant operation terminated’ TYPE ‘S’ DISPLAY LIKE ‘E’.
ELSE.
MESSAGE ‘Variant selected’ TYPE ‘S’.
ENDIF.
CALL SCREEN 100.
WHEN ‘ ‘.
PERFORM bapi.
CALL SCREEN 100.
WHEN ‘EXECUTE’.
PERFORM bapi.
CALL SCREEN 100.
WHEN OTHERS.
IF rad1 EQ gv_lheader.
PERFORM bapi.
ELSEIF rad2 EQ gv_lheader.
PERFORM clear_container.
ENDIF.
LEAVE TO SCREEN 100.
ENDCASE.
ENDMODULE.                 ” USER_COMMAND_0100  INPUT
*&———————————————————————*
*&      Form  load_variant
*&———————————————————————*
*       text
*———————————————————————-*
*  –>  p1        text
*  <–  p2        text
*———————————————————————-*
FORM load_variant .
PERFORM choose_variant CHANGING g_sel_var.
IF g_sel_var NE space.
CALL FUNCTION ‘RS_SUPPORT_SELECTIONS’
EXPORTING
report               = sy-repid
variant              = g_sel_var
EXCEPTIONS
variant_not_existent =
1
variant_obsolete     =
2
OTHERS               = 3.
ENDIF.
ENDFORM.                    ” load_variant

*&———————————————————————*
*&      Form  choose_variant
*&———————————————————————*
*       text
*———————————————————————-*
*      <–P_G_SEL_VAR  text
*———————————————————————-*
FORM choose_variant  CHANGING fp_sel_var.
CALL FUNCTION ‘RS_VARIANT_CATALOG’
EXPORTING
report               = sy-repid
masked               =
‘X’
IMPORTING
sel_variant          = fp_sel_var
sel_variant_text     = g_sel_vartxt
EXCEPTIONS
no_report            =
1
report_not_existent  =
2
report_not_supplied  =
3
no_variants          =
4
no_variant_selected  =
5
variant_not_existent =
6
OTHERS               = 7.
PERFORM populate_value CHANGING fp_sel_var.
ENDFORM.                    “choose_variant
” choose_variant
*&———————————————————————*
*&      Form  POPULATE_VALUE
*&———————————————————————*
*       text
*———————————————————————-*
*  –>  p1        text
*  <–  p2        text
*———————————————————————-*
FORM populate_value CHANGING fp_sel_var.
DATA:  lt_valutab LIKE rsparams OCCURS 0 WITH HEADER LINE,
lt_objs  
LIKE vanz     OCCURS 0 WITH HEADER LINE,
lv_budcat
LIKE fmbl-budcat,
lv_fisyer
LIKE fmbl-fiscyear,
lv_docdet
LIKE fmbh-docdate,
lv_fund  
LIKE fmfincode-fincode,
lv_perod 
LIKE fmbl-rpmax,
lv_diskey
LIKE fmbl-distkey.

CALL FUNCTION ‘RS_VARIANT_CONTENTS’
EXPORTING
report               = sy-repid
variant              = fp_sel_var
move_or_write        =
‘W’
execute_direct       =
‘X’
TABLES
valutab              = lt_valutab
objects              = lt_objs
EXCEPTIONS
variant_non_existent =
1
variant_obsolete     =
2
OTHERS               = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

LOOP AT lt_valutab.
CHECK lt_valutab-low NE space .
IF lt_valutab-selname EQ ‘BUDCAT1’.
fmbl-budcat = lt_valutab-low.
ELSEIF lt_valutab-selname EQ ‘DISTKEY1’.
fmbl-distkey = lt_valutab-low.
ELSEIF lt_valutab-selname EQ ‘DOCDATE1’.
IF lt_valutab-low  IS NOT INITIAL.
CONCATENATE lt_valutab-low+6(4) lt_valutab-low+3(2) lt_valutab-low(2) INTO fmbh-docdate.
ENDIF.
ELSEIF lt_valutab-selname EQ ‘FISYEAR1’.
fmbl-fiscyear = lt_valutab-low.
ELSEIF lt_valutab-selname EQ ‘FUND1’.
fmfincode-fincode = lt_valutab-low.
ELSEIF lt_valutab-selname EQ ‘RPMAX1’.
fmbl-rpmax = lt_valutab-low.
ENDIF.
ENDLOOP.
ENDFORM.                    ” POPULATE_VALUE
*&———————————————————————*
*&      Form  Upload_data
*&———————————————————————*
*       text
*———————————————————————-*
*  –>  p1        text
*  <–  p2        text
*———————————————————————-*
FORM upload_data .
IF p_file IS INITIAL.
MESSAGE ‘Please enter xlsx format file’ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ELSE.
CALL FUNCTION ‘SO_SPLIT_FILE_AND_PATH’
EXPORTING
full_name     = p_file
IMPORTING
stripped_name = gv_flname.
IF sy-subrc <> 0.
MESSAGE ‘Enter the correct file name’ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.

TRANSLATE p_file TO UPPER CASE.
IF p_file NS gv_xlsf.
MESSAGE ‘Please enter xlsx format file’ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.

IF rad1 = gv_lheader.
IF gv_flname NS gv_fnme.
MESSAGE ‘Please insert Budget Enter file’ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.

CALL FUNCTION ‘TEXT_CONVERT_XLS_TO_SAP’
EXPORTING
i_line_header        = gv_lheader
i_tab_raw_data       = gv_truxs
i_filename           = p_file
TABLES
i_tab_converted_data = gt_enter
EXCEPTIONS
conversion_failed    =
1
OTHERS               = 2.
IF sy-subrc <> 0.
MESSAGE ‘File can not be proceed as it is already opened’ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.
ENDIF.
ENDIF.
ENDFORM.                    ” Upload_data
*&———————————————————————*
*&      Form  BAPI
*&———————————————————————*
*       text
*———————————————————————-*
*  –>  p1        text
*  <–  p2        text
*———————————————————————-*
FORM bapi .
*===============================================================================*
*                BAPI FOR NET BUDGET ENTRY IN THE BEGINNING OF THE YEAR         *
*===============================================================================*
IF rad1 = gv_lheader. ” Budget Enter Automation process
PERFORM upload_data.
PERFORM enter_automation.
PERFORM display_bud_enter.

*   export to memory
IF gt_check IS NOT INITIAL .
CLEAR: gt_enter,gt_release,gt_rrelease,gt_transfer.
EXPORT gt_check1 FROM gt_check TO MEMORY ID ‘v_check’.
ENDIF.
IF gt_enter IS NOT INITIAL.
EXPORT  gt_enter1 FROM gt_enter TO MEMORY ID ‘v_ent’.
ENDIF.
ENDIF.
*=========================================================================================*
*              BAPI TO UPLOAD DATA FOR BUDGET RELEASED                                    *
*=========================================================================================*
IF rad2 = gv_lheader. ” Budget Transfer Automation process
PERFORM budget_automation.
ENDIF.

ENDFORM.                    ” BAPI
*&———————————————————————*
*&      Module  READ_FMB  OUTPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE read_fmb OUTPUT.
READ TABLE fmbl.                “INDEX SY-INDEX.               “ztable-CURRENT_LINE.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING fmbl TO ztable.
ELSE.
EXIT FROM STEP-LOOP.
ENDIF.
ENDMODULE.                 ” READ_FMB  OUTPUT
*&———————————————————————*
*&      Module  DISPLAY_ICON  OUTPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE display_icon OUTPUT.
MOVE ‘ICON_YELLOW_LIGHT’ TO yellow_icon.
MOVE ‘Success’ TO hlp_quick.

CALL FUNCTION ‘ICON_CREATE’
EXPORTING
name                  = yellow_icon
info                  = hlp_quick
add_stdinf            =
‘X’
IMPORTING
result                = status_icon
EXCEPTIONS
icon_not_found        =
1
outputfield_too_short =
2
OTHERS                = 3.

IF sy-subrc <> 0.
CLEAR status_icon.
ENDIF.
ENDMODULE.                 ” DISPLAY_ICON  OUTPUT
*&———————————————————————*
*&      Form  DISPLAY_DATA
*&———————————————————————*
*       text
*———————————————————————-*
*  –>  p1        text
*  <–  p2        text
*———————————————————————-*
FORM display_bud_enter .
*   import output table from the memory and free afterwards
IMPORT  gt_enter1 = gt_enter FROM MEMORY ID ‘v_ent’.
FREE MEMORY ID ‘v_ent’.

IF gt_enter IS NOT INITIAL.
IF rad1 = gv_lheader.
* *   Create a docking control at bottom
CHECK lo_dock IS INITIAL.
CREATE OBJECT lo_dock
EXPORTING
repid = sy-cprog
dynnr = sy-dynnr
ratio =
75
side  = cl_gui_docking_container=>dock_at_bottom
name  =
‘DOCK_CONT’.
IF sy-subrc <> 0.
MESSAGE ‘Error in the Docking control’ TYPE ‘E’.
ENDIF.
CREATE OBJECT g_splitter
EXPORTING
parent  = lo_dock
rows    = 2
columns =
1.
** Upper Container
CALL METHOD g_splitter->get_container
EXPORTING
row       =
1
column    =
1
RECEIVING
container = g_container_1.
** Lower Container
CALL METHOD g_splitter->get_container
EXPORTING
row       =
2
column    =
1
RECEIVING
container = g_container_2.
** Upper Container height
CALL METHOD g_splitter->set_row_height
EXPORTING
id     = 1
height =
20.
* Header
CONCATENATE ‘Budget Enter Automation’ ‘ ‘ INTO l_header.
CREATE OBJECT l_document.

CALL METHOD l_document->add_gap.
CALL METHOD l_document->add_text
EXPORTING
text      = l_header                                “text-001
sap_style = cl_dd_area=>medium.

CALL METHOD l_document->new_line.
CLEAR : l_header.
* Message
CONCATENATE ‘Budget Enter has been processed successfully’ ‘ ‘ INTO gv_message.
CONCATENATE ‘Success:   ‘ gv_message INTO l_header.

CALL METHOD l_document->add_gap.
CALL METHOD l_document->add_text
EXPORTING
text      = l_header                                “text-001
sap_style = cl_dd_area=>medium.
CALL METHOD l_document->new_line.
CLEAR : l_header.
*====================================================================================*
*            DISPLAY DOCUMENT NUMBER FOR BUDGET ENTER AND RELEASE ENTER              *
*====================================================================================*
SHIFT gv_enter_docnum LEFT DELETING LEADING ‘0’.
CONCATENATE ‘Enter Document No:   ‘ gv_enter_docnum INTO l_header.
*      CREATE OBJECT l_document.
CALL METHOD l_document->add_text
EXPORTING
text      = l_header                              “text-001
sap_style = cl_dd_area=>medium.
CALL METHOD l_document->new_line.
CLEAR : l_header.

SHIFT gv_rels_docnum LEFT DELETING LEADING ‘0’.
CONCATENATE ‘Release Document No:   ‘ gv_rels_docnum INTO l_header.
CALL METHOD l_document->add_text
EXPORTING
text      = l_header                              “text-001
sap_style = cl_dd_area=>medium.
CALL METHOD l_document->new_line.
CLEAR : l_header.
*=================================================================================*
* DATE
CONCATENATE sy-datum+6(2) ‘/’
sy-datum+
4(2) ‘/’
sy-datum(
4)
INTO   gv_info.
CONCATENATE ‘Date:   ‘ gv_info INTO l_header.
CALL METHOD l_document->add_gap.
CALL METHOD l_document->add_text
EXPORTING
text      = l_header                              “text-001
sap_style = cl_dd_area=>medium.
CALL METHOD l_document->new_line.
CLEAR : l_header.
CALL METHOD l_document->display_document
EXPORTING
parent = g_container_1.
*   Create a SALV for output
CHECK lo_alv IS INITIAL.
TRY.
*       Narrow Casting: To initialize custom container from
*       docking container
lo_cont ?= g_container_2.
“lo_dock.
*       SALV Table Display on the Docking container
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = if_salv_c_bool_sap=>false
r_container  = g_container_2
“lo_cont
IMPORTING
r_salv_table = lo_alv
CHANGING
t_table      = gt_enter.
CATCH cx_salv_msg .
ENDTRY.
*   Pf status
lo_functions = lo_alv->get_functions( ).
lo_functions->set_default( abap_true ).
go_columns = lo_alv->get_columns( ).
*      go_columns->set_optimize( ‘X’ ).
TRY.
go_column ?= go_columns->get_column(
‘VALTYPE’ ).
go_column->set_long_text(
‘BCS Value Type’ ).
go_column->set_output_length(
’15’ ).
go_column ?= go_columns->get_column(
‘PROCESS_UI’ ).
go_column->set_long_text(
‘Process’ ).
go_column->set_output_length(
‘9’ ).
go_column ?= go_columns->get_column(
‘DOCTYPE’ ).
go_column->set_long_text(
‘Document Type’ ).
go_column->set_output_length(
’16’ ).
go_column ?= go_columns->get_column(
‘SFISCYEAR’ ).
go_column->set_long_text(
‘Fiscal Year’ ).
go_column->set_output_length(
’12’ ).
go_column ?= go_columns->get_column(
‘SBUDTYPE’ ).
go_column->set_long_text(
‘Budget Type’ ).
go_column->set_output_length(
’12’ ).
go_column ?= go_columns->get_column(
‘SFUND’ ).
go_column->set_long_text(
‘Fund’ ).
go_column->set_output_length(
‘4’ ).
go_column ?= go_columns->get_column(
‘VERSION’ ).
go_column->set_long_text(
‘Version’ ).
go_column->set_output_length(
‘7’ ).
go_column ?= go_columns->get_column(
‘DOCDATE’ ).
go_column->set_long_text(
‘Document date’ ).
go_column->set_output_length(
’13’ ).
go_column ?= go_columns->get_column(
‘SPERIOD’ ).
go_column->set_long_text(
‘Period’ ).
go_column->set_output_length(
‘6’ ).
go_column ?= go_columns->get_column(
‘FUNDSCTR’ ).
go_column->set_long_text(
‘Cost Center’ ).
go_column->set_output_length(
’11’ ).
go_column ?= go_columns->get_column(
‘CMMTITEM’ ).
go_column->set_long_text(
‘GL Account’ ).
go_column->set_output_length(
’10’ ).
go_column ?= go_columns->get_column(
‘TVALUE’ ).
go_column->set_long_text(
‘Amount’ ).
go_column->set_output_length(
‘7’ ).
go_column ?= go_columns->get_column(
‘DISTKEY’ ).
go_column->set_long_text(
‘Distribution Key’ ).
go_column->set_output_length(
’15’ ).
CATCH cx_salv_not_found.                        “#EC NO_HANDLER
ENDTRY.
DATA: lr_header TYPE REF TO cl_salv_form_header_info.
CREATE OBJECT lr_header
EXPORTING
text = ‘This is my Header’.                       “#EC NOTEXT
lo_alv->set_end_of_list( lr_header ).
*   output display
lo_alv->display( ).
lo_alv->refresh( ).
ENDIF.
ENDIF.
* endif.
*=============================================================================================*
*                   DISPLAY THE ERROR SCREEN                                                  *
*=============================================================================================*
IMPORT  gt_check1 = gt_check FROM MEMORY ID ‘v_check’.
FREE MEMORY ID ‘v_check’.
IF gt_check IS NOT INITIAL.
CHECK lo_dock IS INITIAL.
CREATE OBJECT lo_dock
EXPORTING
repid = sy-cprog
dynnr = sy-dynnr
ratio =
68
side  = cl_gui_docking_container=>dock_at_bottom
name  =
‘DOCK_CONT’.
IF sy-subrc <> 0.
MESSAGE ‘Error in the Docking control’ TYPE ‘S’.
ENDIF.
CREATE OBJECT g_splitter
EXPORTING
parent  = lo_dock
rows    = 2
columns =
1.
** Upper Container
CALL METHOD g_splitter->get_container
EXPORTING
row       =
1
column    =
1
RECEIVING
container = g_container_1.
** Lower Container
CALL METHOD g_splitter->get_container
EXPORTING
row       =
2
column    =
1
RECEIVING
container = g_container_2.
** Upper Container height
CALL METHOD g_splitter->set_row_height
EXPORTING
id     = 1
height =
20.
*    concatenate ‘Document No.:’ gv_documentnumber into l_header.
CREATE OBJECT l_document.
CALL METHOD l_document->add_text
EXPORTING
text      = ‘File is not uploaded successfully’
sap_style = cl_dd_area=>medium.
CALL METHOD l_document->display_document
EXPORTING
parent = g_container_1.
*   Create a SALV for output
CHECK lo_alv IS INITIAL.
TRY.
lo_cont ?= g_container_2.
“lo_dock.
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display   = if_salv_c_bool_sap=>false
r_container    = g_container_2
“lo_cont
*           container_name = ‘DOCK_CONT’
IMPORTING
r_salv_table   = lo_alv
CHANGING
t_table        = gt_check.
CATCH cx_salv_msg .
ENDTRY.
*   Pf status
lo_functions = lo_alv->get_functions( ).
lo_functions->set_default( abap_true ).
go_columns = lo_alv->get_columns( ).
go_columns->set_optimize(
‘X’ ).
TRY.
go_column ?= go_columns->get_column(
‘MSG1’ ).
go_column->set_long_text(
‘Message’ ).
go_column ?= go_columns->get_column(
‘MSGTYPE’ ).
go_column->set_long_text(
‘Message type’ ).
go_column ?= go_columns->get_column(
‘ICON’ ).
go_column->set_long_text(
‘Symbol’ ).
CATCH cx_salv_not_found.                          “#EC NO_HANDLER
ENDTRY.
lo_alv->display( ).
lo_alv->refresh( ).
ENDIF.
ENDFORM.                    ” DISPLAY_DATA
*&———————————————————————*
*&      Form  CLEAR_CONTAINER
*&———————————————————————*
*       text
*———————————————————————-*
*  –>  p1        text
*  <–  p2        text
*———————————————————————-*
FORM clear_container .
CHECK lo_dock IS NOT INITIAL.
CALL METHOD lo_dock->free.
CLEAR: lo_dock.
ENDFORM.                    ” CLEAR_CONTAINER
*&———————————————————————*
*&      Form  ENTER AUTOMATION
*&———————————————————————*
*       text
*———————————————————————-*
*  –>  p1        text
*  <–  p2        text
*———————————————————————-*
FORM enter_automation .
FREE : lo_dock,lo_alv,lo_cont,gt_check.
IF gt_enter IS NOT INITIAL.
LOOP AT gt_enter INTO gw_enter.
*===========================================================================================*
*                    VALIDATION OF COST CENTRE AND GL                                       *
*===========================================================================================*
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value     = gw_enter
IMPORTING
ex_container = container.
TRANSLATE container TO UPPER CASE.
CALL METHOD cl_abap_container_utilities=>read_container_c
EXPORTING
im_container = container
IMPORTING
ex_value     = gw_enter.
lv_count = sy-tabix.
lv_count = lv_count +
1.
*———————————————————————*
*              VALIDATEION FOR VAL TYPE                               *
*———————————————————————*
IF gw_enter-valtype NE ‘BUDGET’.
CONDENSE lv_count.
CONCATENATE gw_enter-valtype text001 lv_count
INTO gw_check-msg1 SEPARATED BY space.
gw_check-msgtype =
‘E’.
gw_check-
icon = ‘@0A@’.
APPEND gw_check TO gt_check.
CLEAR gw_check.
ENDIF.
*———————————————————————*
*              VALIDATEION FOR PROCESS TYPE                           *
*———————————————————————*
IF gw_enter-process_ui NE ‘ENTER’.
CONDENSE lv_count.
CONCATENATE gw_enter-process_ui text002 lv_count
INTO gw_check-msg1 SEPARATED BY space.
gw_check-msgtype =
‘E’.
gw_check-
icon = ‘@0A@’.
APPEND gw_check TO gt_check.
CLEAR gw_check.
ENDIF.
*———————————————————————*
*              VALIDATEION FOR FISCAL YEAR                            *
*———————————————————————*
IF gw_enter-sfiscyear NE sy-datum(4).
CONDENSE lv_count.
CONCATENATE gw_enter-sfiscyeartext003 lv_count
INTO gw_check-msg1 SEPARATED BY space.
gw_check-msgtype =
‘E’.
gw_check-
icon = ‘@0A@’.
APPEND gw_check TO gt_check.
CLEAR gw_check.
ENDIF.
*———————————————————————*
*              VALIDATEION FOR COST CENTRE                            *
*———————————————————————*
IF gw_enter-fundsctr IS INITIAL.
CONDENSE lv_count.
CONCATENATE gw_enter-fundsctr text003 lv_count
INTO gw_check-msg1 SEPARATED BY space.
gw_check-msgtype =
‘E’.
gw_check-
icon = ‘@0A@’.
APPEND gw_check TO gt_check.
CLEAR gw_check.
ENDIF.
*———————————————————————*
*              VALIDATEION FOR GL                                     *
*———————————————————————*
IF gw_enter-cmmtitem IS INITIAL.
CONDENSE lv_count.
CONCATENATE gw_enter-cmmtitem text003 lv_count
INTO gw_check-msg1 SEPARATED BY space.
gw_check-msgtype =
‘E’.
gw_check-
icon = ‘@0A@’.
APPEND gw_check TO gt_check.
CLEAR gw_check.
ENDIF.

CLEAR: gw_enter.
ENDLOOP.
*===========================================================================================*
IF gt_check IS INITIAL.
LOOP AT gt_enter INTO gw_enter.
“Header
IF gt_header IS INITIAL.
gw_header-fm_area = gv_fmarea1.
gw_header-version = gw_enter-version.
IF gw_enter-docdate  IS NOT INITIAL.
CONCATENATE gw_enter-docdate+6(4) gw_enter-docdate+3(2) gw_enter-docdate(2) INTO docdate.
ENDIF.
gw_header-docdate  = docdate.
gw_header-doctype  = gw_enter-doctype.
gw_header-docstate = gv_docstat.
“Posted
gw_header-process  = gv_process.
“ENTR
APPEND gw_header TO gt_header.
ENDIF.
“Items
gv_counter              = sy-tabix.
gw_transfer_from-valtype         = gv_ivaltyp.
“B1 – Budget
gw_transfer_from-item_num        = gv_counter.
gw_transfer_from-fisc_year       = gw_enter-sfiscyear.
gw_transfer_from-budcat          = gv_budcat.
gw_transfer_from-budtype         = gw_enter-sbudtype.

gw_transfer_from-fund            = gw_enter-sfund.
“FUND – ABCD
gw_transfer_from-funds_ctr       = gw_enter-fundsctr.
“CC
gw_transfer_from-cmmt_item       = gw_enter-cmmtitem.
“GL
gw_transfer_from-trans_curr      = gv_trcurr.
gw_transfer_from-trans_curr_iso  = gv_trcurr.
“Period
gw_period-item_num         = gv_counter.
gw_period-budgeting_period = gv_bperiod.
gw_period-period_amount    = gw_enter-tvalue.
APPEND gw_transfer_from TO gt_transfer_from.
APPEND gw_period TO gt_period.
CLEAR: gw_enter.
CLEAR : gv_counter.
ENDLOOP.
READ TABLE gt_header INTO gw_header INDEX 1.
IF sy-subrc = 0.
CALL FUNCTION ‘BAPI_0050_CREATE’
EXPORTING
header_data    = gw_header
testrun        =
‘ ‘
IMPORTING
fmarea         = gv_fmarea
documentyear   = gv_documentyear
documentnumber = gv_enter_docnum
TABLES
item_data      = gt_transfer_from
period_data    = gt_period
return         = lt_return.
IF lt_return IS NOT INITIAL.
LOOP AT gt_transfer_from INTO  gw_transfer_from.
gw_transfer_from-valtype = gv_ivaltyp1.
“R1 – released
ENDLOOP.
CALL FUNCTION ‘BAPI_0050_CREATE’
EXPORTING
header_data    = gw_header
testrun        =
‘ ‘
IMPORTING
fmarea         = gv_fmarea
documentyear   = gv_documentyear
documentnumber = gv_rels_docnum
TABLES
item_data      = gt_transfer_from
period_data    = gt_period
return         = lt_return.
IF lt_return IS INITIAL.
MESSAGE ‘Document number is not generated ‘ TYPE ‘E’ DISPLAY LIKE ‘I’.
ELSE.
CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’
EXPORTING
wait = gv_lheader.
ENDIF.
ELSE.
MESSAGE ‘Document number is generated for  Release Enter’ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM.                    ” ENTER AUTOMATION
*&———————————————————————*
*&      Form  budget_automation
*&———————————————————————*
*       text
*———————————————————————-*
*  –>  p1        text
*  <–  p2        text
*———————————————————————-*
FORM budget_automation .
DATA: check_flag TYPE bool VALUE abap_true.
*========================================================================*
*                  VALIDATION FOR RELEASED RETURN                        *
*========================================================================*

*=========================================================================================*
*               UPLOAD DATA FOR THE RELEASE RETURN                                        *
*=========================================================================================*
“To DO
IF t_final IS INITIAL.
MESSAGE ‘Please enter the values.’ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.
*                             1. Release Return Process
LOOP AT t_final INTO wa_final.
sy-
index = 1.
gv_counter = sy-tabix.
“Header
gw_header-fm_area           = gv_fmarea1.                
” ABCD
gw_header-version           = gv_verson.                 
” 000
gw_header-docdate           = fmbh-docdate.
gw_header-doctype           = gv_budrel.                 
” 2000
gw_header-docstate          = gv_docstat.                
” 1
gw_header-process           = gv_rprocess.               
” Return
IF gt_header IS INITIAL.
APPEND gw_header TO gt_header.
ENDIF.
“Items
IF gv_counter GT 1.
gv_counter =
1.
ENDIF.
gw_transfer_from-item_num            = gv_counter.
gw_transfer_from-fisc_year           = fmbl-fiscyear.
gw_transfer_from-budcat              =
‘9F’.              “Pyment
gw_transfer_from-budtype             = gv_rbudty.        
“15
gw_transfer_from-fund                = gv_fund.          
“ABCD
gw_transfer_from-funds_ctr           = wa_final-fundsctr.
” From Fund center
gw_transfer_from-cmmt_item           = wa_final-cmmtitem.
” From GL
gw_transfer_from-trans_curr          = gv_trcurr.        
“QAR
gw_transfer_from-trans_curr_iso      = gv_trcurr.        
“QAR
gw_transfer_from-valtype             = gv_ivaltyp1.      
“Released
APPEND gw_transfer_from TO gt_transfer_from.
“Period
gw_period-item_num          = gv_counter.
gw_period-budgeting_period  = gv_bperiod.                
“001
gw_period-period_amount     = wa_final-tval01.
APPEND gw_period TO gt_period.

“Process
READ TABLE gt_header INTO gw_header INDEX 1.
IF sy-subrc = 0.
CALL FUNCTION ‘BAPI_0050_CREATE’
EXPORTING
header_data    = gw_header
testrun        =

IMPORTING
fmarea         = gv_fmarea
documentyear   = gv_documentyear
documentnumber = gv_return_docnum
TABLES
item_data      = gt_transfer_from
period_data    = gt_period
return         = lt_return.

IF gv_return_docnum IS  NOT INITIAL.
READ TABLE lt_return INDEX sy-index INTO wa_return .
wa_show_result-gv_return = gv_return_docnum.
wa_show_result-gv_msg = wa_return-
message.
”                                           2. Budget Transfer Process
gw_header-doctype                  = gv_budtrn.         
” 1000
gw_header-process                  = gv_tprocess.       
” Transfer
LOOP AT gt_transfer_from INTO  gw_transfer_from.
gw_transfer_from-valtype         = gv_ivaltyp.        
” Budget
gw_transfer_from-budtype         = gv_tbudty.         
“ABCD
ENDLOOP.
REFRESH gt_transfer_from.

READ TABLE t_final INTO wa_final INDEX sy-index.
gv_counter = gv_counter +
1.
gw_speriod-item_num              = gv_counter.

gw_transfer_to-item_num          = gv_counter.
gw_transfer_to-fisc_year         = fmbl-fiscyear.
gw_transfer_to-budcat            = gv_budcat.           ” 9F
gw_transfer_to-budtype           = gv_tbudty.          
” ABCD
gw_transfer_to-fund              = gv_fund.            
” ABCD
gw_transfer_to-funds_ctr         = wa_final-fictr.     
” To Fund center
gw_transfer_to-cmmt_item         = wa_final-fipex.     
” To GL
gw_transfer_to-trans_curr        = gv_trcurr.          
” QAR
gw_transfer_to-trans_curr_iso    = gv_trcurr.          
” QAR
gw_transfer_to-valtype           = gv_ivaltyp.         
” Budget

gw_speriod-budgeting_period      = gv_bperiod.
gw_speriod-period_amount         = wa_final-tval01.

REFRESH gt_speriod.
APPEND gw_speriod TO gt_speriod.
APPEND gw_transfer_to TO gt_transfer_to.
APPEND gw_transfer_from TO gt_transfer_from.
APPEND wa_show_result TO t_show_result.
CLEAR  wa_show_result.

CALL FUNCTION ‘BAPI_0050_CREATE’
EXPORTING
header_data        = gw_header
testrun            =
‘ ‘
IMPORTING
fmarea             = gv_fmarea
documentyear       = gv_documentyear
documentnumber     = gv_transfer_docnum
TABLES
item_data          = gt_transfer_from
sender_item_data   = gt_transfer_to
period_data        = gt_period
sender_period_data = gt_speriod
return             = lt_return.
IF gv_transfer_docnum IS NOT INITIAL.
sy-
index = sy-index + 1.
READ TABLE lt_return INDEX sy-index INTO wa_return .
wa_show_result-gv_transfer = gv_transfer_docnum.
wa_show_result-gv_msg = wa_return-
message.
”                                               3. Budget Released Process
gw_header-doctype            = gv_budtrn.              
” 1000
gw_header-process            = gv_process.             
” Enter
LOOP AT gt_transfer_from INTO  gw_transfer_from.
gw_transfer_from-funds_ctr = wa_final-fictr.         
” To Fund center
gw_transfer_from-cmmt_item = wa_final-fipex.         
” To GL
gw_transfer_from-valtype   = gv_ivaltyp1.            
” Released
ENDLOOP.
APPEND wa_show_result TO t_show_result.
CLEAR  wa_show_result.
CALL FUNCTION ‘BAPI_0050_CREATE’
EXPORTING
header_data    = gw_header
testrun        =

IMPORTING
fmarea         = gv_fmarea
documentyear   = gv_documentyear
documentnumber = gv_rels_docnum
TABLES
item_data      = gt_transfer_from
period_data    = gt_period
return         = lt_return.
IF gv_rels_docnum IS NOT INITIAL.
sy-
index = sy-index + 1.
READ TABLE lt_return INDEX sy-index INTO wa_return .
wa_show_result-gv_rels = gv_rels_docnum.
wa_show_result-gv_msg = wa_return-
message.
APPEND wa_show_result TO t_show_result.
CLEAR  wa_show_result.
”                                                       Commit
CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’
EXPORTING
wait = gv_lheader.
ELSE.
“To DO
LOOP AT lt_return INTO wa_return WHERE number EQ ‘001’.
wa_show_result-gv_msg = wa_return-
message.
APPEND wa_show_result TO t_show_result.
CLEAR  wa_show_result.
ENDLOOP.
ENDIF.
ELSE.
“To DO
LOOP AT lt_return INTO wa_return WHERE number EQ ‘001’.
wa_show_result-gv_msg = wa_return-
message.
APPEND wa_show_result TO t_show_result.
CLEAR  wa_show_result.
ENDLOOP.
ENDIF.
ELSE.
“To DO
LOOP AT lt_return INTO wa_return WHERE number EQ ‘001’.
wa_show_result-gv_msg = wa_return-
message.
APPEND wa_show_result TO t_show_result.
CLEAR  wa_show_result.
ENDLOOP.
ENDIF.
ENDIF.
REFRESH gt_transfer_from.
REFRESH gt_header.
REFRESH gt_period.
REFRESH gt_transfer_to.
REFRESH lt_return.
ENDLOOP.
sy-
index = 1.
ENDFORM.                    ” budget_automation
*&———————————————————————*
*&      Module  UPDATE_TABLE  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE update_table INPUT.
wa_final-status_icon = status_icon.
wa_final-fundsctr   = fmbl-fundsctr.
wa_final-cmmtitem = fmbl-cmmtitem.
wa_final-fictr    = fmfctr-fictr.
wa_final-fipex    = fmci-fipex.
wa_final-tval01   = fmbl-tval01.
wa_final-stus     = status.

APPEND wa_final TO t_final.
DELETE ADJACENT DUPLICATES FROM t_final COMPARING fundsctr cmmtitem fictr fipex tval01 .
CLEAR wa_final.
ENDMODULE.                 ” UPDATE_TABLE  INPUT
*&———————————————————————*
*&      Module  F4_FUNDSCTR  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE f4_fundsctr INPUT.
DATA:
w_dynpfields
TYPE dynpread,
i_dynpfields
LIKE STANDARD TABLE OF dynpread.

IF t_fmbl_coscen[] IS INITIAL.
SELECT fictr
FROM fmfctr
INTO TABLE t_fmbl_coscen.
ENDIF.
CALL FUNCTION ‘F4IF_INT_TABLE_VALUE_REQUEST’
EXPORTING
retfield    =
‘FUNDSCTR’
dynpprog    = sy-repid
dynpnr      = sy-dynnr
dynprofield =
‘FMBL-FUNDSCTR’
value_org   =
‘S’
TABLES
value_tab   = t_fmbl_coscen.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE.                 ” F4_FUNDSCTR  INPUT
*&———————————————————————*
*&      Module  F4_COMMITM  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE f4_commitm INPUT.

IF t_fmbl_glaccn[] IS INITIAL.
SELECT fipex
FROM fmci
INTO TABLE t_fmbl_glaccn.
ENDIF.
CALL FUNCTION ‘F4IF_INT_TABLE_VALUE_REQUEST’
EXPORTING
retfield    =
‘CMMTITEM’
dynpprog    = sy-repid
dynpnr      = sy-dynnr
dynprofield =
‘FMBL-CMMTITEM’
value_org   =
‘S’
TABLES
value_tab   = t_fmbl_glaccn.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE.                 ” F4_COMMITM  INPUT
*&———————————————————————*
*&      Module  F4_COSTSCTR  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE f4_costsctr INPUT.

IF t_fmbl_funcen[] IS INITIAL.
SELECT fictr
FROM fmfctr
INTO TABLE t_fmbl_funcen.
ENDIF.
CALL FUNCTION ‘F4IF_INT_TABLE_VALUE_REQUEST’
EXPORTING
retfield    =
‘FICTR’
dynpprog    = sy-repid
dynpnr      = sy-dynnr
dynprofield =
‘FMFCTR-FICTR’
value_org   =
‘S’
TABLES
value_tab   = t_fmbl_funcen.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE.                 ” F4_COSTSCTR  INPUT
*&———————————————————————*
*&      Module  F4_GLACCNT  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE f4_glaccnt INPUT.
IF t_fmbl_cmmitm[] IS INITIAL.
SELECT fipex
FROM fmci
INTO TABLE t_fmbl_cmmitm.
ENDIF.
CALL FUNCTION ‘F4IF_INT_TABLE_VALUE_REQUEST’
EXPORTING
retfield    =
‘FIPEX’
dynpprog    = sy-repid
dynpnr      = sy-dynnr
dynprofield =
‘FMCI-FIPEX’
value_org   =
‘S’
TABLES
value_tab   = t_fmbl_cmmitm.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE.                 ” F4_GLACCNT  INPUT
**&———————————————————————*
*&      Module  CHECK_FUNDSCTR  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE check_fundsctr INPUT.
LOOP AT t_final INTO wa_final.
IF wa_final-fundsctr IS INITIAL AND fmbl-fundsctr IS NOT INITIAL.
wa_final-fundsctr = fmbl-fundsctr.
DELETE  t_final.
ELSEIF wa_final-fundsctr IS NOT INITIAL AND fmbl-fundsctr IS NOT INITIAL.
IF wa_final-fundsctr NE fmbl-fundsctr.
wa_final-fundsctr = fmbl-fundsctr.
DELETE  t_final.
ENDIF.
ENDIF.

IF wa_final-fundsctr IS NOT INITIAL.
SELECT SINGLE fundsctr FROM fmbl INTO wa_fmbl WHERE fundsctr EQ wa_final-fundsctr.
IF sy-subrc <> 0.
MESSAGE ‘Please enter the correct From fund center ‘ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.
ELSEIF wa_final-fundsctr IS INITIAL AND ztable-invisible NE ‘X’ AND ztable-left_col NE ‘0’.
MESSAGE ‘Please enter the From fund center ‘ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.
ENDLOOP.
sy-
index = 1.
ENDMODULE.                 ” CHECK_FUNDSCTR  INPUT
*&———————————————————————*
*&      Module  CHECK_CMMTITEM  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE check_cmmtitem INPUT.
LOOP AT t_final INTO wa_final.
IF wa_final-cmmtitem IS INITIAL AND fmbl-cmmtitem IS NOT INITIAL.
wa_final-cmmtitem = fmbl-cmmtitem.
MODIFY t_final FROM  wa_final TRANSPORTING cmmtitem.
ENDIF.
IF wa_final-cmmtitem IS NOT INITIAL.
SELECT SINGLE cmmtitem FROM fmbl INTO wa_fmbl WHERE cmmtitem EQ wa_final-cmmtitem.
IF sy-subrc <> 0.
MESSAGE ‘Please enter the correct From GL Account Number ‘ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.
ELSEIF wa_final-cmmtitem IS INITIAL AND ztable-invisible NE ‘X’ AND ztable-left_col NE ‘0’.
MESSAGE ‘Please enter the From GL Account Number ‘ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.
ENDLOOP.
ENDMODULE.                 ” CHECK_CMMTITEM  INPUT
*&———————————————————————*
*&      Module  CHECK_FICTR  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE check_fictr INPUT.
LOOP AT t_final INTO wa_final.
IF wa_final-fictr IS INITIAL AND fmfctr-fictr IS NOT INITIAL.
wa_final-fictr = fmfctr-fictr.
MODIFY t_final FROM  wa_final TRANSPORTING fictr.
ENDIF.
IF wa_final-fictr IS NOT INITIAL.
SELECT SINGLE fictr FROM fmfctr INTO wa_fmbl WHERE fictr EQ wa_final-fictr.
IF sy-subrc <> 0.
MESSAGE ‘Please enter the correct To Fund center ‘ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.
ELSEIF wa_final-fictr IS INITIAL AND ztable-invisible NE ‘X’ AND ztable-left_col NE ‘0’ .
MESSAGE ‘Please enter the To Fund center ‘ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.
ENDLOOP.
ENDMODULE.                 ” CHECK_FICTR  INPUT
*&———————————————————————*
*&      Module  CHECK_FIPEX  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE check_fipex INPUT.
LOOP AT t_final INTO wa_final.
IF wa_final-fipex IS INITIAL AND fmci-fipex IS NOT INITIAL.
wa_final-fipex = fmci-fipex.
MODIFY t_final FROM  wa_final TRANSPORTING fipex.
ENDIF.
IF wa_final-fipex IS NOT INITIAL.
SELECT SINGLE fipex FROM fmci INTO wa_fmbl WHERE fipex EQ wa_final-fipex.
IF sy-subrc <> 0.
MESSAGE ‘Please enter the correct To GL Account Number ‘ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.
ELSEIF wa_final-fipex IS INITIAL AND ztable-invisible NE ‘X’ AND ztable-left_col NE ‘0’.
MESSAGE ‘Please enter the To GL Account Number ‘ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.
ENDLOOP.
ENDMODULE.                 ” CHECK_FIPEX  INPUT
*&———————————————————————*
*&      Module  CHECK_TVAL01  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE check_tval01 INPUT.
LOOP AT t_final INTO wa_final.
IF wa_final-tval01 IS INITIAL AND fmbl-tval01 IS NOT INITIAL.
wa_final-tval01 = fmbl-tval01.
MODIFY t_final FROM  wa_final TRANSPORTING tval01.
ENDIF.
IF wa_final-tval01 IS INITIAL AND ztable-invisible NE ‘X’ AND ztable-left_col NE ‘0’.
MESSAGE ‘Please enter the Amount ‘ TYPE ‘S’ DISPLAY LIKE ‘E’.
CALL SCREEN 100.
ENDIF.
ENDLOOP.
ENDMODULE.                 ” CHECK_TVAL01  INPUT
*&———————————————————————*
*&      Module  display_field  INPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE display_field INPUT.
LOOP AT SCREEN.
IF screen-name = ‘RAD1’.
screeninput = 1.
MODIFY SCREEN.
ELSEIF screen-name = ‘RAD2’.
screeninput = 1.
MODIFY SCREEN.
ELSEIF screen-name = ‘P_FILE’.
screeninput = 1.
MODIFY SCREEN.
ELSEIF screen-name = ‘FMBL-FUNDSCTR’.
screeninput = 1.
MODIFY SCREEN.
ELSEIF screen-name = ‘FMBL-CMMTITEM’.
screeninput = 1.
MODIFY SCREEN.
ELSEIF screen-name = ‘FMFCTR-FICTR’.
screeninput = 1.
MODIFY SCREEN.
ELSEIF screen-name = ‘FMCI-FIPEX’.
screeninput = 1.
MODIFY SCREEN.
ELSEIF screen-name = ‘FMBL-TVAL01’.
screeninput = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE.                 ” display_field  INPUT
*&———————————————————————*
*&      Module  DISPLAY_STATUS  OUTPUT
*&———————————————————————*
*       text
*———————————————————————-*
MODULE display_status OUTPUT.
MOVE ‘ICON_GREEN_LIGHT’ TO green_icon.
MOVE ‘ICON_RED_LIGHT’ TO red_icon.
MOVE ‘Success’ TO hlp_quick.

READ TABLE t_show_result INTO wa_show_result INDEX sy-index.
IF  wa_show_result-gv_return IS NOT INITIAL.
LOOP AT SCREEN.
IF flag EQ 1.
IF  screen-name = ‘STATUS’ .
CONCATENATE wa_show_result-gv_msg  ‘ ‘ INTO status.
ELSEIF screen-name = ‘STATUS_ICON’ .
CALL FUNCTION ‘ICON_CREATE’
EXPORTING
name                  = green_icon
info                  = hlp_quick
add_stdinf            =
‘X’
IMPORTING
result                = status_icon
EXCEPTIONS
icon_not_found        =
1
outputfield_too_short =
2
OTHERS                = 3.
IF sy-subrc <> 0.
CLEAR status_icon.
ENDIF.
ELSEIF t_final IS NOT INITIAL.
READ TABLE t_final INTO wa_final INDEX sy-index.
IF screen-name = ‘FMBL-FUNDSCTR’.
CONCATENATE wa_final-fundsctr  ‘ ‘ INTO fmbl-fundsctr.
ELSEIF  screen-name = ‘FMBL-CMMTITEM’.
CONCATENATE wa_final-cmmtitem  ‘ ‘ INTO fmbl-cmmtitem.
ELSEIF screen-name = ‘FMFCTR-FICTR’.
CONCATENATE wa_final-fictr  ‘ ‘ INTO fmfctr-fictr.
ELSEIF screen-name = ‘FMCI-FIPEX’.
CONCATENATE wa_final-fipex  ‘ ‘ INTO fmci-fipex.
ELSEIF screen-name = ‘FMBL-TVAL01’.
fmbl-tval01 =  wa_final-tval01.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
ELSEIF wa_show_result-gv_transfer IS NOT INITIAL.
LOOP AT SCREEN.
IF flag EQ 1.
IF  screen-name = ‘STATUS’ .
CONCATENATE wa_show_result-gv_msg  ‘ ‘ INTO status.
ELSEIF screen-name = ‘STATUS_ICON’ .
CALL FUNCTION ‘ICON_CREATE’
EXPORTING
name                  = green_icon
info                  = hlp_quick
add_stdinf            =
‘X’
IMPORTING
result                = status_icon
EXCEPTIONS
icon_not_found        =
1
outputfield_too_short =
2
OTHERS                = 3.
IF sy-subrc <> 0.
CLEAR status_icon.
ENDIF.
ELSEIF t_final IS NOT INITIAL.
READ TABLE t_final INTO wa_final INDEX sy-index.
IF screen-name = ‘FMBL-FUNDSCTR’.
CONCATENATE wa_final-fundsctr  ‘ ‘ INTO fmbl-fundsctr.
ELSEIF  screen-name = ‘FMBL-CMMTITEM’.
CONCATENATE wa_final-cmmtitem  ‘ ‘ INTO fmbl-cmmtitem.
ELSEIF screen-name = ‘FMFCTR-FICTR’.
CONCATENATE wa_final-fictr  ‘ ‘ INTO fmfctr-fictr.
ELSEIF screen-name = ‘FMCI-FIPEX’.
CONCATENATE wa_final-fipex  ‘ ‘ INTO fmci-fipex.
ELSEIF screen-name = ‘FMBL-TVAL01’.
fmbl-tval01 =  wa_final-tval01.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
ELSEIF  wa_show_result-gv_rels IS NOT INITIAL.
LOOP AT SCREEN.
IF flag EQ 1.
IF  screen-name = ‘STATUS’ .
CONCATENATE wa_show_result-gv_msg  ‘ ‘ INTO status.
ELSEIF screen-name = ‘STATUS_ICON’ .
CALL FUNCTION ‘ICON_CREATE’
EXPORTING
name                  = green_icon
info                  = hlp_quick
add_stdinf            =
‘X’
IMPORTING
result                = status_icon
EXCEPTIONS
icon_not_found        =
1
outputfield_too_short =
2
OTHERS                = 3.
IF sy-subrc <> 0.
CLEAR status_icon.
ENDIF.
ELSEIF t_final IS NOT INITIAL.
READ TABLE t_final INTO wa_final INDEX sy-index.
IF screen-name = ‘FMBL-FUNDSCTR’.
CONCATENATE wa_final-fundsctr  ‘ ‘ INTO fmbl-fundsctr.
ELSEIF  screen-name = ‘FMBL-CMMTITEM’.
CONCATENATE wa_final-cmmtitem  ‘ ‘ INTO fmbl-cmmtitem.
ELSEIF screen-name = ‘FMFCTR-FICTR’.
CONCATENATE wa_final-fictr  ‘ ‘ INTO fmfctr-fictr.
ELSEIF screen-name = ‘FMCI-FIPEX’.
CONCATENATE wa_final-fipex  ‘ ‘ INTO fmci-fipex.
ELSEIF screen-name = ‘FMBL-TVAL01’.
fmbl-tval01 =  wa_final-tval01.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
ELSEIF  wa_show_result-gv_msg IS NOT INITIAL.
LOOP AT SCREEN.
IF flag EQ 1.
IF  screen-name = ‘STATUS’ .
CONCATENATE wa_show_result-gv_msg  ‘ ‘ INTO status.
ELSEIF screen-name = ‘STATUS_ICON’ .
CALL FUNCTION ‘ICON_CREATE’
EXPORTING
name                  = red_icon
info                  = hlp_quick
add_stdinf            =
‘X’
IMPORTING
result                = status_icon
EXCEPTIONS
icon_not_found        =
1
outputfield_too_short =
2
OTHERS                = 3.
IF sy-subrc <> 0.
CLEAR status_icon.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
CLEAR wa_return.
ENDIF.
IF t_show_result IS INITIAL.
READ TABLE t_final INTO wa_final INDEX sy-index.
LOOP AT SCREEN.
IF flag EQ 1.
READ TABLE t_final INTO wa_final INDEX sy-index.
IF screen-name = ‘FMBL-FUNDSCTR’.
CONCATENATE wa_final-fundsctr  ‘ ‘ INTO fmbl-fundsctr.
ELSEIF  screen-name = ‘FMBL-CMMTITEM’.
CONCATENATE wa_final-cmmtitem  ‘ ‘ INTO fmbl-cmmtitem.
ELSEIF screen-name = ‘FMFCTR-FICTR’.
CONCATENATE wa_final-fictr  ‘ ‘ INTO fmfctr-fictr.
ELSEIF screen-name = ‘FMCI-FIPEX’.
CONCATENATE wa_final-fipex  ‘ ‘ INTO fmci-fipex.
ELSEIF screen-name = ‘FMBL-TVAL01’.
fmbl-tval01 =  wa_final-tval01.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
CLEAR wa_final.
CLEAR wa_show_result.
sy-
index = sy-index + 1.
ENDMODULE.                 ” DISPLAY_STATUS  OUTPUT


Screen 100 Code–>

PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL ztable.
MODULE display_icon.
MODULE display_status.
ENDLOOP.
MODULE status_0100.
MODULE modify_screen.

PROCESS AFTER INPUT.
LOOP WITH CONTROL ztable .
CHAIN .
FIELD status_icon.
FIELD fmbl-fundsctr MODULE check_fundsctr .
FIELD fmbl-cmmtitem MODULE check_cmmtitem.
FIELD fmfctr-fictr  MODULE check_fictr.
FIELD fmci-fipex    MODULE check_fipex.
FIELD fmbl-tval01   MODULE check_tval01.
FIELD status.
MODULE update_table ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE display_field.
MODULE user_command_0100 .

PROCESS ON VALUE-REQUEST.
FIELD p_file MODULE f4_filename.
FIELD fmbl-fundsctr MODULE f4_fundsctr.
FIELD fmbl-cmmtitem MODULE f4_commitm.

FIELD fmfctr-fictr MODULE f4_costsctr.


FIELD fmci-fipex  MODULE f4_glaccnt.

Screen 200 Code–>

PROCESS BEFORE OUTPUT.
MODULE STATUS_0200.
CALL SUBSCREEN sub1 INCLUDING SY-REPID ‘901’.
PROCESS AFTER
INPUT.
CALL SUBSCREEN sub1.
MODULE USER_COMMAND_0200.

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply