Skip to Content

Purpose

CJIC (Display Project Settlement Line Item) is used to create line item settlement rules. In this transaction, user is able to create settlement rule per line item or by selecting all line item and create one settlement rule for all.

Now, we got requirement to Automate this process where user will give Excel file with data and settlement Rule will be created accordingly.

Information

For this requirement, we have created BDC recording as follows:

Transaction Code- SHDB

Capture1.JPG

Click Start Recording

Capture2.JPG

Enter WBS Element as per above screen

and Execute

Capture3.JPG

Select Line item

Capture4.JPG

click Final Settlement and enter details as below

Capture5.JPG

click back

Capture6.JPG

line item will be displayed as Green and then Save

Now check below BDC recording output. this needs to be used by ABAP Consultant.

0000 T CJIC                                                                                                                            
RKPEP012                             1000 X
0000 BDC_CURSOR                                                                                                                       CN_PSPNR-LOW
0000 BDC_OKCODE                                                                                                                       =ONLI
0000 CN_PSPNR-LOW                                                                                                                     N-00002.001
0000 P_AFABE                                                                                                                         1
0000 P_DISVAR                                                                                                                         /RITESH-1
0000 BDC_SUBSCR                                                                                                                       SAPLSSEL                                2001%_SUBSCREEN_%_SUB%_CONTAINER
0000 BDC_SUBSCR                                                                                                                       SAPLSSEL                                2002SUBSCREEN_CONTAINER2
SAPMSSY0                             0120 X
0000 BDC_CURSOR                                                                                                                       04/03
0000 BDC_OKCODE                                                                                                                       =BURG
SAPLKOBS                             0130 X
0000 BDC_CURSOR                                                                                                                       COBRB-PROZS(01)
0000 BDC_OKCODE                                                                                                                       /00
0000 COBRB-KONTY(01)                                                                                                                 FXA
0000 DKOBR-EMPGE(01)                                                                                                                 42000000
0000 COBRB-PROZS(01)                                                                                                                 100
0000 BDC_SUBSCR                                                                                                                       SAPLKOBS                                0205BLOCK1
SAPLKOBS                             0130 X
0000 BDC_CURSOR                                                                                                                       COBRB-KONTY(01)
0000 BDC_OKCODE                                                                                                                       =BACK
0000 BDC_SUBSCR                                                                                                                       SAPLKOBS                                0205BLOCK1
SAPMSSY0                             0120 X
0000 BDC_CURSOR                                                                                                                       04/03
0000 BDC_OKCODE                                                                                                                       =BSAV

Now ABAP Consultant will work and complete the program.

Please check below program to updated by ABAP Person (Courtesy: Mr. Sadruz Ansari):

REPORT ZPS_CJIC_SETTLEMENT_RULE. ”       no standard page heading line-size 255.

*HANDLING TABLE CONTROL IN BDC

DATA : BEGIN OF IT_DUMMY OCCURS 0,

         DUMMY(100) TYPE C,

       END OF IT_DUMMY.

TYPES : BEGIN OF IT_CJIC ,

          PSPNR TYPE PRPS_R-POSID,    ” WBS Number

          KONTY TYPE TBO01-OBART_LD,  “Account assignment category

          EMPGE TYPE DKOBR-EMPGE,     “Fixed Assets Number

          REFBN TYPE KAEP_COAC-REFBN, “Reference Document Number

          MATNR TYPE KAEP_COEP_X-MATNR,  ” material No.

          REFBZ TYPE KAEP_COAC-REFBZ,  ” Posting Row

        END OF IT_CJIC.

DATA : IT_BDCDATA     LIKE BDCDATA OCCURS 0 WITH HEADER LINE,

       IT_BDCMSGCOLL  LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE,

       WIT_BDCMSGCOLL TYPE BDCMSGCOLL.

TYPES:

   FS_STRUCT(4096) TYPE C OCCURS 0 .

DATA:

  W_STRUCT TYPE FS_STRUCT.

DATA:

  T_FIELD    TYPE STANDARD TABLE OF IT_CJIC,

  E_FIELD    TYPE STANDARD TABLE OF IT_CJIC,

  S_FIELD    TYPE STANDARD TABLE OF IT_CJIC,

  EXPORT_FLD TYPE STANDARD TABLE OF IT_CJIC,

  TR_FIELD   TYPE STANDARD TABLE OF IT_CJIC,

  T_BDCDATA  LIKE TABLE OF BDCDATA,

  T_LFBK     TYPE STANDARD TABLE OF LFBK,

  W_FIELD    TYPE IT_CJIC,

  W_LFBK     TYPE LFBK.

TYPES : BEGIN OF TY_CJIC ,

          BANKS     TYPE LFBK-BANKS,

          LIFNR(10) TYPE C,  

          BANKL     TYPE LFBK-BANKL,

          BANKN     TYPE LFBK-BANKN,

          KOINH     TYPE LFBK-KOINH,

          BKONT     TYPE LFBK-BKONT,

          BVTYP     TYPE LFBK-BVTYP,

          BKREF     TYPE LFBK-BKREF,

        END OF TY_CJIC.

DATA: IT_XK02 TYPE STANDARD TABLE OF TY_CJIC,

      IT_SUCC TYPE STANDARD TABLE OF TY_CJIC,

      WA_XK02 TYPE TY_CJIC.

PARAMETERS:

  P_FILE   TYPE RLGRAP-FILENAME.                  ” File Path

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

  CALL FUNCTION ‘F4_FILENAME’

    EXPORTING

      PROGRAM_NAME  = SYST-CPROG

      DYNPRO_NUMBER = SYST-DYNNR

      FIELD_NAME    = ‘ ‘

    IMPORTING

      FILE_NAME     = P_FILE.

START-OF-SELECTION.

  CALL FUNCTION ‘TEXT_CONVERT_XLS_TO_SAP’

    EXPORTING

      I_FIELD_SEPERATOR    = ‘X’

      I_LINE_HEADER        = ‘X’

      I_TAB_RAW_DATA       = W_STRUCT

      I_FILENAME           = P_FILE

    TABLES

      I_TAB_CONVERTED_DATA = T_FIELD

    EXCEPTIONS

      CONVERSION_FAILED    = 1

      OTHERS               = 2.

  DATA : FNAM(20) TYPE C,

         IDX      TYPE CHAR3,

         IDX1     TYPE CHAR3,

         VAR      TYPE I,

         VAR1     TYPE I,

         CONTROL  TYPE CHAR5.

  IF NOT T_FIELD  IS INITIAL.

    EXPORT_FLD[] = T_FIELD[].

    EXPORT EXPORT_FLD TO MEMORY ID ‘CJIC_FLD’.

    CONTROL  = ‘B_CJIC’.

    EXPORT CONTROL TO  MEMORY ID ‘BDC_CJIC’.

  ENDIF.

  LOOP AT T_FIELD INTO W_FIELD.

    CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’

      EXPORTING

        INPUT  = W_FIELD-MATNR

      IMPORTING

        OUTPUT = W_FIELD-MATNR.

    APPEND W_FIELD TO TR_FIELD.

    EXPORT TR_FIELD TO MEMORY ID ‘CJIC_WA’.

    PERFORM BDC_DYNPRO      USING ‘RKPEP012’ ‘1000’.

    PERFORM BDC_FIELD       USING ‘BDC_CURSOR’

                                  ‘CN_PSPNR-LOW’.

    PERFORM BDC_FIELD       USING ‘BDC_OKCODE’

                                  ‘=ONLI’.

    PERFORM BDC_FIELD       USING ‘CN_PSPNR-LOW’

                                  W_FIELD-PSPNR  .

**                                  ‘N-00002.001’.

    PERFORM BDC_FIELD       USING ‘P_AFABE’

                                  ‘ 1’.

    PERFORM BDC_FIELD       USING ‘P_DISVAR’

                                  ‘/RITESH-1’.

    PERFORM BDC_DYNPRO      USING ‘SAPMSSY0’ ‘0120’.

    PERFORM BDC_FIELD       USING ‘BDC_CURSOR’

                                  ’04/03′.

    PERFORM BDC_FIELD       USING ‘BDC_OKCODE’

                                  ‘=BURG’.

    PERFORM BDC_DYNPRO      USING ‘SAPLKOBS’ ‘0130’.

    PERFORM BDC_FIELD       USING ‘BDC_CURSOR’

                                  ‘COBRB-URZUO(01)’.

    PERFORM BDC_FIELD       USING ‘BDC_OKCODE’

                                  ‘=BACK’.

    PERFORM BDC_FIELD       USING ‘COBRB-KONTY(01)’

                                  W_FIELD-KONTY.

*                                  ‘fxa’.

    PERFORM BDC_FIELD       USING ‘DKOBR-EMPGE(01)’

                                   W_FIELD-EMPGE.

    PERFORM BDC_FIELD       USING ‘COBRB-PROZS(01)’

                                  ‘100’.

    PERFORM BDC_DYNPRO      USING ‘SAPMSSY0’ ‘0120’.

    PERFORM BDC_FIELD       USING ‘BDC_CURSOR’

                                  ’04/03′.

    PERFORM BDC_FIELD       USING ‘BDC_OKCODE’

                                  ‘=BSAV’.

**

    CALL TRANSACTION ‘CJIC’ USING IT_BDCDATA

                            MODE  ‘N’

                            UPDATE ‘S’

                            MESSAGES INTO IT_BDCMSGCOLL.

    IF SY-SUBRC = 0.

      APPEND W_FIELD TO S_FIELD    .

    ELSE.

      APPEND W_FIELD TO E_FIELD    .

    ENDIF.

    REFRESH: IT_BDCDATA.

    CLEAR: W_FIELD,TR_FIELD.

    FREE MEMORY ID ‘CJIC_WA’.

  ENDLOOP.

  PERFORM MSG_DISPLAY.

FORM BDC_DYNPRO USING PROG SCR.

  CLEAR IT_BDCDATA.

  IT_BDCDATA-PROGRAM = PROG.

  IT_BDCDATA-DYNPRO  = SCR.

  IT_BDCDATA-DYNBEGIN = ‘X’.

  APPEND IT_BDCDATA.

ENDFORM.                    “BDC_DYNPRO

FORM BDC_FIELD USING FNAM FVAL.

  CLEAR IT_BDCDATA.

  IT_BDCDATA-FNAM = FNAM.

  IT_BDCDATA-FVAL  = FVAL.

  APPEND IT_BDCDATA.

ENDFORM.                    “BDC_FIELD

FORM MSG_DISPLAY.

  IF NOT   S_FIELD IS   INITIAL.

    LOOP AT  S_FIELD INTO W_FIELD .

      WRITE: ‘Success:: ‘, W_FIELD-REFBN,’,’, W_FIELD-MATNR,’,’,W_FIELD-REFBZ ,

             /.

    ENDLOOP.

  ENDIF.

  IF NOT E_FIELD IS INITIAL.

    LOOP AT  E_FIELD INTO W_FIELD .

      WRITE: ‘Error:: ‘, W_FIELD-REFBN,’,’, W_FIELD-MATNR,’,’,W_FIELD-REFBZ ,

             /.

    ENDLOOP.

  ENDIF.

ENDFORM.                    ” MSG_DISPLAY

Another Program we have to Update: LKAEPFIM

Capture.JPG

update “FORM IM_DIST_RULE_MAINTAIN USING    U_ATGVRG

                                     U_LISTE.



ENHANCEMENT ZCJIC_BDC.    “active version

****Added BY Sadruz as on 02.09.2015

*  if sy-uname = ‘DWLDEV’.

*************************************************************************************

*****This part of enhancement will run only with BDc program ZPS_CJIC_SETTLEMENT_RULE.

*************************************************************************************

DATA: IT_GT_COVP_EXT  TYPE KAEP_T_COVP_EXT,

         ITT_GT_COVP_EXT TYPE KAEP_T_COVP_EXT,

         WA_LS_COVP_EXT  TYPE KAEP_COVP_EXT,

         WS_COVP_EXT     TYPE KAEP_COVP_EXT,

         CONTROL         TYPE CHAR5..

   TYPES : BEGIN OF IT_CJIC ,

           PSPNR TYPE PRPS_RPOSID,    ” WBS Number

           KONTY TYPE TBO01OBART_LD“Account assignment category

           EMPGE TYPE DKOBREMPGE,     “Fixed Assets Number

**          BETRR TYPE CHAR40,          ” Amount, COBRB-BETRR,

**          URZUO TYPE COBRB-URZUO,     “Source Assignment

           REFBN TYPE KAEP_COACREFBN, “Reference Document Number

           MATNR TYPE KAEP_COEP_XMATNR” material No.

           REFBZ TYPE KAEP_COACREFBZ” Posting Row

**          PROZS TYPE COBRB-PROZS,      ” Percent

         END OF IT_CJIC.

   DATA: EXPORT_FLD TYPE STANDARD TABLE OF IT_CJIC,

         TR_FIELD type STANDARD TABLE OF IT_CJIC,

         W_CJIC     TYPE IT_CJIC.

   DATA: W_FIELD    TYPE IT_CJIC.

   IMPORT EXPORT_FLD FROM MEMORY ID ‘CJIC_FLD’.

   IMPORT CONTROL FROM MEMORY ID ‘BDC_CJIC’.

   import TR_FIELD  from MEMORY Id ‘CJIC_WA’.

   IF CONTROL = ‘B_CJI’.

     IT_GT_COVP_EXT[] = GT_COVP_EXT[].

     LOOP AT IT_GT_COVP_EXT INTO WA_LS_COVP_EXT.

       READ TABLE TR_FIELD INTO W_CJIC WITH KEY REFBN = WA_LS_COVP_EXTREFBN

                                                matnr = WA_LS_COVP_EXTmatnr

                                                REFBZ = WA_LS_COVP_EXTREFBZ.

       IF SYSUBRC = 0.

         WA_LS_COVP_EXTSELKZ = ‘X’.

       ENDIF.

       APPEND WA_LS_COVP_EXT TO ITT_GT_COVP_EXT .

     ENDLOOP.

     GT_COVP_EXT[] = ITT_GT_COVP_EXT[].

   ENDIF.

*ENDIF.

***************End of addition**********************************************************

ENDENHANCEMENT.

Information


Finally when we run this

Capture7.JPG

and select Excel file.

content to be added in Excel file as below:

Capture1.JPG

System will check ref. Document Number, Material and Posting Row (Posting row of reference document)

on basis of these combination system will create settlement rule for line item.

Capture1.JPG

Execute and below is output:

Capture1.JPG

NOTE: while executing this program sometime we get Memory_No_More_Paging Dump. to resolve this issue you have to set Parameter “rdisp/PG_MAXFS” with help of basis Consultant. also refer SAP NOTE- 0000133909.

please check below screen:

Execute-RZ11

Capture1.JPG

click on Display:

Capture2.JPG

Yellow highlighted value needs to change with help of Basis Consultant.


Thank you for reading and hope you liked it.

Thank you for your time and feedback!

Suggestions would be appreciated and always welcome to improve Quality of this document.

Warm Regards

Sunil Yadav

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply