‎2011 Sep 22 11:28 AM
Hi Gurus,
In BAPI import paramters we have change structures. E.g. in BAPI_FIXEDASSET_CREATE we have import parameter GENERALDATAX as change structure for the import parameter GENERALDATA.
Is there a functional module or something which can automatically populate the change structure? e.g. a function module to populate GENERALDATAX based on data in GENERALDATA.
Please let me know. Thanks in advance.
‎2011 Sep 22 11:45 AM
Hi,
Create this subroutine in your program:
*&---------------------------------------------------------------------*
*& Form set_x_flags
*&---------------------------------------------------------------------*
FORM set_x_flags USING is_data TYPE any
CHANGING cs_datax TYPE any.
FIELD-SYMBOLS: <l_field> TYPE ANY,
<l_fieldx> TYPE ANY.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE is_data TO <l_field>.
IF sy-subrc NE 0.
EXIT.
ENDIF.
ASSIGN COMPONENT sy-index OF STRUCTURE cs_datax TO <l_fieldx>.
IF sy-subrc NE 0.
EXIT.
ENDIF.
IF <l_field> IS NOT INITIAL.
<l_fieldx> = 'X'.
ENDIF.
ENDDO.
ENDFORM. "set_x_flags
And you can use it this way:
DATA: ls_generaldata TYPE bapi1022_feglg001,
ls_generaldatax TYPE bapi1022_feglg001x,
ls_inventory TYPE bapi1022_feglg011,
ls_inventoryx TYPE bapi1022_feglg011x.
* Populate LS_GENERAL_DATA and LS_INvENTORY manually
*... then populate flags
PERFORM set_x_flags: USING ls_generaldata CHANGING ls_generaldatax,
USING ls_inventory CHANGING ls_inventoryx.
‎2011 Sep 22 11:45 AM
Hi,
Create this subroutine in your program:
*&---------------------------------------------------------------------*
*& Form set_x_flags
*&---------------------------------------------------------------------*
FORM set_x_flags USING is_data TYPE any
CHANGING cs_datax TYPE any.
FIELD-SYMBOLS: <l_field> TYPE ANY,
<l_fieldx> TYPE ANY.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE is_data TO <l_field>.
IF sy-subrc NE 0.
EXIT.
ENDIF.
ASSIGN COMPONENT sy-index OF STRUCTURE cs_datax TO <l_fieldx>.
IF sy-subrc NE 0.
EXIT.
ENDIF.
IF <l_field> IS NOT INITIAL.
<l_fieldx> = 'X'.
ENDIF.
ENDDO.
ENDFORM. "set_x_flags
And you can use it this way:
DATA: ls_generaldata TYPE bapi1022_feglg001,
ls_generaldatax TYPE bapi1022_feglg001x,
ls_inventory TYPE bapi1022_feglg011,
ls_inventoryx TYPE bapi1022_feglg011x.
* Populate LS_GENERAL_DATA and LS_INvENTORY manually
*... then populate flags
PERFORM set_x_flags: USING ls_generaldata CHANGING ls_generaldatax,
USING ls_inventory CHANGING ls_inventoryx.
‎2011 Sep 22 2:42 PM
The answer, as far as I know is: No, there's nothing that can automatically populate the "X"s in your badi X structure.
You'll have to use custom code as suggested above.
BR