Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Command map with subrc = 4

Former Member
0 Likes
3,493

Dear Experts,

I'm currently facing a problem where I'm adding a Mapping List into an internal table.

Then the mapping will be executed dynamically based on the list.

The problem is that there are some fields where it isn't working.

May some can explain me more about the command "map" how it works.

-----------------------------------------------------------

Badi

include: LMEGUICJM

Class  lcl_req_item_table - Method  read_from_catalog

Line: 4954

TRY.

               CALL FUNCTION 'ME_MAP_CHAR_TO_PACK'

                 EXPORTING

                   im_pack = <target>

                 CHANGING

                   ch_char = <source>

                 EXCEPTIONS

                   OTHERS  = 1.


               map <s_target> ls_map_fields-item_field <source>.

-----------> if I use my own fields field it fails with subrc 4

             CATCH cx_sy_conversion_error cx_sy_arithmetic_error.

*                 Fehler bei Datenübernahme von &1 aus dem Katalog

*                 in das Feld &2

               MESSAGE i765(me)

                 WITH <source> ls_map_fields-item_field.

               l_map_error = mmpur_yes.

           ENDTRY.


In Badi: IF_EX_CATALOG_CUST~MAP_CATALOG_VALUES


       clear ls_fields_map.

       ls_fields_map-catalog_field = 'CUST_FIELD5'.

       ls_fields_map-item_field = 'PROCESS'.

       append ls_fields_map to ct_field_map.


PROCESS is available in EBAN user exit include CI_EBANDB.



1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,236

Thanks max,

you showed me the right way. I checked the macro and the two tables  my_cat_mapping and  my_cat_fs.

I also remembered this discussion.

At the end I implemented an enhancement spot in:



FORM mereq3211grid CHANGING ch_mapping TYPE mepo_t_metafield_mapping.

....

map 'PROCESS' mmmfd_cust_05.

....

ENDFORM.


Now everything is working fine.


May be someone else helps this too.

12 REPLIES 12
Read only

Former Member
0 Likes
3,236

Hi

map <s_target> ls_map_fields-item_field <source>


MAP is a macro:.



DEFINE map.

*     &1 - destination structure

*     &2 - destination field

*     &3 - source value

       is_input_allowed &2.

       if sy-subrc is initial.

         assign component &2 of structure &1 to <target>.

         if sy-subrc is initial.

           <target> = &3.

         endif.

       endif.

     END-OF-DEFINITION.

As you can see It move te value by field-symbols, the problem should be in IS_INPUT_ALLOWED, it's another macro:


DEFINE is_input_allowed.

*     &1 - destination field

*     lt_fs - lokal table fieldselection (metafield - fieldstatus)

*     my_cat_mapping - table fieldmapping (fieldname - metafield)

       read table my_cat_mapping into l_map

                                 with key fieldname = &1.

       if sy-subrc is initial.

         read table my_cat_fs into ls_fs

                              with key metafield = l_map-metafield.

         if sy-subrc is initial.

           if not ( ls_fs-fieldstatus eq '+' or

                    ls_fs-fieldstatus eq '.' or

                    ls_fs-fieldstatus is initial ).

             sy-subrc = 1.

           endif.

         endif.

       endif.

     END-OF-DEFINITION.

If it's returns a SY-SUBRC = 4, it means:

- or your field is not loaded in internal table MY_CAT_MAPPING

- or your field is not loaded in intenal table  MY_CAT_FS

So you should check why your fields is not in those table

Max

Read only

0 Likes
3,236

Dear Max,

thanks a lot for your fast answer.

I already checked this. Now I added a Enhancement Spot at the end of the Method where I now fill in the value for my field. This is a very dirty solution and didn't solve my problems at all.

I also tried to map another SAP Standard Field which also didn't worked. So only a view fields are able to be mapped.

So there must be anywhere a restriction.

Manuel

Read only

0 Likes
3,236

Which BADIs are you using?

Your fields are in structure MEREQ3211GRID?

Max

Read only

0 Likes
3,236

Yes they are. based on include CI_EBANDB and there I have my include added.

The Problem also appears if I try to map a value to Field 'FISTL' (Standard Field)

I'm using Badi ME_CATALOG_INTERFACE_CUST

Read only

0 Likes
3,236

I can't find that BADI

check if you have this BADI: MEGUI_LAYOUT

Read only

0 Likes
3,236

Yes I have this BADI MEGUI_LAYOUT

My Badi is in SE18 --> ES_BADI_ME_CATALOG

Read only

0 Likes
3,236

Try to use the BADI MEGUI_LAYOUT

That BADI is called in fm MEMFS_BUILD_MAPPING_PO_VIEWS (form BADI_MAPPING) in order to append own fields in mapping structure:


FORM badi_mapping  CHANGING ch_mapping TYPE mepo_t_metafield_mapping.

   DATA: l_badi_grid TYPE REF TO megui_grid_enhancement.

* BAdI 'MEGUI_GRID_ENHANCEMENT' to map new dynprofields

   TRY.

       GET BADI l_badi_grid.

       CALL BADI l_badi_grid->map_metafield

         EXPORTING

           iv_application = gf_application

         CHANGING

           ct_mapping     = ch_mapping.

     CATCH cx_badi_not_implemented .                         "#EC *

   ENDTRY.

ENDFORM.                    " badi_mapping

You should implement the method MAP_METAFIELD

Max

Read only

0 Likes
3,236

This one I already tried without any effect to the mapping.

Any Idea how to implement this and what kind of coding is needed.

I tried to use a copy of the sap implementation in MSR_MEGUI_GRID_ENHANCEMENT

I did something like this.

METHOD if_ex_megui_grid_enhancement~map_metafield.

   TYPE-POOLS mmmfd.

   DATA: ls_entry       TYPE mepo_s_metafield_mapping.

   ls_entry-application = iv_application.

   CLEAR ls_entry-modif.

   ls_entry-tabname     = 'MSR_MEPO_HEADER'.

   ls_entry-fieldname   = 'BSGRU'.

   ls_entry-metafield   = mmmfd_bsgru.

   INSERT ls_entry INTO TABLE ct_mapping.


Read only

0 Likes
3,236

How can you trigger the method read_from_catalog


Max

Read only

0 Likes
3,236

I activated the OCI Interface and connected a catalog to the system.

Read only

Former Member
0 Likes
3,237

Thanks max,

you showed me the right way. I checked the macro and the two tables  my_cat_mapping and  my_cat_fs.

I also remembered this discussion.

At the end I implemented an enhancement spot in:



FORM mereq3211grid CHANGING ch_mapping TYPE mepo_t_metafield_mapping.

....

map 'PROCESS' mmmfd_cust_05.

....

ENDFORM.


Now everything is working fine.


May be someone else helps this too.

Read only

0 Likes
3,236

Very good

Max