Skip to Content
0

Issue with F4 help for two fields - F4IF_INT_TABLE_VALUE_REQUEST

Dec 01, 2016 at 07:29 AM

111

avatar image

Dear Experts,

Greetings!

I have a requirement to build the F4 help in Module Pool. On F4 help of one field the second field should be auto filled.

Fields are: Work Center & Supply Area from CRHD table. Can you please help me with the scenario 2.

Scenario 1: if i pass DDIC Structure as CRHD and using DYNFFIELD_MAPPING.. i am able to successfully populate the second field value.

  DATA: lt_dynfieldmapping TYPE STANDARD TABLE OF dselc,
        ls_dynfieldmapping TYPE dselc,
        it_crhd TYPE STANDARD TABLE OF crhd,
        ls_crhd TYPE crhd,
        lt_return TYPE STANDARD TABLE OF ddshretval,
        wa_return TYPE ddshretval.
  CLEAR ls_dynfieldmapping.
  ls_dynfieldmapping-fldname = 'PRVBE'.
  ls_dynfieldmapping-dyfldname = 'CRHD-PRVBE'.
  APPEND ls_dynfieldmapping TO lt_dynfieldmapping.

  CLEAR ls_dynfieldmapping.
  ls_dynfieldmapping-fldname = 'ARBPL'.
  ls_dynfieldmapping-dyfldname = 'AFVGD-ARBPL'.
  APPEND ls_dynfieldmapping TO lt_dynfieldmapping.

  SELECT arbpl prvbe
    FROM crhd
    INTO TABLE it_crhd
    WHERE objty = 'A' AND werks = viqmel-mawerk."Plant number
  DATA: lv_repid LIKE sy-repid,
          lv_dynnr LIKE sy-dynnr.

  lv_repid = sy-repid.
  lv_dynnr = sy-dynnr.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      ddic_structure  = 'CRHD'
      retfield        = 'PRVBE'
      dynpprog        = lv_repid
      dynpnr          = lv_dynnr
      dynprofield     = 'CRHD-PRVBE'
      value_org       = 'S'
    TABLES
      value_tab       = it_crhd
      return_tab      = lt_return
      dynpfld_mapping = lt_dynfieldmapping
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.<br>

Scenario 2: if i dont use CRHD structure. I build my own local structure using 'TYPES' statement with only the two fields that are required for me. In this case, though i use the FIELD_TAB, i am not able to fill the second field.

TYPES: BEGIN OF t_crhd,
  arbpl TYPE arbpl,
  prvbe TYPE prvbe,
 END OF t_crhd.

  DATA: lt_dynfieldmapping TYPE STANDARD TABLE OF dselc,
        ls_dynfieldmapping TYPE dselc,
        it_crhd TYPE STANDARD TABLE OF t_crhd,
        ls_crhd TYPE t_crhd,
        lt_return TYPE STANDARD TABLE OF ddshretval,
      wa_return TYPE ddshretval,
      lt_field_tab TYPE STANDARD TABLE OF dfies,
      lt_field_tab1 TYPE STANDARD TABLE OF dfies,
      ls_field_tab TYPE dfies.

  CLEAR ls_dynfieldmapping.
  ls_dynfieldmapping-fldname = 'PRVBE'.
  ls_dynfieldmapping-dyfldname = 'CRHD-PRVBE'.
  APPEND ls_dynfieldmapping TO lt_dynfieldmapping.

  CLEAR ls_dynfieldmapping.
  ls_dynfieldmapping-fldname = 'ARBPL'.
  ls_dynfieldmapping-dyfldname = 'AFVGD-ARBPL'.
  APPEND ls_dynfieldmapping TO lt_dynfieldmapping.

  SELECT arbpl prvbe
    FROM crhd
    INTO TABLE it_crhd
    WHERE objty = 'A' AND werks = viqmel-mawerk."Plant

  DATA: lv_repid LIKE sy-repid,
          lv_dynnr LIKE sy-dynnr.
  lv_repid = sy-repid.
  lv_dynnr = sy-dynnr.

  CALL FUNCTION 'DDIF_FIELDINFO_GET'
    EXPORTING
      tabname              = 'CRHD'
     FIELDNAME            = 'ARBPL'
     LANGU                = SY-LANGU
   TABLES
     DFIES_TAB            = lt_field_tab
   EXCEPTIONS
     NOT_FOUND            = 1
     INTERNAL_ERROR       = 2
     OTHERS               = 3.
  IF sy-subrc <> 0.
* Implement suitable error handling here
   lt_field_tab1 = lt_field_tab.
  ENDIF.

  CALL FUNCTION 'DDIF_FIELDINFO_GET'
    EXPORTING
      tabname              = 'CRHD'
     FIELDNAME            = 'PRVBE'
     LANGU                = SY-LANGU
   TABLES
     DFIES_TAB            = lt_field_tab
   EXCEPTIONS
     NOT_FOUND            = 1
     INTERNAL_ERROR       = 2
     OTHERS               = 3.
  IF sy-subrc <> 0.
* Implement suitable error handling here
    append LINES OF lt_field_tab to lt_field_tab1.
  ENDIF.

 CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'PRVBE'
      dynpprog        = lv_repid
      dynpnr          = lv_dynnr
      dynprofield     = 'CRHD-PRVBE'
      value_org       = 'S'
    TABLES
      value_tab       = it_crhd
      field_tab       = lt_field_tab1
*      return_tab      = lt_return
      dynpfld_mapping = lt_dynfieldmapping
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.

In the Scneario 1 above, i am able to fill the second field automatically on the F4 help from the first field. But, unnecessarily i have to select all fields from CRHD and also in F4 help screen, unnecessarily we have to show all the fields where we need only 2 fields.

Whereas in the Scneario 2, here we are showing only 2 fields but the second field is not filled automatically.

Regards,

Shankar

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers