I am a SAP ABAP consultant and recently I have been requested to make enhancements to QA11 screen. After some research, I could manage to put things together. And I thought, it is worth creating a complete tutorial on that topic.

Therefore, in this article, I would to share with you how to add the material group field to the QA11 screen and QALS table.

 

We need to complete following steps;

  • Add our custom Z field to structure
  • We create a Function Group.
    • We are creating a screen.
    • We write the input and output codes.
    • We create functions.
  • We are creating BAdI implementation.
    • We enter the filter value and screen information.
    • We write the GET_DATA and PUT_DATA methods.

BAdI used: QEVA_SUBSCREEN_1101

 

First, we add our field to the QALS table. Go to SE11 > QALS > CI_QALS

We add our field, starting with ZZ.

Field name: ZZMATKL

Recommended: ‘Adding Field in standard Fiori apps of S/4HANA with Custom Fields and Logic’

 

After adding the field, we create the Function Group for the screen that we will add to the BAdI.

 

Then we create a Z screen to show the field we added to the QALS table in QA11.

Don’t forget to choose Subscreen.

We fill the TOP include of the Function Group we created as follows.

We will use the variables we defined in the get_data and put_data methods.

TABLES: qals_cust.
DATA: display          TYPE c,
      s_qals           TYPE qals,
      subscr_1101_qeva TYPE REF TO if_ex_qeva_subscreen_1101,
      flt_val          TYPE qherk,
      s_rqeva          TYPE rqeva.

 

We add the area to the screen.

We will use the qals_cust we added to the code in the field on the screen.

 

When QA11 is opened for the if_ex_qeva_subscreen_1101 interface, we create our reference for the get_data and put_data methods.
We enter the PBO information for the Screen.

MODULE status_1101 OUTPUT.

  IF subscr_1101_qeva IS INITIAL.
    CALL METHOD cl_exithandler=>get_instance_for_subscreens
      CHANGING
        instance                      = subscr_1101_qeva
      EXCEPTIONS
        no_reference                  = 1
        no_interface_reference        = 2
        no_exit_interface             = 3
        data_incons_in_exit_managem   = 4
        class_not_implement_interface = 5
        OTHERS                        = 6.

    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
  ENDIF.

ENDMODULE.

We call the information we entered in the ZZMATKL field in the PAI section. Then we give it to the get_data method.

We enter the PAI information for the Screen.

MODULE user_command_1101 INPUT.

  MOVE-CORRESPONDING qals_cust TO s_qals.

  IF subscr_1101_qeva IS NOT INITIAL .
    CALL METHOD subscr_1101_qeva->get_data
      EXPORTING
        flt_val = flt_val
      IMPORTING
        e_qals  = s_qals
        e_rqeva = s_rqeva.

  ENDIF .

ENDMODULE.

 

We create the GET_DATA and PUT_DATA functions.

 

In the function below, we transfer the values from the screen.

FUNCTION zed_fm_qa11_get_data.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  EXPORTING
*"     REFERENCE(E_QALS) TYPE  QALS
*"     REFERENCE(E_RQEVA) TYPE  RQEVA
*"----------------------------------------------------------------------

  MOVE-CORRESPONDING: s_qals TO e_qals.

ENDFUNCTION.

In the function below, we get the information from the screen.

FUNCTION zed_fm_qa11_put_data.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(I_QALS) TYPE  QALS OPTIONAL
*"     REFERENCE(I_RQEVA) TYPE  RQEVA OPTIONAL
*"     REFERENCE(I_QHERK) TYPE  QHERK OPTIONAL
*"----------------------------------------------------------------------

  MOVE-CORRESPONDING: i_qals  TO qals_cust,
                      i_qals  TO s_qals,
                      i_rqeva TO s_rqeva.

  MOVE i_qherk TO flt_val.

ENDFUNCTION.

 

Create BAdI Implementation

We implement the QEVA_SUBSCREEN_1101 BAdI that we need for the QA11 screen.

Create%20Implemantation%20QEVA_SUBSCREEN_1101

Don’t forget to add the filter value.

We specify in which control batch it will work.

We write the Function Group and Screen names we created in the Program called and Dynpro fields.

We activate development.

We move on to writing code to the GET_DATA and PUT_DATA methods.

We call the data on the screen with the GET_DATA method.

  METHOD IF_EX_QEVA_SUBSCREEN_1101~GET_DATA.

    DATA: PROGRAM_NAME TYPE STRING VALUE '(SAPMQEVA)QALS',
          INFOS        TYPE CI_QALS,
          CUST         TYPE CI_QALS.
    FIELD-SYMBOLS:<FS_INFO> TYPE QALS .

    CALL FUNCTION 'ZED_FM_QA11_GET_DATA'
      IMPORTING
        E_QALS  = E_QALS
        E_RQEVA = E_RQEVA.

    MOVE-CORRESPONDING E_QALS TO IF_EX_QEVA_SUBSCREEN_1101~G_QALS .
    ASSIGN (PROGRAM_NAME) TO <FS_INFO> .

    IF SY-SUBRC IS INITIAL.

      MOVE-CORRESPONDING E_QALS TO CUST .
      MOVE-CORRESPONDING CUST TO <FS_INFO> .
    ENDIF .

  ENDMETHOD.

With PUT_DATA, we put the data on the screen.

  METHOD IF_EX_QEVA_SUBSCREEN_1101~PUT_DATA.

    DATA: S_QALS TYPE QALS.

    IF IF_EX_QEVA_SUBSCREEN_1101~G_QALS IS NOT INITIAL .

      MOVE-CORRESPONDING IF_EX_QEVA_SUBSCREEN_1101~G_QALS TO S_QALS .
    ELSE.

      MOVE-CORRESPONDING I_QALS TO S_QALS .
    ENDIF .

    CALL FUNCTION 'ZED_FM_QA11_PUT_DATA'
      EXPORTING
        I_QALS  = S_QALS
        I_RQEVA = I_RQEVA
        I_QHERK = FLT_VAL.

  ENDMETHOD.

That’s all. Now those changes, we have completed the steps to add a new fields to QA11 screen.

QA11 Screen

You can see the value in the ZZMATKL field added to the QALS table.

Those are all the steps to enhance QA11 screen.

I hope that helps you. And If you know an alternative solution, please add it to comments.

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x