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

BAPI save import paramters state

hady_ibrahim
Participant
0 Likes
1,007

Hi ABAPers ,

this is the first contribution in the SAP community network.

when i execute my z BAPI for specific import parameters it commit to database correctly , but  when i press  F3  and change import parameters ,BAPI commit to database correctly but with old not new import parameters .

could you help me?

note :This  BAPI has a BDC recording of IW31 TCODE and it is RFC Enabled.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

arivazhagan_sivasamy
Active Contributor
0 Likes
953

Hi Hady,

Please put break-point, before updating database table update coding.

And also clear the structure and refresh internal table value once update the BAPI.

Arivazhagan S

5 REPLIES 5
Read only

arivazhagan_sivasamy
Active Contributor
0 Likes
954

Hi Hady,

Please put break-point, before updating database table update coding.

And also clear the structure and refresh internal table value once update the BAPI.

Arivazhagan S

Read only

0 Likes
953

BAPI CODE IS :

FUNCTION ZBAPI_AC_SO. *"---------------------------------------------------------------------- *"*"Local Interface: *"  IMPORTING *"    VALUE(WC) TYPE  AUFK-VAPLZ OPTIONAL *"    VALUE(CUST_NUM) TYPE  KUNNR OPTIONAL *"    VALUE(EQ) TYPE  EQUNR OPTIONAL *"    VALUE(NAME) TYPE  AD_NAME1 OPTIONAL *"    VALUE(SEARCH) TYPE  AD_SORT1UL OPTIONAL *"    VALUE(REGION) TYPE  REGIO OPTIONAL *"  EXPORTING *"    VALUE(OR) TYPE  AUFNR *"  TABLES *"      LT_MSG STRUCTURE  BDCMSGCOLL OPTIONAL *"----------------------------------------------------------------------   DATA: G_MODE VALUE 'N'.   DATA : DESC TYPE C LENGTH 40 VALUE ''. *DATA : ACC_NUM TYPE C VALUE '6' LENGTH 10.   DATA : ACC_NUM TYPE C VALUE '1800000001' LENGTH 10.   DATA : DT TYPE C LENGTH 10.   Concatenate sy-datum+6(2) '.' sy-datum+4(2) '.' sy-datum+0(4) into DT.   dATA:SERNR TYPE EQUI-SERNR VALUE '',     MATNR TYPE EQUI-MATNR VALUE '',     MAKTX TYPE MAKT-MAKTX VALUE ''.   SELECT SINGLE MATNR SERNR FROM EQUI INTO  (MATNR , SERNR)    WHERE EQUNR = EQ.   SELECT SINGLE MAKTX FROM MAKT INTO MAKTX  WHERE MATNR  = MATNR. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'   EXPORTING     INPUT        = SERNR IMPORTING   OUTPUT        = SERNR.   CONCATENATE    'serial' SERNR MAKTX  'model'  INTO  DESC  .   perform bdc_dynpro      using 'SAPLCOIH' '0100'.   perform bdc_field      using 'BDC_CURSOR'                                 'CAUFVD-IWERK'.   perform bdc_field      using 'BDC_OKCODE'                                 '/00'.   perform bdc_field      using 'AUFPAR-PM_AUFART'                                 'SM02'.   perform bdc_field      using 'CAUFVD-IWERK'                                 'AN00'.   perform bdc_dynpro      using 'SAPLCOIH' '3000'.   perform bdc_field      using 'BDC_OKCODE'                                 '/00'.   perform bdc_field      using 'BDC_CURSOR'                                 'CAUFVD-VAWRK'.   perform bdc_field      using 'CAUFVD-VAPLZ'                                 WC.   perform bdc_field      using 'CAUFVD-VAWRK'                                   'AN00'. *perform bdc_field      using 'CAUFVD-ILART' *                              record-ILART_005.   perform bdc_field      using 'CAUFVD-GSTRP'                                 DT.   perform bdc_field      using 'CAUFVD-GLTRP'                                 DT.   perform bdc_field      using 'CAUFVD-EQUNR'                                 EQ. *perform bdc_field      using 'AFVGD-INDET' *                              record-INDET_009.   perform bdc_field      using 'AFVGD-WERKS'                                 'an00'. *perform bdc_field      using 'AFVGD-STEUS' *                              record-STEUS_011. *perform bdc_field      using 'AFVGD-ARBEH' *                              record-ARBEH_012. *perform bdc_field      using 'AFVGD-DAUNE' *                              record-DAUNE_013.   perform bdc_dynpro      using 'SAPLCOIH' '3000'.   perform bdc_field      using 'BDC_OKCODE'                                 '/00'.   perform bdc_field      using 'BDC_CURSOR'                                 'VIQMEL-KUNUM'.   perform bdc_field      using 'VIQMEL-KUNUM'                                 ACC_NUM.   perform bdc_dynpro      using 'SAPLSZA1' '0201'.   perform bdc_field      using 'BDC_CURSOR'                                 'SZA1_D0100-TITLE_MEDI'.   perform bdc_field      using 'BDC_OKCODE'                                 '=CONT'.   perform bdc_field      using 'SZA1_D0100-TITLE_MEDI'                                 'MR.'.   perform bdc_field      using 'ADDR1_DATA-NAME1'                                 name.   perform bdc_field      using 'ADDR1_DATA-SORT1'                                 search.   perform bdc_field      using 'ADDR1_DATA-CITY1'                                 'CAIRO'.   perform bdc_field      using 'ADDR1_DATA-COUNTRY'                                 'EG'.   perform bdc_field      using 'ADDR1_DATA-REGION'                                 REGION.   perform bdc_field      using 'ADDR1_DATA-TIME_ZONE'                                 'EGYPT'.   perform bdc_field      using 'ADDR1_DATA-LANGU'                                 'AR'.   perform bdc_dynpro      using 'SAPLCOIH' '3000'. *perform bdc_field      using 'CAUFVD-INGPR' *                              record-INGPR_023.   perform bdc_field      using 'CAUFVD-VAPLZ'                                 WC.   perform bdc_field      using 'CAUFVD-VAWRK'                                   'AN00'. *perform bdc_field      using 'CAUFVD-ILART' *                              record-ILART_026.   perform bdc_field      using 'CAUFVD-GSTRP'                                 DT.   perform bdc_field      using 'CAUFVD-GLTRP'                                 DT. *perform bdc_field      using 'CAUFVD-TPLNR' *                              record-TPLNR_029.   perform bdc_field      using 'CAUFVD-EQUNR'                                 EQ. *perform bdc_field      using 'AFVGD-INDET' *                              record-INDET_031.   perform bdc_field      using 'AFVGD-ARBPL'                                 WC.   perform bdc_field      using 'AFVGD-WERKS'                                 'an00'. *perform bdc_field      using 'AFVGD-STEUS' *                              record-STEUS_034. *perform bdc_field      using 'AFVGD-LARNT' *                              record-LARNT_035. *perform bdc_field      using 'AFVGD-ARBEH' *                              record-ARBEH_036. *perform bdc_field      using 'AFVGD-DAUNE' *                              record-DAUNE_037. *perform bdc_field      using 'CAUFVD-BEMOT' *                              record-BEMOT_038.   perform bdc_dynpro      using 'SAPLCOIH' '3000'.   perform bdc_field      using 'BDC_OKCODE'                                 '=FREI'. *********perform bdc_field      using 'BDC_CURSOR' *********                              'VIQMEL-KUNUM'. *********perform bdc_field      using 'VIQMEL-KUNUM' *********                              ACC_NUM. ********* *perform bdc_field      using 'CAUFVD-INGPR' *                              record-INGPR_040.   perform bdc_field      using 'CAUFVD-VAPLZ'                                 WC.   perform bdc_field      using 'CAUFVD-VAWRK'                                   'AN00'. *perform bdc_field      using 'CAUFVD-ILART' *                              record-ILART_043.   perform bdc_field      using 'CAUFVD-GSTRP'                                 DT.   perform bdc_field      using 'CAUFVD-GLTRP'                                 DT. *perform bdc_field      using 'CAUFVD-TPLNR' *                              record-TPLNR_046.   perform bdc_field      using 'CAUFVD-EQUNR'                                 EQ. *perform bdc_field      using 'AFVGD-INDET' *                              record-INDET_048.   perform bdc_field      using 'AFVGD-ARBPL'                                 WC.   perform bdc_field      using 'AFVGD-WERKS'                                 'an00'. *perform bdc_field      using 'AFVGD-STEUS' *                              record-STEUS_051. **perform bdc_field      using 'AFVGD-LARNT' *                              record-LARNT_052. *perform bdc_field      using 'AFVGD-ARBEH' *                              record-ARBEH_053. *perform bdc_field      using 'AFVGD-DAUNE' *                              record-DAUNE_054. *perform bdc_field      using 'CAUFVD-BEMOT' *                              record-BEMOT_055.   perform bdc_dynpro      using 'SAPLCOIH' '3000'.   perform bdc_field      using 'BDC_OKCODE'                                 '=BU'. *perform bdc_field      using 'CAUFVD-INGPR' *                              record-INGPR_057.   perform bdc_field      using 'CAUFVD-VAPLZ'                                 WC.   perform bdc_field      using 'CAUFVD-VAWRK'                                   'AN00'. *perform bdc_field      using 'CAUFVD-ILART' *                              record-ILART_060.   perform bdc_field      using 'CAUFVD-GSTRP'                                 DT.   perform bdc_field      using 'CAUFVD-GLTRP'                                 DT. *perform bdc_field      using 'CAUFVD-TPLNR' *                              record-TPLNR_063.   perform bdc_field      using 'CAUFVD-EQUNR'                                 EQ. *perform bdc_field      using 'AFVGD-INDET' *                              record-INDET_065.   perform bdc_field      using 'AFVGD-ARBPL'                                 WC.   perform bdc_field      using 'AFVGD-WERKS'                                 'an00'. perform bdc_field      using 'BDC_OKCODE'                                 '=BU'.   perform bdc_field      using 'CAUFVD-KTEXT'                                 DESC.   CALL TRANSACTION 'IW31' USING GT_BDC                           MODE  G_MODE                           MESSAGES INTO LT_MSG.   commit work and wait. eq = ''. DESC = ''. NAME = ''. SEARCH = ''. REGION = ''. ENDFUNCTION.

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

at the end of bapi i reset values of my paramters

eq = ''.

DESC = ''.

NAME = ''.

SEARCH = ''.

REGION = ''.

but bapi  doesnt affected by new values.

any suggestions?

Read only

0 Likes
953

Hi,

the code is not readable! please import the source in correct format and attach!

Read only

0 Likes
953

Hi,

Refresh internal table GT_BDC after call transaction and check.

Regards,

Munesh

Read only

0 Likes
953

I beliwvw ypu have bdc data GT_BDC as global internal table. Just at the beginning write a refresh statement