2008 Dec 08 1:56 PM
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.
2008 Dec 08 2:07 PM
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.
2008 Dec 08 2:07 PM
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.
2008 Dec 08 2:08 PM
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
2008 Dec 08 2:11 PM
I give an example.
I have a structure (BAPI2045D_IL0) with field :
INSPLOT TYPE QPLOS
PLANT TYPE WERKS_D
INSP_TYPE TYPE QPARTI must do a move into an another structure (QALS_IMP)
PRUEFLOS TYPE QPLOS
WERK TYPE WERKS_DThey haven't same name but have a same data type.
Nota bene : the structure contains lot of field...
2008 Dec 08 2:41 PM
As suggested by Raymond the mapping module should work for you. I tried generating one and it does it based on the field types.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |