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

updating Custom Fields

Former Member
0 Likes
1,058

Hi friends i am trying to update the custom fields in EKKO table using BAPI_PO_CHANGE , But it is not updating the data , it is removing the exiting data but not updating

i my table having ZZSHIPV field at present it contains 00 i want to update that value into 10 using BAPI_PO_CHANGE but is is removing the 00 but it is not updating 10 instead of 00 plz help me friend how to update those custom fields

Hi friends i am trying to update the custom fields in EKKO table using BAPI_PO_CHANGE , But it is not updating the data , it is removing the exiting data but not updating

i my table having ZZSHIPV field at present it contains 00 i want to update that value into 10 using BAPI_PO_CHANGE but is is removing the 00 but it is not updating 10 instead of 00 plz help me friend how to update those custom fields

2 REPLIES 2
Read only

jitendra_it
Active Contributor
0 Likes
679

have u checked thread http://scn.sap.com/thread/1867840  .

Read only

0 Likes
679

hi,

just now i referred above document i followed all the rules first i added my custom fields to BAPI_TE_MEPOHEADER , BAPI_TE_MEPOHEADERX structures and i passed my vales to EXTENSION parameter still is is not working here i am pasting my code ple go throw once if there is any errors tell me

  REPORT  Z_PURCHASE_ORDER_HEADER_M006H

        NO STANDARD PAGE HEADING LINE-SIZE 255.

*//Types declaration

TYPES : BEGIN OF ty_header,

         po_number       LIKE bapimepoheader-po_number,

         hdrtxt1(132)    TYPE c,

         hdrtxt2(132)    TYPE c,

         hdrtxt3(132)    TYPE c,

         hdrtxt4(132)    TYPE c,

         hdrtxt5(132)    TYPE c,

         hdrtxt6(132)    TYPE c,

         hdrtxt7(132)    TYPE c,

         hdrtxt8(132)    TYPE c,

         hdrtxt9(132)    TYPE c,

         hdrtxt10(132)   TYPE c,

         hdrtxt11(132)   TYPE c,

         hdrtxt12(132)   TYPE c,

         hdrtxt13(132)   TYPE c,

         parvw           LIKE bapiekkop-partnerdesc,

         gparn           LIKE bapiekkop-buspartno,

         zzshipv        TYPE zde_shpv,

         zzshpv2t        TYPE  zde_ship_via_2,

         END OF ty_header.

*//

types : begin of ty_ekpo,

         ebeln type ekpo-ebeln,

         ebelp type ekpo-ebeln,

         end of ty_ekpo.

*//Work area and internal table declaration

data : wa_ekpo type ty_ekpo,

        lt_ekpo type table of ty_ekpo.

*//Work area declaration

DATA : wa_header TYPE ty_header,

        lt_header TYPE TABLE OF ty_header.

*//Varible declaration

DATA : lv_path TYPE string.

DATA : BEGIN OF wa_text.

         INCLUDE STRUCTURE bapimepotextheader.

DATA : END OF wa_text.

DATA : lt_text LIKE TABLE OF wa_text.

DATA : BEGIN OF wa_text1.

         INCLUDE STRUCTURE bapimepotext.

DATA : END OF wa_text1.

DATA : lt_text1 LIKE TABLE OF wa_text1.

   DATA: header LIKE bapimepoheader, " Header

header_ind LIKE bapimepoheaderx, " Header index

patener    LIKE bapiekkop OCCURS 0   WITH HEADER LINE,

wa_custom  TYPE bapiparex ,

lt_custom  TYPE TABLE OF bapiparex ,

s_bapi_te_mepoheader TYPE  bapi_te_mepoheader ,

s_bapi_te_mepoheaderx TYPE bapi_te_mepoheaderx.

DATA : T_BAPI_TE_MEPOHEADER TYPE BAPI_TE_MEPOHEADER.

DATA : T_BAPI_TE_MEPOHEADERX TYPE BAPI_TE_MEPOHEADERX.

   DATA : wa_return LIKE bapiret2,

          lt_return LIKE TABLE OF bapiret2,

          lt_return1 LIKE TABLE OF bapiret2.

*//Selection screen design

PARAMETERS: p_file LIKE rlgrap-filename.

*            e_file LIKE rlgrap-filename.

*//

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

   CALL FUNCTION 'F4_FILENAME'

     EXPORTING

       program_name  = syst-cprog

       dynpro_number = syst-dynnr

     IMPORTING

       file_name     = p_file.

start-of-selection.

   lv_path = p_file.

*//Uploading the data into internal table

   CALL FUNCTION 'GUI_UPLOAD'

     EXPORTING

       filename            = lv_path

       filetype            = 'ASC'

       has_field_separator = '|'

     TABLES

       data_tab            = lt_header.

   LOOP AT lt_header INTO wa_header.

     CLEAR : header-po_number, header_ind-po_number.

     REFRESH : patener, lt_custom,lt_text,lt_text1.

     header-po_number   = wa_header-po_number.

     header_ind-po_number = 'X'.

     wa_text-po_number      = wa_header-po_number.

     wa_text-text_id        = 'F01'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_header-hdrtxt1.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_header-po_number.

     wa_text-text_id        = 'F02'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_header-hdrtxt2.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_header-po_number.

     wa_text-text_id        = 'F03'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_header-hdrtxt3.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_header-po_number.

     wa_text-text_id        = 'F04'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_header-hdrtxt4.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_header-po_number.

     wa_text-text_id        = 'F05'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_header-hdrtxt5.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_header-po_number.

     wa_text-text_id        = 'F06'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_header-hdrtxt6.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_header-po_number.

     wa_text-text_id        = 'F07'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_header-hdrtxt7.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_header-po_number.

     wa_text-text_id        = 'F08'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_header-hdrtxt8.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_header-po_number.

     wa_text-text_id        = 'F09'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_header-hdrtxt9.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_header-po_number.

     wa_text-text_id        = 'F10'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_header-hdrtxt10.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_header-po_number.

     wa_text-text_id        = 'F11'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_header-hdrtxt11.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_header-po_number.

     wa_text-text_id        = 'F12'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_header-hdrtxt12.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     wa_text-po_number      = wa_header-po_number.

     wa_text-text_id        = 'F13'.

     wa_text-text_form        = '*'.

     wa_text-text_line         = wa_header-hdrtxt13.

     APPEND wa_text TO lt_text.

     CLEAR wa_text.

     patener-partnerdesc     = wa_header-parvw.

     patener-langu           = sy-langu.

     patener-buspartno       = wa_header-gparn.

     APPEND patener.

     s_bapi_te_mepoheader-po_number = wa_header-po_number.

     s_bapi_te_mepoheader-zzshipv   = wa_header-zzshipv.

  

     s_bapi_te_mepoheaderx-po_number = wa_header-po_number.

     s_bapi_te_mepoheaderx-zzshipv   = 'X'.

     wa_custom-structure  =  'BAPI_TE_MEPOHEADER'.

      CALL METHOD cl_abap_container_utilities=>fill_container_c

       EXPORTING

         im_value               = S_BAPI_TE_MEPOHEADER

       IMPORTING

         ex_container           = wa_custom-valuepart1

*  EXCEPTIONS

*    illegal_parameter_type = 1

*    others                 = 2

             .

     IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

     ENDIF.

     APPEND wa_custom TO lt_custom.

     wa_custom-structure  =  'BAPI_TE_MEPOHEADERX'.

     wa_custom-valuepart1 = S_BAPI_TE_MEPOHEADERX.

     APPEND wa_custom TO lt_custom.

   *//

     select single ebeln ebelp

             from ekpo

             into wa_ekpo

             where ebeln eq wa_header-po_number.

     wa_text1-po_number      = wa_header-po_number.

     wa_text1-po_item        = wa_ekpo-ebelp.

     wa_text1-text_id        = 'F06'.

     wa_text1-text_form        = '*'.

     wa_text1-text_line         = wa_header-zzshpv2t .

     APPEND wa_text1 TO lt_text1.

     CLEAR wa_text1.

*//Call BAPI_PO_CHANGE

     CALL FUNCTION 'BAPI_PO_CHANGE'

       EXPORTING

         purchaseorder                = header-po_number

         poheader                     = header

         poheaderx                    = header_ind

       TABLES

         return                       = lt_return

      extensionin                  = lt_custom

*   EXTENSIONOUT                 =

*   POEXPIMPITEM                 =

*   POEXPIMPITEMX                =

     potextheader                 = lt_text

     potextitem                   = lt_text1

     popartner                    = patener.

               .

     IF sy-subrc EQ 0.

       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

         EXPORTING

           wait = 'X'.

     ENDIF.

     IF  lt_return IS INITIAL.

       LOOP AT lt_return INTO wa_return.

         APPEND wa_return TO lt_return1.

*

         WRITE:/ wa_return-message.

         CLEAR wa_return.

       ENDLOOP.

       REFRESH lt_return.

     ENDIF.

   ENDLOOP.

   DATA : lv_message TYPE string.

   IF lt_return1 IS NOT INITIAL.

     LOOP AT lt_return1  INTO  wa_return.

       CALL FUNCTION 'FORMAT_MESSAGE'

         EXPORTING

           id   = wa_return-id

           lang = sy-langu

           no   = wa_return-number

           v1   = wa_return-message_v1

           v2   = wa_return-message_v1

           v3   = wa_return-message_v1

           v4   = wa_return-message_v1

         IMPORTING

           msg  = lv_message.

*Display Error Messages.

       WRITE : / lv_message.

     ENDLOOP.

   ELSE.

     MESSAGE : 'SUCCESS' TYPE 'S'.

   ENDIF.