0 Replies Latest reply: May 31, 2007 12:23 PM by Anurag Singh Rathore RSS

How to update the header and line items of biling document using IDOC?

Anurag Singh Rathore
Currently Being Moderated

Step 1: First find out the function module to be used for IDOC and in that find out the user exit.

 

For an example in this case the name of the FM is <b>'EXI_SAPLVEDF_002</b>' and the name of the user exit is '<b>ZXEDFU02</b>'.

 

Step 2: In the user exit find out the segment in internal table as int_edidd.

    As in this case the segment which i have to update is '<b>E1EDP04</b>'.

Now ther can be two cases: One we want to insert a new Z segment and second, we want to insert a segment same as existing one.

 

Now if we have to insert a new segment then we have to follow the below procedure:

 

IF int_edidd-segnam = 'E1EDKA1'.

  DESCRIBE TABLE int_edidd LINES zlastrec.

  READ TABLE int_edidd INDEX zlastrec.

  MOVE int_edidd-sdata TO e1edka1.

 

  IF e1edka1-parvw = 'RG'.

    code....

    code....

    code.....

    IF sy-subrc = 0.

      code....

    code....

    code......

 

      MOVE field1 TO ze1edka1-sbgrp.

      MOVE field2 TO ze1edka1-stext.

      CLEAR int_edidd.

      MOVE 'ZE1EDKA1' TO  int_edidd-segnam .

      MOVE ze1edka1 TO  int_edidd-sdata.

      APPEND int_edidd.

    ENDIF.

  ENDIF.

 

See in my example i have to insert a new Zsegmnet as ZE1EDKA1.So first i check for segment E1EDKA1(as after that i have to insert my Zsegment).Then move SDATA(a field of int_edidd to segment, a structure). Do your coding,pass the new segment name to int_edidd-segname and updated fields to sdata of int_edidd and append it.

 

Secondly when we have to insert a new segment same as existing one.

Same process as above stated.

 

Now if we have to update line items then we have to follow the following process:

 

IF int_edidd-segnam = last segment of line items(same for all line items)

 

  IF NOT wf_check IS INITIAL.

    EXIT.

  ENDIF.

 

  CLEAR count.

  LOOP AT int_edidd WHERE segnam = 'E1EDP04'.

    CLEAR e1edp04.

    wf_tabix = sy-tabix.

    e1edp04 = int_edidd-sdata.

    IF e1edp04-ktext = 'LocalTaxes'.

      CONTINUE.

    ENDIF.

    count = count + 1.

    code.

      CLEAR: int_edidd,

             count.

  •             e1edp04.

      int_edidd-segnam = 'E1EDP04'.

 

      move fields to structure......

 

      MOVE e1edp04 TO int_edidd-sdata.

      wf_tabix = wf_tabix + 1.

      INSERT int_edidd INDEX wf_tabix.

      CLEAR : wf_kbetr, wf_kwert.

    ENDIF.

  ENDLOOP.

  wf_check = 'X'.

ENDIF.

 

Step 4: Go to se38 with program name as '<b>RSNAST00</b>' and execute it with the values of O/P application , object key, o/p type, tranmission medium.

 

Step 4: The above program creat an IDOC.To see that IDOC go to transaction WE02 and give the IDOC number created with the above mentioned program.Execute it with that IDOC number and deleting the date both for high and low value.

Now you have the structure of IDOC infront of you with three blocks Control re. Data records and Status records.

Now click on Data records and go to your new insert or updated segments and check their values.

 

So this is the process o update the billing document's header and line items values using IDOC.

 

Please give me your valueable suggestion on this sot that it can be more helpful material for all and to me.

 

Best of luck.

Actions