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

LDB CMC with LDB_PROCESS FM ?

Former Member
0 Likes
864

Dear All,

1. I'm calling the Function Module LDB_PROCESS in my Program.

2. I'm passing CMC LDB to the above FM.

3. I've built the Necessary params to pass onto the FM.

4. But my Form is not getting triggered.

Please let me know the reason !

Enclosed is the code :



Data: wa_mastb like mastb.
SELECT-OPTIONS: s_matnr for wa_mastb-matnr.

DATA: CALLBACK    TYPE TABLE OF LDBCB,
            CALLBACK_WA LIKE LINE  OF CALLBACK.

DATA: gt_SELTAB  TYPE TABLE OF RSPARAMS,
            gwa_SELTAB LIKE LINE  OF gt_SELTAB.

CLEAR CALLBACK_WA.
CALLBACK_WA-LDBNODE     = 'MASTB'.
CALLBACK_WA-GET         = 'X'.
CALLBACK_WA-GET_LATE    = ' '.
CALLBACK_WA-CB_PROG     = SY-REPID.
CALLBACK_WA-CB_FORM     = 'CALL_MASTB'.
APPEND CALLBACK_WA TO CALLBACK.

gwa_SELTAB-KIND    = 'S'.
gwa_SELTAB-SELNAME = 'MATNR'.

Loop at s_matnr.
  MOVE-CORRESPONDING s_matnr to gwa_SELTAB.
  append gwa_SELTAB to gt_seltab.
endloop.

START-OF-SELECTION.

CALL FUNCTION 'LDB_PROCESS'
  EXPORTING
    LDBNAME                           = 'CMC'
*   VARIANT                           =
*   EXPRESSIONS                       =
*   FIELD_SELECTION                   =
*   DYN_NODE_TYPES                    =
  TABLES
    CALLBACK                          = CALLBACK
    SELECTIONS                        = gt_SELTAB.
IF SY-SUBRC <> 0.
Write:/ 'Error in the Call of the LDB FM'.
ENDIF.

end-of-SELECTION.

FORM CALL_MASTB USING PD_NODE LIKE LDBN-LDBNODE
                                              PD_WORKAREA like mastb
                                              PD_MODE     TYPE C
                                              PD_SELECTED TYPE C.

data: ls_mastb like mastb.

  CASE PD_NODE.

    WHEN 'MASTB'.
      LS_mastb = PD_WORKAREA.
      write:/ ls_mastb-matnr, ls_mastb-werks.

  ENDCASE.
ENDFORM.

Regards,

Deepu.K

.

Dear All,

1. I'm calling the Function Module LDB_PROCESS in my Program.

2. I'm passing CMC LDB to the above FM.

3. I've built the Necessary params to pass onto the FM.

4. But my Form is not getting triggered.

Please let me know the reason !

Enclosed is the code :



Data: wa_mastb like mastb.
SELECT-OPTIONS: s_matnr for wa_mastb-matnr.

DATA: CALLBACK    TYPE TABLE OF LDBCB,
            CALLBACK_WA LIKE LINE  OF CALLBACK.

DATA: gt_SELTAB  TYPE TABLE OF RSPARAMS,
            gwa_SELTAB LIKE LINE  OF gt_SELTAB.

CLEAR CALLBACK_WA.
CALLBACK_WA-LDBNODE     = 'MASTB'.
CALLBACK_WA-GET         = 'X'.
CALLBACK_WA-GET_LATE    = ' '.
CALLBACK_WA-CB_PROG     = SY-REPID.
CALLBACK_WA-CB_FORM     = 'CALL_MASTB'.
APPEND CALLBACK_WA TO CALLBACK.

gwa_SELTAB-KIND    = 'S'.
gwa_SELTAB-SELNAME = 'MATNR'.

Loop at s_matnr.
  MOVE-CORRESPONDING s_matnr to gwa_SELTAB.
  append gwa_SELTAB to gt_seltab.
endloop.

START-OF-SELECTION.

CALL FUNCTION 'LDB_PROCESS'
  EXPORTING
    LDBNAME                           = 'CMC'
*   VARIANT                           =
*   EXPRESSIONS                       =
*   FIELD_SELECTION                   =
*   DYN_NODE_TYPES                    =
  TABLES
    CALLBACK                          = CALLBACK
    SELECTIONS                        = gt_SELTAB.
IF SY-SUBRC <> 0.
Write:/ 'Error in the Call of the LDB FM'.
ENDIF.

end-of-SELECTION.

FORM CALL_MASTB USING PD_NODE LIKE LDBN-LDBNODE
                                              PD_WORKAREA like mastb
                                              PD_MODE     TYPE C
                                              PD_SELECTED TYPE C.

data: ls_mastb like mastb.

  CASE PD_NODE.

    WHEN 'MASTB'.
      LS_mastb = PD_WORKAREA.
      write:/ ls_mastb-matnr, ls_mastb-werks.

  ENDCASE.
ENDFORM.

Regards,

Deepu.K

.

4 REPLIES 4
Read only

former_member194669
Active Contributor
0 Likes
789

Pleaseremove and try


end-of-SELECTION.

or try to use demo program DEMO_LOGICAL_DATABASE

Read only

0 Likes
789

Hello A@s,

I even tried those.

The Demo Program is working fine.

The reason, what I'm thinking is: In the Demo Progrm the SFLIGHT is a table and so the Form Routine is called. But in the CMC LDB, the Table MASTB is not a physical Table and so the Form Routine is not being called.

But, anyways, I wanted this to work.

Let me know how to achieve this !

Regards,

Deepu.K

Read only

0 Likes
789

Hi!

for CMC LDB you must add parameter:


PARAMETERS :
         datuv LIKE stko-datuv  DEFAULT sy-datum.

and fill it


CLEAR gwa_seltab.
gwa_seltab-kind    = 'P'.
gwa_seltab-selname = 'DATUV'.
gwa_seltab-sign    = 'I'.
gwa_seltab-option  = 'EQ'.
gwa_seltab-low = datuv .
APPEND gwa_seltab TO gt_seltab.

Read only

Former Member
0 Likes
789

Avoided LDB Approach.