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

Convert structure into another thanks to data type

Former Member
0 Likes
1,446

Hi,

I used a function which return a structure of BAPI2045D_IL0 type. In the next function, I need the first structure but it must be of QALS_IMP type!

These structure haven't same field name but have the same data type!

How do this the move instruction??

The barbarian solution would be Move the first structure in second for each filed. But these structure have more that 100 fields!!

Thanks.

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
983

First look at the function modules of the BAPI Function Group, there may already exist a Function module that maps the data (Name should like MAP_BAPI_<struc>_2_<struc>)

If there is no one, you may generate it yourself, in SAP standard menu

/ Tools / Business Framework / BAPI Development / Generate Function Module to Map Fields, or enter the transaction code [BDBS|https://www.sdn.sap.com/irj/scn/advancedsearch?query=bdbs&cat=sdn_all]. (Look at [Converting Between Int. and Ext. Data Formats and Structures|http://help.sap.com/saphelp_nw04/helpdata/en/a5/3ec9594ac011d1894e0000e829fbbd/frameset.htm] in [BAPI Programming Guide Reference (CA-BFA)|http://help.sap.com/saphelp_nw04/helpdata/en/a5/3ec8074ac011d1894e0000e829fbbd/frameset.htm])

Regards

PS: There is a Map FM MAP2E_QALS_TO_BAPI2045D_IL0 which may help you if there are many not-automatically identified couples of internal/external fields.

Hi,

I used a function which return a structure of BAPI2045D_IL0 type. In the next function, I need the first structure but it must be of QALS_IMP type!

These structure haven't same field name but have the same data type!

How do this the move instruction??

The barbarian solution would be Move the first structure in second for each filed. But these structure have more that 100 fields!!

Thanks.

4 REPLIES 4
Read only

RaymondGiuseppi
Active Contributor
0 Likes
984

First look at the function modules of the BAPI Function Group, there may already exist a Function module that maps the data (Name should like MAP_BAPI_<struc>_2_<struc>)

If there is no one, you may generate it yourself, in SAP standard menu

/ Tools / Business Framework / BAPI Development / Generate Function Module to Map Fields, or enter the transaction code [BDBS|https://www.sdn.sap.com/irj/scn/advancedsearch?query=bdbs&cat=sdn_all]. (Look at [Converting Between Int. and Ext. Data Formats and Structures|http://help.sap.com/saphelp_nw04/helpdata/en/a5/3ec9594ac011d1894e0000e829fbbd/frameset.htm] in [BAPI Programming Guide Reference (CA-BFA)|http://help.sap.com/saphelp_nw04/helpdata/en/a5/3ec8074ac011d1894e0000e829fbbd/frameset.htm])

Regards

PS: There is a Map FM MAP2E_QALS_TO_BAPI2045D_IL0 which may help you if there are many not-automatically identified couples of internal/external fields.

Read only

Former Member
0 Likes
983

FORM select_where_tab_fill TABLES pt_where

USING ps_lot_general TYPE bapi2045d_il0

ps_requirements TYPE bapi2045d1.

DATA lv_where(40) TYPE c.

DATA lv_and(3) TYPE c.

  • Add selection critions for characteristic

IF ps_requirements-mstr_char IS NOT INITIAL.

CONCATENATE 'QAMV~VERWMERKM = ''' ps_requirements-mstr_char ''''

INTO lv_where.

CONCATENATE lv_and lv_where INTO lv_where SEPARATED BY space.

MOVE 'AND' TO lv_and.

APPEND lv_where TO pt_where.

ENDIF.

  • Add logistic selection critions

IF ps_lot_general-plant IS NOT INITIAL.

CONCATENATE 'QALS~WERK = ''' ps_lot_general-plant ''''

INTO lv_where.

CONCATENATE lv_and lv_where INTO lv_where SEPARATED BY space.

MOVE 'AND' TO lv_and.

APPEND lv_where TO pt_where.

ENDIF.

IF ps_lot_general-insplot_origin IS NOT INITIAL.

CONCATENATE 'QALS~HERKUNFT = ''' ps_lot_general-insplot_origin ''''

INTO lv_where.

CONCATENATE lv_and lv_where INTO lv_where SEPARATED BY space.

MOVE 'AND' TO lv_and.

APPEND lv_where TO pt_where.

ENDIF.

IF ps_lot_general-material IS NOT INITIAL.

CONCATENATE 'QALS~MATNR = ''' ps_lot_general-material ''''

INTO lv_where.

CONCATENATE lv_and lv_where INTO lv_where SEPARATED BY space.

MOVE 'AND' TO lv_and.

APPEND lv_where TO pt_where.

ENDIF.

IF ps_lot_general-vendor IS NOT INITIAL.

CONCATENATE 'QALS~LIFNR = ''' ps_lot_general-vendor ''''

INTO lv_where.

CONCATENATE lv_and lv_where INTO lv_where SEPARATED BY space.

MOVE 'AND' TO lv_and.

APPEND lv_where TO pt_where.

ENDIF.

IF ps_lot_general-manufacturer IS NOT INITIAL.

CONCATENATE 'QALS~HERSTELLER = ''' ps_lot_general-manufacturer ''''

INTO lv_where.

CONCATENATE lv_and lv_where INTO lv_where SEPARATED BY space.

MOVE 'AND' TO lv_and.

APPEND lv_where TO pt_where.

ENDIF.

ENDFORM.

Hope this will help u

Read only

Former Member
0 Likes
983

I give an example.

I have a structure (BAPI2045D_IL0) with field :


INSPLOT        TYPE   QPLOS
PLANT           TYPE   WERKS_D
INSP_TYPE    TYPE  QPART

I must do a move into an another structure (QALS_IMP)


PRUEFLOS    TYPE QPLOS
WERK           TYPE  WERKS_D

They haven't same name but have a same data type.

Nota bene : the structure contains lot of field...

Read only

0 Likes
983

As suggested by Raymond the mapping module should work for you. I tried generating one and it does it based on the field types.