Application Development 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: 

REASON FOR CANCELATION OF DOCUMENT THROUGH VF11

ranjeetabap
Explorer
0 Kudos

Hi,

Scenerio - When user will cancel document through vf11, on click of save button there should popup come where user have to put up reason of cancelation.Input reason should save in vbrk table.That could be viewable in respect to generating cancel document no.

Solution:

For this i have added zreason feild in vbrk table, i used FM popup_get_values for populating vbrk-zreason feild. But when i am entering reason, that is not save in vbrk-zreason feild. I am using save_text fm also for saving the reason. But not success.

Please help me with complete code.

Regards

Ranjeet

10 REPLIES 10

Former Member
0 Kudos

Provide the enhancement name used. check the VBRK export/changing parameters are filled properly?

0 Kudos

Hi,

I am implementing following code in fm : RV_INVOICE_DOCUMENT_ADD

DATA: V_BNAME TYPE VBRK-ZREASON.


  
data: ITAB LIKE SVAL OCCURS 0 WITH HEADER LINE.
DATA: RC TYPE C.

if sy-tcode = 'VF11' AND SY-UCOMM = 'SICH' .

  CALL FUNCTION 'POPUP_GET_VALUES'
    EXPORTING
*     NO_VALUE_CHECK        = ' '
      POPUP_TITLE           = 'REASON OF REJECTION'
*     START_COLUMN          = '5'
*     START_ROW             = '5'
*   IMPORTING
*     RETURNCODE            =
    TABLES
      FIELDS                = ITAB.
*   EXCEPTIONS
*     ERROR_IN_FIELDS       = 1
*     OTHERS                = 2
            .
  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.
ENDIF.
*            .
*
IF RC NE 'A'.

    READ TABLE ITAB INDEX 1.    "BNAME
  V_BNAME = ITAB-VALUE.

  DATA: IT_TLINES  LIKE TLINE OCCURS  0 WITH HEADER LINE.
*
**Lets assume you have the text to be saved in the internal table IT_TEXT.
*
*
*
data : x_header TYPE thead.
*to populate the data into SAVE_TEXT,you should know the values for the below fields.
x_header-tdobject      'VBBK'.
  x_header-tdname        = VBRK-ZREASON.
  x_header-tdid          = '0001'.
  x_header-tdspras       = sy-langu.


LOOP AT ITAB. .
    IT_TLINES-TDFORMAT = '*'.
    IT_TLINES-TDLINE V_BNAME.
    APPEND IT_TLINES.
    CLEAR  IT_TLINES.
  ENDLOOP.

*  MODIFY vbrk  vbrk.
CALL FUNCTION 'SAVE_TEXT'
  EXPORTING
*   CLIENT                = SY-MANDT
    HEADER                = X_HEADER
*   INSERT                = ' '
   SAVEMODE_DIRECT       = 'X'
*   OWNER_SPECIFIED       = ' '
*   LOCAL_CAT             = ' '
* IMPORTING
*   FUNCTION              =
*   NEWHEADER             =
  TABLES
    LINES                 = IT_TLINES.
* EXCEPTIONS
*   ID                    = 1
*   LANGUAGE              = 2
*   NAME                  = 3
*   OBJECT                = 4
*   OTHERS                = 5
*          .
IF SY-SUBRC <> 0.
   WRITE: / 'Successful'.

      COMMIT WORK.


* Implement suitable error handling here
ENDIF.

0 Kudos

The SAVE_TEXT function module won't save your text in VBRK table.

Check in your user exit if there are any changing/export parameters for VBRK table type and pass the text to that structure.

0 Kudos

Actually it is functyion module. I am doing enhancement in  RV_INVOICE_DOCUMENT_ADD

function Module . Please follow following link,My requirement is same as mention in link:

http://www.architectsap.com/blog/sap-ecc/how-to-enhance-transaction-in-vf11/

0 Kudos

As per that document, u need not append VBRK table.

The text will be stored in STXH table. Take help of your functional in creating the text id.

0 Kudos

Not getting clearly, Can you elaborate in detail, for my issue what would be perfect solution. if possible can you send detail code.

ranjeetabap
Explorer
0 Kudos

Hi All,

I have to do same work as per mention in link. Please help me if any have compete code for my issue.

Regards

Ranjeet

ranjeetabap
Explorer
0 Kudos

Hi All,

I have to do same work as per mention in link. Please help me if any have compete code for my issue.

http://www.architectsap.com/blog/sap-ecc/how-to-enhance-transaction-in-vf11/

Regards

Ranjeet

0 Kudos

Hi Ranjeet,

As far as I understood, U need to proceed as follows:

1. Ask your SD Functional consultant to create a Header Text for "Reason for Rejection"  to appear in VF02.

2. Get the TDOBJECT,TDNAME,TDID,TDSPRAS from functional and fill the THEAD structure of your "SAVE_TEXT" function module in enhancement. (u have already coded it, just pass the correct values)

3. The text you save in your enhancement point will be shown automatically in VF02 (via Text determination procedure done by functional)

0 Kudos

Hi,

Thanks for suggestion. It's working.

Regards

Ranjeet